Пример #1
1
function cf7bs_number_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $mode = $status = 'default';
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class($tag->type);
    $class .= ' wpcf7-validates-as-number';
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
        $status = 'error';
    }
    if ($tag->is_required()) {
        $mode = 'required';
    }
    $value = (string) reset($tag->values);
    $placeholder = '';
    if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
        $placeholder = $value;
        $value = '';
    }
    if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
        $value = stripslashes_deep($_POST[$tag->name]);
    } elseif (isset($_GET) && array_key_exists($tag->name, $_GET)) {
        $value = stripslashes_deep(rawurldecode($_GET[$tag->name]));
    }
    $field = new CF7BS_Form_Field(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => wpcf7_support_html5() ? $tag->basetype : 'text', 'value' => $value, 'placeholder' => $placeholder, 'label' => $tag->content, 'options' => array('min' => $tag->get_option('min', 'signed_int', true), 'max' => $tag->get_option('max', 'signed_int', true), 'step' => $tag->get_option('step', 'int', true)), 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'readonly' => $tag->has_option('readonly') ? true : false, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name));
    $html = $field->display(false);
    return $html;
}
 function pop_handle_save()
 {
     if (!isset($_POST[$this->id . '_options'])) {
         return;
     }
     if (!current_user_can($this->capability)) {
         return;
     }
     $options = explode(',', stripslashes($_POST['page_' . $this->id]));
     if ($options) {
         $existing_options = $this->get_options();
         foreach ($options as $option) {
             $option = trim($option);
             $value = null;
             if (isset($_POST[$option])) {
                 $value = $_POST[$option];
             }
             if (!is_array($value)) {
                 $value = trim($value);
             }
             $value = stripslashes_deep($value);
             $existing_options[$option] = $value;
         }
         update_option($this->options_varname, $existing_options);
     }
     do_action('pop_handle_save', $this);
     //------------------------------
     $goback = add_query_arg('updated', 'true', wp_get_referer());
     if (isset($_REQUEST['tabs_selected_tab']) && $_REQUEST['tabs_selected_tab'] != '') {
         $goback = add_query_arg('tabs_selected_tab', $_REQUEST['tabs_selected_tab'], $goback);
     }
     wp_redirect($goback);
 }
function cf7bs_file_shortcode_handler($tag)
{
    $tag = new WPCF7_Shortcode($tag);
    if (empty($tag->name)) {
        return '';
    }
    $mode = $status = 'default';
    $validation_error = wpcf7_get_validation_error($tag->name);
    $class = wpcf7_form_controls_class($tag->type);
    if ($validation_error) {
        $class .= ' wpcf7-not-valid';
        $status = 'error';
    }
    // size is not used since Bootstrap input fields always scale 100%
    //$atts['size'] = $tag->get_size_option( '40' );
    if ($tag->is_required()) {
        $mode = 'required';
    }
    $value = (string) reset($tag->values);
    $placeholder = '';
    if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
        $placeholder = $value;
        $value = '';
    } elseif (empty($value)) {
        $value = $tag->get_default_option();
    }
    if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
        $value = stripslashes_deep($_POST[$tag->name]);
    }
    $field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => 'file', 'value' => '1', 'label' => $tag->content, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
    $html = $field->display(false);
    return $html;
}
Пример #4
0
 protected function do_($action, $data, $content = '')
 {
     extract($data);
     // Get widget type and number
     $id_base = explode('-', $widget_id);
     $widget_nr = array_pop($id_base);
     $id_base = implode('-', $id_base);
     // Get widget instance
     $widget_key = 'widget_' . $id_base;
     $widgets = get_option($widget_key);
     $instance =& $widgets[$widget_nr];
     // Get widget class
     foreach ($GLOBALS['wp_widget_factory']->widgets as $widget_obj) {
         if ($widget_obj->id_base == $id_base) {
             break;
         }
     }
     // Get response
     if ('get' == $action) {
         ob_start();
         $widget_obj->form($instance);
         return ob_get_clean();
     }
     if ('save' == $action) {
         $new_instance = stripslashes_deep(reset($_POST['widget-' . $id_base]));
         $instance = $widget_obj->update($new_instance, $instance);
         update_option($widget_key, $widgets);
     }
 }
Пример #5
0
 /**
  * Constructor for the modal class.
  *
  * @param string $handle A slug-like definition of the modal.
  * @param array $fields An array containing a default set of fields that belong to the modal.
  * @param array $data An array containing the data for the fields that belong to the modal.
  * @param array $config Optional configuration array.
  * @since 0.1.0
  */
 function __construct($handle, $fields = array(), $data = array(), $config = array())
 {
     $this->_data = stripslashes_deep($data);
     $this->_config = wp_parse_args($config, array('title' => __('Edit', 'ev_framework'), 'title_controls' => '', 'button' => __('OK', 'ev_framework'), 'button_nonce' => wp_create_nonce("ev_modal_{$handle}"), 'footer_content' => ''));
     $title = isset($this->_config['title']) ? $this->_config['title'] : '';
     parent::__construct($handle, $title, $fields);
 }
 /**
  * parse_gateway_notification method, receives data from the payment gateway
  * @access private
  */
 function parse_gateway_notification()
 {
     /// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
     if ('sandbox' == get_option('paypal_certified_server_type')) {
         $paypal_url = "https://www.sandbox.paypal.com/webscr";
     } else {
         $API_Endpoint = "https://api-3t.paypal.com/nvp";
         $paypal_url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $received_values = array();
     $received_values['cmd'] = '_notify-validate';
     $received_values += stripslashes_deep($_POST);
     $options = array('timeout' => 20, 'body' => $received_values, 'httpversion' => '1.1', 'user-agent' => 'WP e-Commerce/' . WPSC_PRESENTABLE_VERSION);
     $response = wp_remote_post($paypal_url, $options);
     do_action('wpsc_paypal_express_ipn', $received_values, $this);
     if ('VERIFIED' == $response['body']) {
         $this->paypal_ipn_values = $received_values;
         $this->session_id = $received_values['invoice'];
         if (strtolower($received_values['payment_status']) == 'completed') {
             $this->set_purchase_processed_by_sessionid(3);
             transaction_results($this->session_id, false);
         } elseif (strtolower($received_values['payment_status']) == 'denied') {
             $this->set_purchase_processed_by_sessionid(6);
         }
     } else {
         exit("IPN Request Failure");
     }
 }
 protected function _handleSubmittedData()
 {
     if (!$this->_verifyFormSubmit()) {
         return;
     }
     $_aDefaultOptions = $this->oProp->getDefaultOptions($this->oForm->aFields);
     $_aOptions = $this->oUtil->addAndApplyFilter($this, "validation_saved_options_{$this->oProp->sClassName}", $this->oUtil->uniteArrays($this->oProp->aOptions, $_aDefaultOptions), $this);
     $_aInput = $this->oUtil->getElementAsArray($_POST, $this->oProp->sOptionKey, array());
     $_aInput = stripslashes_deep($_aInput);
     $_aInputRaw = $_aInput;
     $_sTabSlug = $this->oUtil->getElement($_POST, 'tab_slug', '');
     $_sPageSlug = $this->oUtil->getElement($_POST, 'page_slug', '');
     $_aInput = $this->oUtil->uniteArrays($_aInput, $this->oUtil->castArrayContents($_aInput, $this->_removePageElements($_aDefaultOptions, $_sPageSlug, $_sTabSlug)));
     $_aSubmit = $this->oUtil->getElementAsArray($_POST, '__submit', array());
     $_sSubmitSectionID = $this->_getPressedSubmitButtonData($_aSubmit, 'section_id');
     $_sPressedFieldID = $this->_getPressedSubmitButtonData($_aSubmit, 'field_id');
     $_sPressedInputID = $this->_getPressedSubmitButtonData($_aSubmit, 'input_id');
     $this->_doActions_submit($_aInput, $_aOptions, $_sPageSlug, $_sTabSlug, $_sSubmitSectionID, $_sPressedFieldID, $_sPressedInputID);
     $_aStatus = array('settings-updated' => true);
     $_aInput = $this->_validateSubmittedData($_aInput, $_aInputRaw, $_aOptions, $_aStatus);
     $_bUpdated = false;
     if (!$this->oProp->_bDisableSavingOptions) {
         $_bUpdated = $this->oProp->updateOption($_aInput);
     }
     $this->_doActions_submit_after($_aInput, $_aOptions, $_sPageSlug, $_sTabSlug, $_sSubmitSectionID, $_sPressedFieldID, $_bUpdated);
     exit(wp_redirect($this->_getSettingUpdateURL($_aStatus, $_sPageSlug, $_sTabSlug)));
 }
Пример #8
0
function ssbl_settings()
{
    // check if user has the rights to manage options
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    // if a post has been made
    if (isset($_POST['ssblData'])) {
        // get posted data
        $ssblPost = $_POST['ssblData'];
        parse_str($ssblPost, $ssblPost);
        // if the nonce doesn't check out...
        if (!isset($ssblPost['ssbl_save_nonce']) || !wp_verify_nonce($ssblPost['ssbl_save_nonce'], 'ssbl_save_settings')) {
            die('There was no nonce provided, or the one provided did not verify.');
        }
        // prepare array to save
        $arrOptions = array('pages' => isset($ssblPost['pages']) ? stripslashes_deep($ssblPost['pages']) : null, 'posts' => isset($ssblPost['posts']) ? stripslashes_deep($ssblPost['posts']) : null, 'share_text' => isset($ssblPost['share_text']) ? stripslashes_deep($ssblPost['share_text']) : null, 'image_set' => isset($ssblPost['image_set']) ? stripslashes_deep($ssblPost['image_set']) : null, 'selected_buttons' => isset($ssblPost['selected_buttons']) ? stripslashes_deep($ssblPost['selected_buttons']) : null);
        // save the settings
        ssbl_update_options($arrOptions);
        return true;
    }
    // include required admin view
    include_once SSBL_ROOT . '/system/views/ssbl_admin_panel.php';
    // get ssbl settings
    $ssbl_settings = get_ssbl_settings();
    // --------- ADMIN PANEL ------------ //
    ssbl_admin_panel($ssbl_settings);
}
Пример #9
0
function jiathis_options()
{
    $updated = false;
    if ($_POST['jiathis_code'] != '') {
        $jiathis_share_code = stripslashes_deep($_POST['jiathis_code']);
        update_option('jiathis_code', $jiathis_share_code);
        $share_pos = explode('|', $_POST['share_pos']);
        $inpage = empty($_POST['inpage']) ? 'no' : $_POST['inpage'];
        update_option('jiathis_pos', $share_pos[0]);
        update_option('jiathis_dir', $share_pos[1]);
        update_option('jiathis_feed', $inpage);
        $updated = true;
    }
    $jiathis_code = get_option('jiathis_code');
    echo '<div class="wrap">';
    echo '<form name="jiathis_form" method="post" action="">';
    echo '<p style="font-weight:bold;">jiaThis分享代码(请从<a href="http://www.jiathis.com/" target="_blank">JiaThis官网</a>获取):</p>';
    echo '<p style="line-height:25px;"><span style="color:#000">JiaThis分享按钮主要分为:侧栏式、按钮式、工具式和图标式。默认嵌入的是"大图标"代码,显示在文章内容页的下面。<a href="http://www.jiathis.com/getcode/" target="_blank"><u>如果您想更换按钮风格,请点击这里到JiaThis官网获取新代码</u></a>。如果您需要对网站的分享数据进行追踪与分析,只需要到JiaThis<a href="http://www.jiathis.com/register" target="_blank"><u>免费注册</u></a>并重新获取代码嵌入这里即可。</span></p>';
    if ($updated) {
        echo '<div class="updated settings-error" id="setting-error-settings_updated"><p><strong>JiaThis分享代码已经成功保存。</strong></p></div>';
    }
    echo '<p><textarea style="height:250px;width:700px" name="jiathis_code">' . $jiathis_code . '</textarea></p>';
    echo '<input type="checkbox" name="inpage" value="yes" ' . (get_option('jiathis_feed') == 'yes' ? 'checked="checked"' : '') . '/>&nbsp;&nbsp;只在文章详细页面显示<br><br>';
    echo '文章头部 :&nbsp;&nbsp;&nbsp;';
    echo '<input type="radio" name="share_pos" value="up|left" ' . (get_option('jiathis_dir') == 'left' && get_option('jiathis_pos') == 'up' ? 'checked="checked"' : '') . ' /> 居左&nbsp;&nbsp;';
    echo '<input type="radio" name="share_pos" value="up|right" ' . (get_option('jiathis_dir') == 'right' && get_option('jiathis_pos') == 'up' ? 'checked="checked"' : '') . ' /> 居右&nbsp;';
    echo '<br /><br />';
    echo '文章尾部 :&nbsp;&nbsp;&nbsp;';
    echo '<input type="radio" name="share_pos" value="down|left" ' . (get_option('jiathis_dir') == 'left' && get_option('jiathis_pos') == 'down' ? 'checked="checked"' : '') . ' /> 居左&nbsp;&nbsp;';
    echo '<input type="radio" name="share_pos" value="down|right" ' . (get_option('jiathis_dir') == 'right' && get_option('jiathis_pos') == 'down' ? 'checked="checked"' : '') . ' /> 居右&nbsp;';
    echo '<p class="submit"><input type="submit" value="确认提交"/>';
    echo '<input type="button" value="返回" onclick="window.location.href=\'plugins.php\';" /></p>';
    echo '</form>';
    echo '</div>';
}
Пример #10
0
 public function do_execute()
 {
     $variables = array();
     // Handle updating of theme options.
     if (isset($_POST[Ai1ec_View_Theme_Options::SUBMIT_ID])) {
         $_POST = stripslashes_deep($_POST);
         $lessphp = $this->_registry->get('less.lessphp');
         $variables = $lessphp->get_saved_variables();
         foreach ($variables as $variable_name => $variable_params) {
             if (isset($_POST[$variable_name])) {
                 // Avoid problems for those who are foolish enough to leave php.ini
                 // settings at their defaults, which has magic quotes enabled.
                 if (get_magic_quotes_gpc()) {
                     $_POST[$variable_name] = stripslashes($_POST[$variable_name]);
                 }
                 if (Ai1ec_Less_Variable_Font::CUSTOM_FONT === $_POST[$variable_name]) {
                     $_POST[$variable_name] = $_POST[$variable_name . Ai1ec_Less_Variable_Font::CUSTOM_FONT_ID_SUFFIX];
                 }
                 // update the original array
                 $variables[$variable_name]['value'] = $_POST[$variable_name];
             }
         }
         $_POST = add_magic_quotes($_POST);
     } elseif (isset($_POST[Ai1ec_View_Theme_Options::RESET_ID])) {
         $option = $this->_registry->get('model.option');
         $option->delete('ai1ec_less_variables');
         $option->delete('ai1ec_render_css');
         do_action('ai1ec_reset_less_variables');
     }
     $css = $this->_registry->get('css.frontend');
     $css->update_variables_and_compile_css($variables, isset($_POST[Ai1ec_View_Theme_Options::RESET_ID]));
     return array('url' => ai1ec_admin_url('edit.php?post_type=ai1ec_event&page=all-in-one-event-calendar-edit-css'), 'query_args' => array());
 }
Пример #11
0
 function init()
 {
     if (current_user_can('administrator')) {
         $this->post = stripslashes_deep($_POST);
         $this->register_ajax('red_log_show');
         $this->register_ajax('red_log_hide');
         $this->register_ajax('red_log_delete');
         $this->register_ajax('red_module_edit');
         $this->register_ajax('red_module_load');
         $this->register_ajax('red_module_save');
         $this->register_ajax('red_module_reset');
         $this->register_ajax('red_module_delete');
         $this->register_ajax('red_group_edit');
         $this->register_ajax('red_group_load');
         $this->register_ajax('red_group_save');
         $this->register_ajax('red_group_toggle');
         $this->register_ajax('red_group_delete');
         $this->register_ajax('red_group_reset');
         $this->register_ajax('red_group_move');
         $this->register_ajax('red_group_saveorder');
         $this->register_ajax('red_redirect_edit');
         $this->register_ajax('red_redirect_load');
         $this->register_ajax('red_redirect_save');
         $this->register_ajax('red_redirect_toggle');
         $this->register_ajax('red_redirect_delete');
         $this->register_ajax('red_redirect_reset');
         $this->register_ajax('red_redirect_move');
         $this->register_ajax('red_redirect_saveorder');
         $this->register_ajax('red_redirect_add');
     }
 }
 /**
  * Build edit form fields.
  *
  * @since 4.4
  */
 public function renderFields()
 {
     if (!vc_verify_admin_nonce() || !current_user_can('edit_posts') && !current_user_can('edit_pages')) {
         wp_send_json(array('success' => false));
     }
     function array_htmlspecialchars_decode(&$input)
     {
         if (is_array($input)) {
             foreach ($input as $key => $value) {
                 if (is_array($value)) {
                     $input[$key] = array_htmlspecialchars_decode($value);
                 } else {
                     $input[$key] = htmlspecialchars_decode($value);
                 }
             }
             return $input;
         }
         return htmlspecialchars_decode($input);
     }
     $params = array_map('array_htmlspecialchars_decode', (array) stripslashes_deep(vc_post_param('params')));
     $tag = stripslashes(vc_post_param('tag'));
     require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
     $fields = new Vc_Edit_Form_Fields($tag, $params);
     $fields->render();
     die;
 }
/**
 * Register the post types.
 *
 * @since 1.0.0
 *
 * @global array $wp_post_types List of post types.
 */
function geodir_register_post_types()
{
    global $wp_post_types;
    $post_types = array();
    $post_types = get_option('geodir_post_types');
    // Register each post type if array of data is returned
    if (is_array($post_types)) {
        foreach ($post_types as $post_type => $args) {
            if ($post_type == 'gd_place' && get_option('geodir_disable_place_tax')) {
                continue;
            }
            if (!empty($args['rewrite']['slug'])) {
                $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', GEODIRECTORY_TEXTDOMAIN);
            }
            $args = stripslashes_deep($args);
            if (!empty($args['labels'])) {
                foreach ($args['labels'] as $key => $val) {
                    $args['labels'][$key] = __($val, GEODIRECTORY_TEXTDOMAIN);
                    // allow translation
                }
            }
            /**
             * Filter post type args.
             *
             * @since 1.0.0
             * @param string $args Post type args.
             * @param string $post_type The post type.
             */
            $args = apply_filters('geodir_post_type_args', $args, $post_type);
            $post_type = register_post_type($post_type, $args);
        }
    }
}
Пример #14
0
 /**
  * Show opt out options page
  * 
  */
 public function options()
 {
     global $wpdb;
     $errors = array();
     $success = false;
     $opt_out_level = get_option("bbpp_thankmelater_opt_out_level", "disabled");
     $opt_out_form_type = get_option("bbpp_thankmelater_opt_out_form_type", "out");
     $opt_out_form_out_text = get_option("bbpp_thankmelater_opt_out_form_out_text", "1");
     $opt_out_form_out_text_custom = get_option("bbpp_thankmelater_opt_out_form_out_text_custom", "");
     $opt_out_form_in_text = get_option("bbpp_thankmelater_opt_out_form_in_text", "1");
     $opt_out_form_in_text_custom = get_option("bbpp_thankmelater_opt_out_form_in_text_custom", "");
     if ($_POST) {
         check_admin_referer("bbpp_thankmelater_opt_out_options");
         $data = stripslashes_deep($_POST);
         $opt_out_level = isset($data["bbpp_thankmelater_opt_out_level"]) ? $data["bbpp_thankmelater_opt_out_level"] : NULL;
         $opt_out_form_type = isset($data["bbpp_thankmelater_opt_out_form_type"]) ? $data["bbpp_thankmelater_opt_out_form_type"] : NULL;
         $opt_out_form_out_text = isset($data["bbpp_thankmelater_opt_out_form_out_text"]) ? $data["bbpp_thankmelater_opt_out_form_out_text"] : NULL;
         $opt_out_form_out_text_custom = isset($data["bbpp_thankmelater_opt_out_form_out_text_custom"]) ? $data["bbpp_thankmelater_opt_out_form_out_text_custom"] : NULL;
         $opt_out_form_in_text = isset($data["bbpp_thankmelater_opt_out_form_in_text"]) ? $data["bbpp_thankmelater_opt_out_form_in_text"] : NULL;
         $opt_out_form_in_text_custom = isset($data["bbpp_thankmelater_opt_out_form_in_text_custom"]) ? $data["bbpp_thankmelater_opt_out_form_in_text_custom"] : NULL;
         $error = new WP_Error();
         if (!in_array($opt_out_level, array("disabled", "email", "form"))) {
             $error->add("opt_out_level", __("You must select an option.", "bbpp-thankmelater"));
         }
         if ($opt_out_level == "form") {
             if (!in_array($opt_out_form_type, array("out", "in"))) {
                 $error->add("opt_out_form_type", __("You must select an option.", "bbpp-thankmelater"));
             }
             if ($opt_out_form_type == "out") {
                 if (!in_array($opt_out_form_out_text, array("1", "custom"))) {
                     $error->add("opt_out_form_out_text", __("You must select an option.", "bbpp-thankmelater"));
                 }
                 if ($opt_out_form_out_text == "custom" && empty($opt_out_form_out_text_custom)) {
                     $error->add("opt_out_form_out_text", __("This must not be blank.", "bbpp-thankmelater"));
                 }
             } elseif ($opt_out_form_type == "in") {
                 if (!in_array($opt_out_form_in_text, array("1", "custom"))) {
                     $error->add("opt_out_form_in_text", __("You must select an option.", "bbpp-thankmelater"));
                 }
                 if ($opt_out_form_in_text == "custom" && empty($opt_out_form_in_text_custom)) {
                     $error->add("opt_out_form_in_text", __("This must not be blank.", "bbpp-thankmelater"));
                 }
             }
         }
         if ($error->get_error_codes()) {
             $errors[] = $error;
         } else {
             update_option("bbpp_thankmelater_opt_out_level", $opt_out_level);
             update_option("bbpp_thankmelater_opt_out_form_type", $opt_out_form_type);
             update_option("bbpp_thankmelater_opt_out_form_out_text", $opt_out_form_out_text);
             update_option("bbpp_thankmelater_opt_out_form_out_text_custom", $opt_out_form_out_text_custom);
             update_option("bbpp_thankmelater_opt_out_form_in_text", $opt_out_form_in_text);
             update_option("bbpp_thankmelater_opt_out_form_in_text_custom", $opt_out_form_in_text_custom);
             $success = true;
         }
     }
     // get a list of the most recent opt outs
     $opt_out_results = $wpdb->get_results("\r\n\t\t\tSELECT `email`, `date_gmt`\r\n\t\t\tFROM `{$wpdb->prefix}bbpp_thankmelater_opt_outs`\r\n\t\t\tORDER BY `date_gmt` DESC\r\n\t\t\tLIMIT 100\r\n\t\t");
     require_once BBPP_THANKMELATER_PLUGIN_PATH . "admin/opt-out/options.php";
 }
Пример #15
0
 /**
  * 启动
  *
  * @author         mrmsl <*****@*****.**>
  * @date           2012-12-25 10:05:23
  * @lastmodify     2013-01-21 15:25:25 by mrmsl
  *
  * @return void 无返回值
  */
 private function _init()
 {
     set_error_handler('error_handler');
     set_exception_handler('exception_handler');
     register_shutdown_function('fatal_error');
     //spl_autoload_register('autoload');
     ob_get_level() != 0 && ob_end_clean();
     if (IS_LOCAL && APP_DEBUG) {
         //本地开发环境
         error_reporting(E_ALL | E_STRICT);
         //错误报告
         ini_set('display_errors', 1);
         //显示错误
     } else {
         ini_set('display_errors', 0);
     }
     if (get_magic_quotes_gpc()) {
         !empty($_GET) && ($_GET = stripslashes_deep($_GET));
         !empty($_POST) && ($_POST = stripslashes_deep($_POST));
         !empty($_COOKIE) && ($_COOKIE = stripslashes_deep($_COOKIE));
     }
     date_default_timezone_set(sys_config('sys_timezone_default_timezone', '', DEFAULT_TIMEZONE));
     //设置系统时区
     define('APP_NOW_TIME', time());
     //当前时间戳
     $this->_initLangTheme();
     //语言包及皮肤
     $this->_initSession();
     //session
     C(include INCLUDE_PATH . 'config.inc.php');
     //配置
 }
Пример #16
0
/**
 * Filter `update_plugins` transient data.
 *
 * @note This is what makes updates of the framework possible.
 *
 * @since 160501 Rewrite before launch.
 *
 * @param \StdClass|mixed $report Report details.
 *
 * @return \StdClass|mixed Report details.
 */
function ___wp_sharks_core_rv_filter_transient_update_plugins($report)
{
    $_r = stripslashes_deep($_REQUEST);
    if (empty($_r['action']) || $_r['action'] !== 'upgrade-plugin') {
        return $report;
        // Nothing to do here.
    } elseif (empty($_r['___action_via']) || $_r['___action_via'] !== 'wp-sharks-core-rv') {
        return $report;
        // Not applicable.
    } elseif (empty($_r['plugin']) || $_r['plugin'] !== 'wp-sharks-core/plugin.php') {
        return $report;
        // Not applicable.
    }
    if (!is_object($report)) {
        $report = (object) [];
        // New object class.
    }
    if (!isset($report->response) || !is_array($report->response)) {
        $report->response = [];
        // Force an array value.
    }
    $report->response['wp-sharks-core/plugin.php'] = (object) ['id' => -1, 'new_version' => 'latest', 'slug' => 'wp-sharks-core', 'plugin' => 'wp-sharks-core/plugin.php', 'url' => ___wp_sharks_core_rv_product_url(), 'package' => ___wp_sharks_core_rv_latest_zip_url(), 'tested' => ___wp_sharks_core_rv_get_wp_version()];
    return $report;
    // With update properties.
}
Пример #17
0
function layotter_make_search_dump($data, $raw_post)
{
    $post_id = $raw_post['ID'];
    // don't change anything if not editing a Layotter-enabled post
    if (!Layotter::is_enabled_for_post($post_id) or !isset($raw_post['layotter_json'])) {
        return $data;
    }
    // copy JSON from POST and strip slashes that were added by Wordpress
    $json = $raw_post['layotter_json'];
    $unslashed_json = stripslashes_deep($json);
    // turn JSON into post content HTML
    $layotter_post = new Layotter_Post($unslashed_json);
    $content = $layotter_post->get_frontend_view();
    // save JSON to a custom field (oddly enough, Wordpress breaks JSON if it's stripslashed)
    update_post_meta($post_id, 'layotter_json', $json);
    // insert spaces to prevent <p>foo</p><p>bar</p> becoming "foobar" instead of "foo bar"
    // then strip all tags except <img>
    // then remove excess whitespace
    $spaced_content = str_replace('<', ' <', $content);
    $clean_content = strip_tags($spaced_content, '<img>');
    $normalized_content = trim($clean_content);
    if (function_exists('mb_ereg_replace')) {
        $normalized_content = mb_ereg_replace('/\\s+/', ' ', $normalized_content);
    }
    // wrap search dump with a [layotter] shortcode and return modified post data to be saved to the database
    // add the post ID because otherwise the shortcode handler would have no reliable way to get the post ID through
    // which the JSON data will be fetched
    $shortcoded_content = '[layotter post="' . $post_id . '"]' . $normalized_content . '[/layotter]';
    $data['post_content'] = $shortcoded_content;
    return $data;
}
Пример #18
0
 public function edit()
 {
     /* 语言项的路径 */
     $lang_file = isset($_POST['file_path']) ? trim($_POST['file_path']) : '';
     /* 替换前的语言项 */
     $src_items = !empty($_POST['item']) ? stripslashes_deep($_POST['item']) : '';
     /* 修改过后的语言项 */
     $dst_items = array();
     $_POST['item_id'] = stripslashes_deep($_POST['item_id']);
     for ($i = 0; $i < count($_POST['item_id']); $i++) {
         /* 语言项内容如果为空,不修改 */
         if (trim($_POST['item_content'][$i]) == '') {
             unset($src_items[$i]);
         } else {
             $_POST['item_content'][$i] = str_replace('\\\\n', '\\n', $_POST['item_content'][$i]);
             $dst_items[$i] = $_POST['item_id'][$i] . ' = ' . '"' . $_POST['item_content'][$i] . '";';
         }
     }
     /* 调用函数编辑语言项 */
     $result = $this->set_language_items($lang_file, $src_items, $dst_items);
     if ($result === false) {
         /* 修改失败提示信息 */
         $link[] = array('text' => L('back_list'), 'href' => 'javascript:history.back(-1)');
         $this->message(L('edit_languages_false'), NULL, $link);
     } else {
         /* 记录管理员操作 */
         // admin_log('', 'edit', 'languages');
         /* 清除缓存 */
         clear_cache_files();
         /* 成功提示信息 */
         $this->message(L('edit_languages_success'), url('editlanguages/index'));
     }
 }
Пример #19
0
 function __construct($options = null)
 {
     if ($options == null) {
         if (isset($_POST['options'])) {
             $this->data = stripslashes_deep($_POST['options']);
         }
     } else {
         $this->data = $options;
     }
     if (isset($_REQUEST['act'])) {
         $this->action = $_REQUEST['act'];
     }
     if (isset($_REQUEST['btn'])) {
         $this->button_data = $_REQUEST['btn'];
     }
     // Fields analysis
     if (isset($_REQUEST['fields'])) {
         $fields = $_REQUEST['fields'];
         if (is_array($fields)) {
             foreach ($fields as $name => $type) {
                 if ($type == 'datetime') {
                     // Ex. The user insert 01/07/2012 14:30 and it set the time zone to +2. We cannot use the
                     // mktime, since it uses the time zone of the machine. We create the time as if we are on
                     // GMT 0 and then we subtract the GMT offset (the example date and time on GMT+2 happens
                     // "before").
                     $time = gmmktime($_REQUEST[$name . '_hour'], 0, 0, $_REQUEST[$name . '_month'], $_REQUEST[$name . '_day'], $_REQUEST[$name . '_year']);
                     $time -= get_option('gmt_offset') * 3600;
                     $this->data[$name] = $time;
                 }
             }
         }
     }
 }
Пример #20
0
 static function get_data_by($field, $value)
 {
     if ('id' == $field) {
         if (!is_numeric($value)) {
             return false;
         }
         $value = intval($value);
         if ($value < 1) {
             return false;
         }
     } else {
         $value = trim($value);
     }
     if (!$value) {
         return false;
     }
     switch ($field) {
         case 'id':
             $custom_field_id = $value;
             $db_field = 'id';
             break;
         default:
             return false;
     }
     if (false !== $custom_field_id) {
         if ($custom_field = wp_cache_get($custom_field_id, 'yop_poll_custom_field')) {
             return $custom_field;
         }
     }
     if (!($custom_field = $GLOBALS['wpdb']->get_row($GLOBALS['wpdb']->prepare("SELECT\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$GLOBALS['wpdb']->yop_poll_custom_fields}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$db_field} = %s", $value)))) {
         return false;
     }
     wp_cache_add($custom_field->ID, $custom_field, 'yop_poll_custom_field');
     return stripslashes_deep($custom_field);
 }
 /**
  * Authorizations
  */
 function client_authorize()
 {
     $data = stripslashes_deep($_GET);
     $data['auth_type'] = 'client';
     $role = Jetpack::translate_current_user_to_role();
     $redirect = isset($data['redirect']) ? esc_url_raw((string) $data['redirect']) : '';
     $this->check_admin_referer("jetpack-authorize_{$role}_{$redirect}");
     $result = $this->authorize($data);
     if (is_wp_error($result)) {
         Jetpack::state('error', $result->get_error_code());
     }
     if (wp_validate_redirect($redirect)) {
         $this->wp_safe_redirect($redirect);
     } else {
         $this->wp_safe_redirect(Jetpack::admin_url());
     }
     /**
      * Fires after the Jetpack client is authorized to communicate with WordPress.com.
      *
      * @since 4.2.0
      *
      * @param int Jetpack Blog ID.
      */
     do_action('jetpack_client_authorized', Jetpack_Options::get_option('id'));
     $this->do_exit();
 }
Пример #22
0
 function GalleryGallery($data = array())
 {
     global $wpdb;
     $this->plugin_name = basename(dirname(dirname(__FILE__)));
     $this->table = $wpdb->prefix . strtolower($this->pre) . "_" . $this->controller;
     if (is_admin()) {
         $this->check_table($this->model);
     }
     if (!empty($data)) {
         foreach ($data as $dkey => $dval) {
             $this->{$dkey} = stripslashes_deep($dval);
             switch ($dkey) {
                 case 'id':
                     $slidescountquery = "SELECT COUNT(`id`) FROM `" . $wpdb->prefix . strtolower($this->pre) . "_galleriesslides` WHERE `gallery_id` = '" . $dval . "'";
                     $query_hash = md5($slidescountquery);
                     if ($oc_slidescount = wp_cache_get($query_hash, 'slideshowgallery')) {
                         $this->slidescount = $oc_slidescount;
                     } else {
                         $this->slidescount = $wpdb->get_var($slidescountquery);
                         wp_cache_set($query_hash, $this->slidescount, 'slideshowgallery', 0);
                     }
                     break;
             }
         }
     }
     return true;
 }
Пример #23
0
function newsletter_request($name, $default = null)
{
    if (!isset($_REQUEST[$name])) {
        return $default;
    }
    return stripslashes_deep($_REQUEST[$name]);
}
 public static function cleanHttpRequestArray()
 {
     $request = $_REQUEST;
     $request = array_map('strip_tags', $request);
     $request = stripslashes_deep($request);
     return $request;
 }
function LivelyChatSupport_poll()
{
    global $wpdb;
    $messages_table = $wpdb->prefix . "livelychatsupport_messages";
    $convos_table = $wpdb->prefix . "livelychatsupport_convos";
    $id = $_POST["latest_id"];
    if (isset($_POST["convo_token"])) {
        $convo_token = $_POST["convo_token"];
        $messages = $wpdb->get_results("SELECT * FROM {$messages_table} WHERE convo_token = '{$convo_token}' AND {$messages_table}.id > '{$id}'");
    } else {
        if (LIVELYCHATSUPPORT_ADMIN == true) {
            if (current_user_can("manage_options")) {
                $messages = $wpdb->get_results("SELECT * FROM {$messages_table} INNER JOIN {$convos_table} ON {$convos_table}.token = {$messages_table}.convo_token WHERE {$messages_table}.id > '{$id}'");
            } else {
                $agent_id = get_current_user_id();
                $messages = $wpdb->get_results("SELECT * FROM {$messages_table} INNER JOIN {$convos_table} ON {$convos_table}.token = {$messages_table}.convo_token WHERE {$convos_table}.agent_id = '{$agent_id}' AND {$messages_table}.id > '{$id}'");
            }
        }
    }
    if (!empty($messages)) {
        $count = count($messages) - 1;
        $latest = $messages[$count];
        $latest_id = $latest->id;
    } else {
        $latest_id = $id;
    }
    die(json_encode(array("messages" => stripslashes_deep($messages), "agent_id" => $agent_id, "latest_id" => $latest_id)));
}
Пример #26
0
    static function Display()
    {
        global $wpdb, $user_ID;
        wpfb_loadclass('Admin', 'Output');
        $_POST = stripslashes_deep($_POST);
        $_GET = stripslashes_deep($_GET);
        $action = !empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
        $clean_uri = remove_query_arg(array('message', 'action', 'file_id', 'cat_id', 'deltpl', 'hash_sync'));
        // keep search keyword
        WPFB_Admin::PrintFlattrHead();
        ?>
<div class="wrap"><?php 
        switch ($action) {
            default:
                ?>
<div id="wpfilebase-donate">
<p><?php 
                _e('If you like WP-Filebase I would appreciate a small donation to support my work. You can additionally add an idea to make WP-Filebase even better. Just click the button below. Thank you!', WPFB);
                ?>
</p>
<?php 
                WPFB_Admin::PrintPayPalButton();
                WPFB_Admin::PrintFlattrButton();
                ?>
</div>
<?php 
                break;
        }
        ?>
</div> <!-- wrap -->
<?php 
    }
function wpmp_theme_options_write()
{
    $message = __('Settings saved.', 'wpmp');
    foreach (array('wpmp_theme_widget' => false, 'wpmp_theme_home_link_in_menu' => true, 'wpmp_theme_post_count' => false, 'wpmp_theme_post_summary' => false, 'wpmp_theme_post_summary_metadata' => true, 'wpmp_theme_teaser_length' => false, 'wpmp_theme_widget_list_count' => false, 'wpmp_theme_transcoder_remove_media' => true, 'wpmp_theme_transcoder_partition_pages' => true, 'wpmp_theme_transcoder_shrink_images' => true, 'wpmp_theme_transcoder_simplify_styling' => true, 'wpmp_theme_nokia_templates' => true) as $option => $checkbox) {
        if (isset($_POST[$option])) {
            $value = $_POST[$option];
            if (!is_array($value)) {
                $value = trim($value);
            }
            $value = stripslashes_deep($value);
            update_option($option, $value);
            if ($option == 'wpmp_theme_widget') {
                return $message;
            }
        } elseif ($checkbox) {
            update_option($option, 'false');
        }
    }
    if (!is_numeric(get_option('wpmp_theme_post_count'))) {
        update_option('wpmp_theme_post_count', '5');
        $message = __('Please provide a valid number of posts that you would like the theme to display.', 'wpmp');
    }
    if (!is_numeric(get_option('wpmp_theme_teaser_length'))) {
        update_option('wpmp_theme_teaser_length', '50');
        $message = __('Please provide a valid teaser length.', 'wpmp');
    }
    if (!is_numeric(get_option('wpmp_theme_widget_list_count'))) {
        update_option('wpmp_theme_widget_list_count', '5');
        $message = __('Please provide a valid widget list length.', 'wpmp');
    }
    return $message;
}
 /**
  * Get ``$_POST`` or ``$_REQUEST`` vars from AliPay.
  *
  * @package s2Member\AliPay
  * @since 1.5
  *
  * @return array|bool An array of verified AliPay ``$_POST`` or ``$_REQUEST`` vars, else false.
  */
 public static function alipay_postvars()
 {
     if (!empty($_REQUEST["notify_id"]) && !empty($_REQUEST["notify_type"]) && preg_match("/^trade_status_sync\$/i", $_REQUEST["notify_type"]) && !empty($_REQUEST["sign"])) {
         $postvars = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_REQUEST));
         foreach ($postvars as $var => $value) {
             if (preg_match("/^s2member_/", $var)) {
                 unset($postvars[$var]);
             }
         }
         ksort($postvars) . reset($postvars);
         $_q = "";
         // Initialize unencoded query.
         $gateway = "https://www.alipay.com/cooperate/gateway.do";
         foreach ($postvars as $var => $value) {
             if ($var && strlen($value) && !preg_match("/^(sign|sign_type)\$/", $var)) {
                 $_q .= ($_q ? "&" : "") . $var . "=" . $value;
             }
         }
         if ($postvars["sign"] === md5($_q . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_alipay_security_code"]) && preg_match("/true\$/i", trim(c_ws_plugin__s2member_utils_urls::remote($gateway . "?service=notify_verify&partner=" . urlencode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_alipay_partner_id"]) . "&notify_id=" . urlencode($postvars["notify_id"]), "", array("timeout" => 20))))) {
             return $postvars;
         } else {
             // Nope.
             return false;
         }
     } else {
         // Nope.
         return false;
     }
 }
Пример #29
0
 public function submit($postData)
 {
     if (!empty($postData['form_id']) && $postData['form_id'] == $this->id) {
         do_action('scfp_form_submit_before', $this);
         foreach (SCFP()->getSettings()->getFieldsSettings() as $key => $field) {
             if (!empty($field['visibility'])) {
                 switch ($field['field_type']) {
                     case 'checkbox':
                         $this->data[$key] = !empty($postData['scfp-' . $key]) ? 1 : 0;
                         break;
                     default:
                         $this->data[$key] = !empty($postData['scfp-' . $key]) ? esc_attr($postData['scfp-' . $key]) : '';
                         break;
                 }
                 $this->data[$key] = apply_filters('scfp_form_submit_field', apply_filters('scfp_form_submit_field_' . $key, stripslashes_deep($this->data[$key]), $field, $this), $key, $field, $this);
             }
         }
         $this->data = apply_filters('scfp_form_submit_data', $this->data, $this);
         $this->notifications = array();
         if ($this->validation()) {
             if ($this->saveForm()) {
                 if ($this->notification()) {
                     $this->data = array();
                     do_action('scfp_form_submit_success', $this);
                     if (!$this->redirect()) {
                         $this->submitConfirmation();
                     }
                 }
             }
         }
     }
 }
Пример #30
0
function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false)
{
    if (!$meta_type || !$meta_key || !$delete_all && !(int) $object_id) {
        return false;
    }
    if (!($table = _get_meta_table($meta_type))) {
        return false;
    }
    global $wpdb;
    $type_column = esc_sql($meta_type . '_id');
    $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
    // expected_slashed ($meta_key)
    $meta_key = stripslashes($meta_key);
    $meta_value = maybe_serialize(stripslashes_deep($meta_value));
    $query = $wpdb->prepare("SELECT {$id_column} FROM {$table} WHERE meta_key = %s", $meta_key);
    if (!$delete_all) {
        $query .= $wpdb->prepare(" AND {$type_column} = %d", $object_id);
    }
    if ($meta_value) {
        $query .= $wpdb->prepare(" AND meta_value = %s", $meta_value);
    }
    $meta_ids = $wpdb->get_col($query);
    if (!count($meta_ids)) {
        return false;
    }
    $query = "DELETE FROM {$table} WHERE {$id_column} IN( " . implode(',', $meta_ids) . " )";
    $count = $wpdb->query($query);
    if (!$count) {
        return false;
    }
    wp_cache_delete($object_id, $meta_type . '_meta');
    do_action("deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $meta_value);
    return true;
}