/** * Show the setup wizard */ public function setup_wizard() { if (empty($_GET['page']) || 'wc-setup' !== $_GET['page']) { return; } $this->steps = array('introduction' => array('name' => __('Introduction', 'woocommerce'), 'view' => array($this, 'wc_setup_introduction'), 'handler' => ''), 'pages' => array('name' => __('Page Setup', 'woocommerce'), 'view' => array($this, 'wc_setup_pages'), 'handler' => array($this, 'wc_setup_pages_save')), 'locale' => array('name' => __('Store Locale', 'woocommerce'), 'view' => array($this, 'wc_setup_locale'), 'handler' => array($this, 'wc_setup_locale_save')), 'shipping_taxes' => array('name' => __('Shipping & Tax', 'woocommerce'), 'view' => array($this, 'wc_setup_shipping_taxes'), 'handler' => array($this, 'wc_setup_shipping_taxes_save')), 'payments' => array('name' => __('Payments', 'woocommerce'), 'view' => array($this, 'wc_setup_payments'), 'handler' => array($this, 'wc_setup_payments_save')), 'next_steps' => array('name' => __('Ready!', 'woocommerce'), 'view' => array($this, 'wc_setup_ready'), 'handler' => '')); $this->step = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps)); $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; wp_register_script('select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2'); wp_register_script('wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array('jquery', 'select2'), WC_VERSION); wp_localize_script('wc-enhanced-select', 'wc_enhanced_select_params', array('i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching…', 'enhanced select', 'woocommerce'), 'ajax_url' => admin_url('admin-ajax.php'), 'search_products_nonce' => wp_create_nonce('search-products'), 'search_customers_nonce' => wp_create_nonce('search-customers'))); wp_enqueue_style('woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION); wp_enqueue_style('wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array('dashicons', 'install'), WC_VERSION); wp_register_script('wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array('jquery', 'wc-enhanced-select'), WC_VERSION); wp_localize_script('wc-setup', 'wc_setup_params', array('locale_info' => json_encode(include WC()->plugin_path() . '/i18n/locale-info.php'))); if (!empty($_POST['save_step']) && isset($this->steps[$this->step]['handler'])) { call_user_func($this->steps[$this->step]['handler']); } ob_start(); $this->setup_wizard_header(); $this->setup_wizard_steps(); $this->setup_wizard_content(); $this->setup_wizard_footer(); exit; }
function load_scripts() { wp_enqueue_script('admin-app', JS_APP_URL . 'build/js/admin-app-scripts.js', array('jquery'), PLUGIN_VERSION, false); wp_enqueue_script('react-components', JS_APP_URL . 'build/js/all-components.js', array('admin-app'), PLUGIN_VERSION, true); wp_enqueue_style('admin-app-styles', JS_APP_URL . 'build/css/styles.css', array(), PLUGIN_VERSION, 'all'); wp_localize_script('admin-app', 'admin_app_local', array('api_url' => get_rest_url(), 'template_directory' => JS_APP_URL . 'templates', 'nonce' => wp_create_nonce('wp_rest'))); }
/** * Meta box view * * @return string * * @access public * @since 1.0 */ function build_meta_box($post, $metabox) { echo '<div class="ot-metabox-wrapper">'; /* Use nonce for verification */ echo '<input type="hidden" name="' . $this->meta_box['id'] . '_nonce" value="' . wp_create_nonce($this->meta_box['id']) . '" />'; /* meta box description */ echo isset($this->meta_box['desc']) && !empty($this->meta_box['desc']) ? '<div class="description" style="padding-top:10px;">' . htmlspecialchars_decode($this->meta_box['desc']) . '</div>' : ''; /* loop through meta box fields */ foreach ($this->meta_box['fields'] as $field) { /* get current post meta data */ $field_value = get_post_meta($post->ID, $field['id'], true); /* set standard value */ if (isset($field['std'])) { $field_value = ot_filter_std_value($field_value, $field['std']); } /* build the arguments array */ $_args = array('type' => $field['type'], 'field_id' => $field['id'], 'field_name' => $field['id'], 'field_value' => $field_value, 'field_desc' => isset($field['desc']) ? $field['desc'] : '', 'field_std' => isset($field['std']) ? $field['std'] : '', 'field_rows' => isset($field['rows']) && !empty($field['rows']) ? $field['rows'] : 10, 'field_post_type' => isset($field['post_type']) && !empty($field['post_type']) ? $field['post_type'] : 'post', 'field_taxonomy' => isset($field['taxonomy']) && !empty($field['taxonomy']) ? $field['taxonomy'] : 'category', 'field_min_max_step' => isset($field['min_max_step']) && !empty($field['min_max_step']) ? $field['min_max_step'] : '0,100,1', 'field_class' => isset($field['class']) ? $field['class'] : '', 'field_choices' => isset($field['choices']) ? $field['choices'] : array(), 'field_settings' => isset($field['settings']) && !empty($field['settings']) ? $field['settings'] : array(), 'post_id' => $post->ID, 'meta' => true); /* only allow simple textarea due to DOM issues with wp_editor() */ if ($_args['type'] == 'textarea') { $_args['type'] = 'textarea-simple'; } /* option label */ echo '<div class="format-settings">'; /* don't show title with textblocks */ if ($_args['type'] != 'textblock' && !empty($field['label'])) { echo '<div class="format-setting-label">'; echo '<label for="' . $_args['field_id'] . '" class="label">' . $field['label'] . '</label>'; echo '</div>'; } /* get the option HTML */ echo ot_display_by_type($_args); echo '</div>'; } echo '</div>'; }
public function enqueueJavascripts($pageHookname) { if ($pageHookname === $this->adminConsolePageHookname) { $jsDir = $this->config->getPluginUrl() . '/js'; $version = $this->config->getVersion(); $knockoutSuffix = ''; $suffix = '.min'; if (defined('WP_DEBUG') && WP_DEBUG) { $knockoutSuffix = '.debug'; $suffix = ''; } wp_register_script('knockout', $jsDir . '/deps/knockout-3.1.0' . $knockoutSuffix . '.js', array(), $version, false); wp_enqueue_script('knockout'); wp_register_script('knockoutValidation', $jsDir . '/deps/knockout.validation' . $suffix . '.js', array('knockout'), $version, false); wp_enqueue_script('knockoutValidation'); wp_register_script('autosize', $jsDir . '/deps/jquery.autosize' . $suffix . '.js', array('jquery'), $version, false); wp_enqueue_script('autosize'); wp_register_script('chamameAdmin', $jsDir . '/admin' . $suffix . '.js', array('jquery', 'knockout', 'knockoutValidation', 'autosize'), $version, false); wp_enqueue_script('chamameAdmin'); $ajaxUrl = str_replace(array('https:', 'http:'), '', admin_url('admin-ajax.php')); $token = wp_create_nonce('chamameLiveChat'); $textDomain = $this->config->getTextDomain(); wp_localize_script('chamameAdmin', 'chamameParams', array('ajaxUrl' => $ajaxUrl, 'loggedIn' => $this->session->isLoggedIn(), 'conversationId' => $this->session->getActiveConversationId(), 'token' => $token, 'text' => array('error' => __('Something went wrong. Please try again', $textDomain)))); } }
/** * Form data for group form. * * @return type */ function wpcf_fields_select_insert_form($form_data = array(), $parent_name = '') { $id = 'wpcf-fields-select-' . wpcf_unique_id(serialize($form_data)); $form['name'] = array('#type' => 'textfield', '#title' => __('Name of custom field', 'wpcf'), '#description' => __('Under this name field will be stored in DB (sanitized)', 'wpcf'), '#name' => 'name', '#attributes' => array('class' => 'wpcf-forms-set-legend'), '#validate' => array('required' => array('value' => true))); $form['description'] = array('#type' => 'textarea', '#title' => __('Description', 'wpcf'), '#description' => __('Text that describes function to user', 'wpcf'), '#name' => 'description', '#attributes' => array('rows' => 5, 'cols' => 1)); $form['options-markup-open'] = array('#type' => 'markup', '#markup' => '<strong>' . __('Options', 'wpcf') . '</strong><br /><br />' . '<div class="wpcf-form-options-header-title">' . '<em>' . __('Display text', 'wpcf') . '</em>' . '</div><div class="wpcf-form-options-header-value">' . '<em>' . __('Custom field content', 'wpcf') . '</em></div>' . '<div id="' . $id . '-sortable"' . ' class="wpcf-fields-select-sortable wpcf-compare-unique-value-wrapper">'); $options = !empty($form_data['options']) ? $form_data['options'] : array(); $options = !empty($form_data['data']['options']) ? $form_data['data']['options'] : $options; if (!empty($options)) { foreach ($options as $option_key => $option) { if ($option_key == 'default') { continue; } $option['key'] = $option_key; $option['default'] = isset($options['default']) ? $options['default'] : null; $form = $form + wpcf_fields_select_get_option('', $option); } } else { $form = $form + wpcf_fields_select_get_option(); } if (!empty($options)) { $count = count($options); } else { $count = 1; } $form['options-markup-close'] = array('#type' => 'markup', '#markup' => '</div><div id="' . $id . '-add-option"></div><br /><a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&wpcf_action=add_select_option&_wpnonce=' . wp_create_nonce('add_select_option') . '&wpcf_ajax_update_add=' . $id . '-sortable&parent_name=' . urlencode($parent_name) . '&count=' . $count) . '" onclick="wpcfFieldsFormCountOptions(jQuery(this));"' . ' class="button-secondary wpcf-ajax-link">' . __('Add option', 'wpcf') . '</a>'); $form['options-close'] = array('#type' => 'markup', '#markup' => '<br /><br />'); return $form; }
function sp_ProfilePermissionsForum($thisForum, $userid) { global $thisAlt; # Start the 'forum' section $out = "<div class='spGroupForumSection {$thisAlt}'>"; # Column 1 of the forum row $out .= '<div class="spColumnSection spProfilePermissionIcon">'; $icon = !empty($thisForum->forum_icon) ? sp_paint_custom_icon('spRowIcon', SFCUSTOMURL . $thisForum->forum_icon) : sp_paint_icon('spRowIcon', SPTHEMEICONSURL, 'sp_ForumIcon.png'); $out .= $icon; $out .= '</div>'; # Column 2 of the forum row $out .= '<div class="spColumnSection spProfilePermissionForum">'; $out .= "<div class='spRowName'>" . $thisForum->forum_name . "</div>"; $desc = !empty($thisForum->forum_desc) ? $thisForum->forum_desc : ''; $out .= "<div class='spRowName'>" . $desc . "</div>"; $out .= '</div>'; # Column 3 of the forum row $site = SFHOMEURL . "index.php?sp_ahah=permissions&sfnonce=" . wp_create_nonce('forum-ahah') . "&forum=" . $thisForum->forum_id . '&userid=' . $userid; $img = SFCOMMONIMAGES . '/working.gif'; $out .= '<div class="spColumnSection spProfilePermissionButton">'; $out .= '<a rel="nofollow" href="javascript:void(null)" onclick="spjLoadTool(\'' . $site . '\', \'perm' . $thisForum->forum_id . '\', \'' . $img . '\');">'; $out .= '<input type="submit" class="spSubmit" value="' . sp_text('View') . '" />'; $out .= '</a>'; $out .= '</div>'; $out .= sp_InsertBreak('echo=0'); $out .= '</div>'; # hidden area for the permissions for this forum $out .= '<div id="perm' . $thisForum->forum_id . '" class="spHiddenSection spProfilePermission"></div>'; $thisAlt = $thisAlt == 'spOdd' ? 'spEven' : 'spOdd'; return $out; }
function page_url() { global $post; echo '<input type="hidden" name="sponsormeta_noncename" id="sponsormeta_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />'; $URL = get_post_meta($post->ID, '_URL', true); echo '<input type="text" name="_URL" value="' . $URL . '" class="widefat" />'; }
/** * Plugin Name: WP-API Client JS */ function json_api_client_js() { $scripts = wp_scripts(); $src = plugins_url('build/js/wp-api.js', __FILE__); if (isset($scripts->registered['wp-api'])) { $scripts->registered['wp-api']->src = $src; } else { wp_register_script('wp-api', $src, array('jquery', 'underscore', 'backbone'), '1.0', true); } /** * @var \WP_REST_Server $wp_rest_server */ global $wp_rest_server; if (empty($wp_rest_server)) { /** This filter is documented in wp-includes/rest-api.php */ $wp_rest_server_class = apply_filters('wp_rest_server_class', 'WP_REST_Server'); $wp_rest_server = new $wp_rest_server_class(); /** This filter is documented in wp-includes/rest-api.php */ do_action('rest_api_init', $wp_rest_server); } $schema_request = new WP_REST_Request('GET', '/wp/v2'); $schema_response = $wp_rest_server->dispatch($schema_request); $schema = null; if (!$schema_response->is_error()) { $schema = $schema_response->get_data(); } $settings = array('root' => esc_url_raw(get_rest_url()), 'nonce' => wp_create_nonce('wp_rest'), 'versionString' => 'wp/v2/', 'schema' => $schema); wp_localize_script('wp-api', 'wpApiSettings', $settings); }
function downloads_meta() { //Este código trae todas nuestras opciones de administración. /*global $options; foreach ($options as $value) { if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); } }*/ global $post, $downloads_meta; global $post_ID, $temp_ID; foreach ($downloads_meta as $meta_box) { $meta_box_value = get_post_meta($post->ID, $meta_box['name'] . '_value', true); //Si el campo esta vacío if ($meta_box_value == "") { $meta_box_value = $meta_box['std']; } echo '<div class="post-meta">'; echo '<input type="hidden" name="' . $meta_box['name'] . '_noncename" id="' . $meta_box['name'] . '_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />'; echo '<h2 style="margin:5px;">' . $meta_box['title'] . ' <a href="#help-' . $meta_box['name'] . '" class="gesti-open">¿Qué es esto?</a></h2>'; //cuadro de Ayuda echo '<div id="help-' . $meta_box['name'] . '" class="help-box">'; echo '<p>' . $meta_box['description'] . '</p>'; echo '<p><a href="#help-' . $meta_box['name'] . '" class="gesti-close">Cerrar</a></p>'; echo '</div>'; echo '<p><input name="' . $meta_box['name'] . '_value" class="gesti-input" value="' . $meta_box_value . '" /></p>'; echo '<p>' . $meta_box['description2'] . '</p>'; echo '</div>'; } }
/** * Register the stylesheets for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { global $post, $product; if (is_object($post) && class_exists('WooCommerce')) { $is_product_type_variable = 'false'; if (function_exists('wc_get_product')) { $product = wc_get_product($post); if ($product) { if ($product->is_type('variable') && is_single()) { $is_product_type_variable = 'true'; } } } $attach_id = isset($_SESSION['attach_id']) && !empty($_SESSION['attach_id']) ? $_SESSION['attach_id'] : ''; if (!empty($attach_id)) { $total_word = get_post_meta($attach_id, 'total_word', true); } else { $total_word = ''; } if (!empty($attach_id)) { $total_character = get_post_meta($attach_id, 'total_character', true); } else { $total_character = ''; } wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-public.js', array('jquery'), $this->version, false); if (wp_script_is($this->plugin_name)) { wp_localize_script($this->plugin_name, 'woocommerce_price_per_word_params', apply_filters('woocommerce_price_per_word_params', array('ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_price_per_word_params_nonce' => wp_create_nonce("woocommerce_price_per_word_params_nonce"), 'total_word' => $total_word, 'total_character' => $total_character, 'is_product_type_variable' => $is_product_type_variable, 'woocommerce_currency_symbol_js' => get_woocommerce_currency_symbol(), 'woocommerce_price_num_decimals' => wc_get_price_decimals(), 'aewcppw_word_character' => $this->wppw_get_product_type(), 'aewcppw_allow_users_to_enter_qty' => $this->aewcppw_allow_users_to_enter_qty()))); } wp_enqueue_script($this->plugin_name . '-bn', plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-bn.js', array('jquery'), $this->version, false); } }
/** * @ticket 26948 */ public function test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit() { register_taxonomy('wptests_tax_1', 'post', array('show_in_quick_edit' => false, 'hierarchical' => true)); register_taxonomy('wptests_tax_2', 'post', array('show_in_quick_edit' => true, 'hierarchical' => true)); $t1 = self::factory()->term->create(array('taxonomy' => 'wptests_tax_1')); $t2 = self::factory()->term->create(array('taxonomy' => 'wptests_tax_2')); // Become an administrator. $this->_setRole('administrator'); $post = self::factory()->post->create_and_get(array('post_author' => get_current_user_id())); // Set up a request. $_POST['_inline_edit'] = wp_create_nonce('inlineeditnonce'); $_POST['post_ID'] = $post->ID; $_POST['post_type'] = $post->post_type; $_POST['content'] = $post->post_content; $_POST['excerpt'] = $post->post_excerpt; $_POST['_status'] = $post->post_status; $_POST['post_status'] = $post->post_status; $_POST['screen'] = 'post'; $_POST['post_view'] = 'excerpt'; $_POST['tax_input'] = array('wptests_tax_1' => array($t1), 'wptests_tax_2' => array($t2)); // Make the request. try { $this->_handleAjax('inline-save'); } catch (WPAjaxDieContinueException $e) { unset($e); } // wptests_tax_1 terms should have been refused. $post_terms_1 = wp_get_object_terms($post->ID, 'wptests_tax_1'); $this->assertEmpty($post_terms_1); // wptests_tax_2 terms should have been added successfully. $post_terms_2 = wp_get_object_terms($post->ID, 'wptests_tax_2'); $this->assertEqualSets(array($t2), wp_list_pluck($post_terms_2, 'term_id')); }
function smartSeo_post_markers_custom_box() { //get post meta value global $post, $smartSeo; $prefix = $smartSeo->prefix; // use nonce for verification echo '<input type="hidden" name="smartSeo_post_markers_noncename" id="smartSeo_post_markers_noncename" value="' . wp_create_nonce('nyc-smartSeo') . '" />'; foreach (post_option_fields() as $key => $value) { if ($value['type'] == 'upload') { echo '<div style="width: 100%;float: left; margin: 15px 0px 0px 10px;">'; echo '<div style="float: left;width: 150px;font-weight: bold;">' . $value['name'] . '</div>'; echo '<div style="float: left;width: 450px;font-weight: bold;">' . smartSeo_upload($value) . '</div>'; echo '<div style="float: left"><i>' . $value['desc'] . '</i></div>'; echo '</div>'; } if ($value['type'] == 'text') { $value['std'] = get_post_meta($post->ID, $value['id'], true); echo '<div style="width: 100%;float: left;margin: 15px 0px 0px 10px; ">'; echo '<div style="float: left;width: 150px;font-weight: bold;">' . $value['name'] . '</div>'; echo '<div style="float: left;width: 450px;font-weight: bold;">' . smartSeo_text($value) . '</div>'; echo '<div style="float: left"><i>' . $value['desc'] . '</i></div>'; echo '</div>'; } if ($value['type'] == 'textarea') { $value['std'] = get_post_meta($post->ID, $value['id'], true); echo '<div style="width: 100%;float: left;margin: 15px 0px 0px 10px; ">'; echo '<div style="float: left;width: 150px;font-weight: bold;">' . $value['name'] . '</div>'; echo '<div style="float: left;width: 450px;font-weight: bold;">' . smartSeo_textarea($value) . '</div>'; echo '<div style="float: left"><i>' . $value['desc'] . '</i></div>'; echo '</div>'; } } echo '<div style="clear:both"></div>'; //echo ; }
/** * Payment redirect URL fitler. * * @since 1.0.1 * @param string $url * @param Pronamic_Pay_Payment $payment * @return string */ public static function redirect_url($url, $payment) { global $transaction; $transaction_id = $payment->get_source_id(); $transaction = new MeprTransaction($transaction_id); switch ($payment->get_status()) { case Pronamic_WP_Pay_Statuses::CANCELLED: case Pronamic_WP_Pay_Statuses::EXPIRED: case Pronamic_WP_Pay_Statuses::FAILURE: $product = $transaction->product(); $url = add_query_arg(array('action' => 'payment_form', 'txn' => $transaction->trans_num, '_wpnonce' => wp_create_nonce('mepr_payment_form')), $product->url()); break; case Pronamic_WP_Pay_Statuses::SUCCESS: // @see https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprOptions.php#L768-782 $mepr_options = MeprOptions::fetch(); $product = new MeprProduct($transaction->product_id); $sanitized_title = sanitize_title($product->post_title); $url = $mepr_options->thankyou_page_url('membership=' . $sanitized_title . '&trans_num=' . $transaction->trans_num); break; case Pronamic_WP_Pay_Statuses::OPEN: default: break; } return $url; }
/** * Get merchant redirect URL for IPS. * * This is store URL that will be redirected from middleware. * * @param string $env Environment * * @return string Redirect URL */ public function get_redirect_url($env) { if (!in_array($env, array('live', 'sandbox'))) { $env = 'live'; } return add_query_arg(array('env' => $env, 'wc_ppec_ips_admin_nonce' => wp_create_nonce('wc_ppec_ips')), wc_gateway_ppec()->get_admin_setting_link()); }
/** * Setup metaform. * * Setup metaform for field type "entry". * * @since x.x.x * * @return array metaform configuration for field "entry". */ public function metaform() { /** * add special class to hanfle select2 */ $attributes = $this->getAttr(); if (isset($attributes['class'])) { $attributes['class'] .= ' '; } else { $attributes['class'] = ''; } $attributes['class'] .= 'js-wpcf-entry-select2'; /** * setup post type */ $attributes['data-post-type'] = 'post'; $data = $this->getData(); if (isset($data['post_type'])) { $attributes['data-post-type'] = $data['post_type']; } $attributes['data-nonce'] = wp_create_nonce('wpcf_entry_search'); $metaform = array(); $metaform[] = array('#type' => 'textfield', '#title' => $this->getTitle(), '#description' => $this->getDescription(), '#name' => $this->getName(), '#value' => $this->getValue(), '#validate' => $this->getValidationData(), '#repetitive' => $this->isRepetitive(), '#attributes' => $attributes, 'wpml_action' => $this->getWPMLAction()); return $metaform; }
/** * Styles & Scripts conditional loading * * @param * $hook */ public function load_styles_scripts() { $lang = get_bloginfo('language'); $lang = explode('-', $lang); $lang = $lang[0]; /* * Item reports Styles & Scripts */ if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_front']) && $this->gadwp->config->options['frontend_item_reports']) { wp_enqueue_style('gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION); wp_enqueue_style('gadwp-frontend-item-reports', GADWP_URL . 'front/css/item-reports.css', null, GADWP_CURRENT_VERSION); $country_codes = GADWP_Tools::get_countrycodes(); if ($this->gadwp->config->options['ga_target_geomap'] && isset($country_codes[$this->gadwp->config->options['ga_target_geomap']])) { $region = $this->gadwp->config->options['ga_target_geomap']; } else { $region = false; } wp_enqueue_style("wp-jquery-ui-dialog"); if (!wp_script_is('googlejsapi')) { wp_register_script('googlejsapi', 'https://www.google.com/jsapi?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null); } wp_enqueue_script('gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array('jquery'), GADWP_CURRENT_VERSION); wp_enqueue_script('gadwp-frontend-item-reports', GADWP_URL . 'common/js/reports.js', array('gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog'), GADWP_CURRENT_VERSION); /* @formatter:off */ wp_localize_script('gadwp-frontend-item-reports', 'gadwpItemData', array('ajaxurl' => admin_url('admin-ajax.php'), 'security' => wp_create_nonce('gadwp_frontend_item_reports'), 'dateList' => array('today' => __("Today", 'google-analytics-dashboard-for-wp'), 'yesterday' => __("Yesterday", 'google-analytics-dashboard-for-wp'), '7daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 7), '14daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 14), '30daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 30), '90daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 90), '365daysAgo' => sprintf(_n("%s Year", "%s Years", 1, 'google-analytics-dashboard-for-wp'), __('One', 'google-analytics-dashboard-for-wp')), '1095daysAgo' => sprintf(_n("%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp'), __('Three', 'google-analytics-dashboard-for-wp'))), 'reportList' => array('uniquePageviews' => __("Unique Views", 'google-analytics-dashboard-for-wp'), 'users' => __("Users", 'google-analytics-dashboard-for-wp'), 'organicSearches' => __("Organic", 'google-analytics-dashboard-for-wp'), 'pageviews' => __("Page Views", 'google-analytics-dashboard-for-wp'), 'visitBounceRate' => __("Bounce Rate", 'google-analytics-dashboard-for-wp'), 'locations' => __("Location", 'google-analytics-dashboard-for-wp'), 'referrers' => __("Referrers", 'google-analytics-dashboard-for-wp'), 'searches' => __("Searches", 'google-analytics-dashboard-for-wp'), 'trafficdetails' => __("Traffic", 'google-analytics-dashboard-for-wp'), 'technologydetails' => __("Technology", 'google-analytics-dashboard-for-wp')), 'i18n' => array(__("A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp'), __("Traffic Mediums", 'google-analytics-dashboard-for-wp'), __("Visitor Type", 'google-analytics-dashboard-for-wp'), __("Search Engines", 'google-analytics-dashboard-for-wp'), __("Social Networks", 'google-analytics-dashboard-for-wp'), __("Unique Views", 'google-analytics-dashboard-for-wp'), __("Users", 'google-analytics-dashboard-for-wp'), __("Page Views", 'google-analytics-dashboard-for-wp'), __("Bounce Rate", 'google-analytics-dashboard-for-wp'), __("Organic Search", 'google-analytics-dashboard-for-wp'), __("Pages/Session", 'google-analytics-dashboard-for-wp'), __("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'), __("Not enough data collected", 'google-analytics-dashboard-for-wp'), __("This report is unavailable", 'google-analytics-dashboard-for-wp'), __("report generated by", 'google-analytics-dashboard-for-wp'), __("This plugin needs an authorization:", 'google-analytics-dashboard-for-wp') . ' <strong>' . __("authorize the plugin", 'google-analytics-dashboard-for-wp') . '</strong>!', __("Browser", 'google-analytics-dashboard-for-wp'), __("Operating System", 'google-analytics-dashboard-for-wp'), __("Screen Resolution", 'google-analytics-dashboard-for-wp'), __("Mobile Brand", 'google-analytics-dashboard-for-wp')), 'colorVariations' => GADWP_Tools::variations($this->gadwp->config->options['ga_dash_style']), 'region' => $region, 'language' => get_bloginfo('language'), 'filter' => $_SERVER["REQUEST_URI"], 'viewList' => false, 'scope' => 'front-item')); /* @formatter:on */ } }
public function filter_the_content($content) { $ww_problem = false; if (is_page('webwork')) { $ww_problem = true; } else { $ww_problem = get_query_var('ww_problem'); } if ($ww_problem) { $content = '<div id="webwork-app"></div>'; wp_enqueue_script('webwork-app', plugins_url() . '/webwork/build/index.js'); $route_base = get_option('home'); $route_base = preg_replace('|https?://[^/]+/|', '', $route_base); // @todo Centralize this logic. $main_site_url = get_blog_option(1, 'home'); $rest_api_endpoint = trailingslashit($main_site_url) . 'wp-json/webwork/v1/'; // @todo Abstract. $post_data = null; $ww_problem_text = ''; if (!empty($_GET['post_data_key'])) { $post_data = get_blog_option(1, $_GET['post_data_key']); $ww_problem_text = base64_decode($post_data['pg_object']); } // @todo This is awful. $clients = get_blog_option(1, 'webwork_clients'); $remote_course_url = array_search(get_current_blog_id(), $clients); wp_localize_script('webwork-app', 'WWData', array('problem_id' => $ww_problem, 'problem_text' => $ww_problem_text, 'remote_course_url' => $remote_course_url, 'rest_api_nonce' => wp_create_nonce('wp_rest'), 'rest_api_endpoint' => $rest_api_endpoint, 'route_base' => trailingslashit($route_base) . 'webwork/', 'user_can_ask_question' => is_user_logged_in(), 'user_can_post_response' => is_user_logged_in(), 'user_can_vote' => is_user_logged_in())); wp_enqueue_style('webwork-app', plugins_url() . '/webwork/assets/css/app.css'); wp_register_script('webwork-mathjax-loader', WEBWORK_PLUGIN_URL . '/assets/js/webwork-mathjax-loader.js'); $webwork_mathjax_loader_strings = array('mathjax_src' => esc_url('https://cdn.mathjax.org/mathjax/latest/unpacked/MathJax.js?config=TeX-MML-AM_HTMLorMML-full')); wp_localize_script('webwork-mathjax-loader', 'WeBWorK_MathJax', $webwork_mathjax_loader_strings); wp_enqueue_script('webwork-mathjax-loader'); } return $content; }
function _set_post_values($repeating_section, $form_id, $child_ids) { $checked = $form_id ? 0 : 1; $args = array('action' => 'frm_toggle_repeat', 'nonce' => wp_create_nonce('frm_ajax'), 'form_id' => $form_id, 'parent_form_id' => $repeating_section->form_id, 'checked' => 0, 'field_id' => $repeating_section->id, 'children' => $child_ids, 'checked' => $checked); $_POST = $args; return $args; }
/** * Form data for post edit page. * * @param type $field */ function wpcf_fields_skype_meta_box_form($field) { add_thickbox(); if (isset($field['value'])) { $field['value'] = maybe_unserialize($field['value']); } $form = array(); add_filter('wpcf_fields_shortcode_slug_' . $field['slug'], 'wpcf_fields_skype_shortcode_filter', 10, 2); $rand = wpcf_unique_id(serialize($field)); $form['skypename'] = array('#type' => 'textfield', '#value' => isset($field['value']['skypename']) ? $field['value']['skypename'] : '', '#name' => 'wpcf[' . $field['slug'] . '][skypename]', '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-skypename', '#inline' => true, '#suffix' => ' ' . __('Skype name', 'wpcf'), '#description' => '', '#prefix' => !empty($field['description']) ? wpcf_translate('field ' . $field['id'] . ' description', $field['description']) . '<br /><br />' : '', '#attributes' => array('style' => 'width:60%;'), '#_validate_this' => true, '#before' => '<div class="wpcf-skype">'); $form['style'] = array('#type' => 'hidden', '#value' => isset($field['value']['style']) ? $field['value']['style'] : 'btn2', '#name' => 'wpcf[' . $field['slug'] . '][style]', '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-style'); $preview_skypename = !empty($field['value']['skypename']) ? $field['value']['skypename'] : '--not--'; $preview_style = !empty($field['value']['style']) ? $field['value']['style'] : 'btn2'; $preview = wpcf_fields_skype_get_button_image($preview_skypename, $preview_style); // Set button // TODO WPML move if (isset($field['disable']) || wpcf_wpml_field_is_copied($field)) { $edit_button = ''; } else { $edit_button = '' . '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&' . 'wpcf_action=insert_skype_button&_wpnonce=' . wp_create_nonce('insert_skype_button') . '&update=wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '&skypename=' . $preview_skypename . '&button_style=' . $preview_style . '&keepThis=true&TB_iframe=true&width=500&height=500') . '"' . ' class="thickbox wpcf-fields-skype button-secondary"' . ' title="' . __('Edit Skype button', 'wpcf') . '"' . '>' . __('Edit Skype button', 'wpcf') . '</a>'; } $form['markup'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-form-item">' . '<div id="wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-preview">' . $preview . '</div>' . $edit_button . '</div>'); $form['markup-close'] = array('#type' => 'markup', '#markup' => '</div>'); return $form; }
/** * 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); }
/** * Constructor */ public function __construct() { $remove = array_diff(array_keys($_GET), $this->baseUrlParamNames); if ($remove) { $this->baseUrl = remove_query_arg($remove); } else { $this->baseUrl = $_SERVER['REQUEST_URI']; } parent::__construct(); // add special filter for url fields $this->input->addFilter(create_function('$str', 'return "http://" == $str || "ftp://" == $str ? "" : $str;')); // enqueue required sripts and styles global $wp_styles; if (!is_a($wp_styles, 'WP_Styles')) { $wp_styles = new WP_Styles(); } wp_enqueue_style('pmwi-admin-style', PMWI_ROOT_URL . '/static/css/admin.css', array(), PMWI_VERSION); if (version_compare(get_bloginfo('version'), '3.8-RC1') >= 0) { wp_enqueue_style('pmwi-admin-style-wp-3.8', PMWI_ROOT_URL . '/static/css/admin-wp-3.8.css'); } wp_enqueue_script('pmwi-script', PMWI_ROOT_URL . '/static/js/pmwi.js', array('jquery')); wp_enqueue_script('pmwi-admin-script', PMWI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-resizable', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'pmxi-admin-script'), PMWI_VERSION); global $woocommerce; $woocommerce_witepanel_params = array('remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'wpai_woocommerce_addon_plugin'), 'remove_attribute' => __('Remove this attribute?', 'wpai_woocommerce_addon_plugin'), 'name_label' => __('Name', 'wpai_woocommerce_addon_plugin'), 'remove_label' => __('Remove', 'wpai_woocommerce_addon_plugin'), 'click_to_toggle' => __('Click to toggle', 'wpai_woocommerce_addon_plugin'), 'values_label' => __('Value(s)', 'wpai_woocommerce_addon_plugin'), 'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.', 'wpai_woocommerce_addon_plugin'), 'visible_label' => __('Visible on the product page', 'wpai_woocommerce_addon_plugin'), 'used_for_variations_label' => __('Used for variations', 'wpai_woocommerce_addon_plugin'), 'new_attribute_prompt' => __('Enter a name for the new attribute term:', 'wpai_woocommerce_addon_plugin'), 'calc_totals' => __("Calculate totals based on order items, discount amount, and shipping? Note, you will need to (optionally) calculate tax rows and cart discounts manually.", 'wpai_woocommerce_addon_plugin'), 'calc_line_taxes' => __("Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.", 'wpai_woocommerce_addon_plugin'), 'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", 'wpai_woocommerce_addon_plugin'), 'load_billing' => __("Load the customer's billing information? This will remove any currently entered billing information.", 'wpai_woocommerce_addon_plugin'), 'load_shipping' => __("Load the customer's shipping information? This will remove any currently entered shipping information.", 'wpai_woocommerce_addon_plugin'), 'featured_label' => __('Featured', 'wpai_woocommerce_addon_plugin'), 'tax_or_vat' => $woocommerce->countries->tax_or_vat(), 'prices_include_tax' => get_option('woocommerce_prices_include_tax'), 'round_at_subtotal' => get_option('woocommerce_tax_round_at_subtotal'), 'meta_name' => __('Meta Name', 'wpai_woocommerce_addon_plugin'), 'meta_value' => __('Meta Value', 'wpai_woocommerce_addon_plugin'), 'no_customer_selected' => __('No customer selected', 'wpai_woocommerce_addon_plugin'), 'tax_label' => __('Tax Label:', 'wpai_woocommerce_addon_plugin'), 'compound_label' => __('Compound:', 'wpai_woocommerce_addon_plugin'), 'cart_tax_label' => __('Cart Tax:', 'wpai_woocommerce_addon_plugin'), 'shipping_tax_label' => __('Shipping Tax:', 'wpai_woocommerce_addon_plugin'), 'plugin_url' => $woocommerce->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'add_order_item_nonce' => wp_create_nonce("add-order-item"), 'add_attribute_nonce' => wp_create_nonce("add-attribute"), 'calc_totals_nonce' => wp_create_nonce("calc-totals"), 'get_customer_details_nonce' => wp_create_nonce("get-customer-details"), 'search_products_nonce' => wp_create_nonce("search-products"), 'calendar_image' => $woocommerce->plugin_url() . '/assets/images/calendar.png', 'post_id' => null); wp_localize_script('woocommerce_writepanel', 'woocommerce_writepanel_params', $woocommerce_witepanel_params); wp_enqueue_style('pmwi-woo-style', $woocommerce->plugin_url() . '/assets/css/admin.css'); }
public function testSaveWithAutoSync() { // Set API settings to not auto sync and to enable the meta box $this->settings->set('api_autosync', 'yes'); $this->settings->set('show_metabox', 'yes'); // Create post $post_id = $this->factory->post->create(); // Create post data $_POST['post_ID'] = $post_id; $_POST['apple_news_sections'] = array('https://u48r14.digitalhub.com/sections/1234567890'); $_POST['apple_news_is_preview'] = 0; $_POST['apple_news_pullquote'] = 'test pullquote'; $_POST['apple_news_pullquote_position'] = 'middle'; $_POST['apple_news_nonce'] = wp_create_nonce('apple_news_publish'); $_POST['apple_news_publish_action'] = 'apple_news_publish'; // Create the meta box class and simulate a save $meta_box = new Admin_Apple_Meta_Boxes($this->settings); if ('yes' == $this->settings->get('show_metabox')) { $meta_box->do_publish($post_id, get_post($post_id)); } // Check the meta values $this->assertEquals(array('https://u48r14.digitalhub.com/sections/1234567890'), get_post_meta($post_id, 'apple_news_sections', true)); $this->assertEquals(false, get_post_meta($post_id, 'apple_news_is_preview', true)); $this->assertEquals('test pullquote', get_post_meta($post_id, 'apple_news_pullquote', true)); $this->assertEquals('middle', get_post_meta($post_id, 'apple_news_pullquote_position', true)); }
function metabox($post) { ?> <input type="hidden" name="pt_noncename" id="pt_noncename" value="<?php echo wp_create_nonce(plugin_basename(__FILE__)); ?> " /> <label class="hidden" for="post_template"><?php _e('Post Template', 'genesis'); ?> </label><br /> <select name="_wp_post_template" id="post_template" class="dropdown"> <option value=""><?php _e('Default', 'genesis'); ?> </option> <?php $this->post_templates_dropdown(); ?> </select><br /><br /> <p><?php _e('Some themes have custom templates you can use for single posts that might have additional features or custom layouts. If so, you will see them above.', 'genesis'); ?> </p> <?php }
public function ajax() { if (!wp_verify_nonce($_POST['nonce'], 'fileaway-stats-nonce')) { die('Go directly to jail. Do not pass GO. Do not collect $200 dollars.'); } extract($this->pathoptions); $action = $_POST['act']; if ($_POST['type'] == 's2member') { list($trash, $file) = explode("?s2member_file_download=", $_POST['file']); $pre = fileaway_utility::replacefirst(WP_PLUGIN_DIR . '/s2member-files', $rootpath, ''); $file = $pre . '/' . fileaway_utility::urlesc($file, true); $file = str_replace('&s2member_skip_confirmation', '', $file); $response = $_POST['file']; } elseif ($_POST['type'] == 'encrypted') { list($trash, $file) = explode("fileaway_downloader.php?", $_POST['file']); parse_str($file); $file = fileaway_utility::replacefirst($this->decrypt($fileaway), $rootpath, ''); $response = $_POST['file']; } else { $crypt = new fileaway_encrypted(); $file = fileaway_utility::urlesc(fileaway_utility::replacefirst($_POST['file'], rtrim($this->ops['baseurl'], '/') . '/', ''), true); $response = fileaway_url . '/lib/cls/class.fileaway_downloader.php?fileaway=' . $crypt->encrypt($rootpath . $file) . '&nonce=' . wp_create_nonce('fileaway-download'); } if ($action == 'insert') { $response = $this->insert($file) ? $response : 'error'; } $response = json_encode($response); header("Content-Type: application/json"); echo $response; exit; }
/** * Field Render Function. * * Takes the vars and outputs the HTML for the field in the settings * * @since 1.0.0 * @access public * @return void */ public function render() { echo '</fieldset></td></tr><tr><td colspan="2"><fieldset class="redux-field redux-container-custom_font">'; $nonce = wp_create_nonce("redux_{$this->parent->args['opt_name']}_custom_fonts"); // No errors please $defaults = array('id' => '', 'url' => '', 'width' => '', 'height' => '', 'thumbnail' => ''); $this->value = wp_parse_args($this->value, $defaults); $this->field['custom_fonts'] = apply_filters("redux/{$this->parent->args['opt_name']}/field/typography/custom_fonts", array()); if (!empty($this->field['custom_fonts'])) { foreach ($this->field['custom_fonts'] as $section => $fonts) { if (empty($fonts)) { continue; } echo '<h3>' . $section . '</h3>'; echo '<table class="wp-list-table widefat plugins" cellspacing="0"><tbody>'; foreach ($fonts as $font => $pieces) { echo '<tr class="active">'; echo '<td class="plugin-title" style="min-width: 40%"><strong>' . $font . '</strong></td>'; echo '<td class="column-description desc"><div class="plugin-description">'; if (!empty($pieces)) { foreach ($pieces as $piece) { echo "<span class=\"button button-primary button-small font-pieces\">{$piece}</span> "; } } echo '</div></td><td style="width: 140px;"><div class="action-row visible"><span style="display:none;"><a href="#" class="rename">Rename</a> | </span><a href="#" class="fontDelete delete" data-section="' . $section . '" data-name="' . $font . '" data-type="delete">Delete</a><span class="spinner" style="display: none;"></span></div></td></tr>'; } echo '</tbody></table>'; echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . $nonce . '" id="' . $this->field['id'] . '-custom_fonts">' . __('Add Font', 'redux-framework') . '</span></div><br />'; } } else { echo "<h3>" . __('No Custom Fonts Found', 'redux-framework') . "</h3>"; echo '<div class="upload_button_div"><span class="button media_add_font" data-nonce="' . $nonce . '" id="' . $this->field['id'] . '-custom_fonts">' . __('Add Font', 'redux-framework') . '</span></div>'; } echo '</fieldset></td></tr>'; }
function tshirt_designer_init_scripts() { $tshirt_designer_sticker_size = get_option('tshirt_designer_sticker_size'); if (empty($tshirt_designer_sticker_size)) { $tshirt_designer_sticker_size = intval(2 * 1000 * 1000); } else { $tshirt_designer_sticker_size = intval($tshirt_designer_sticker_size * 1000 * 1000); } wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-widget'); wp_enqueue_script('jquery-ui-mouse'); wp_enqueue_script('jquery-ui-draggable'); wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_style('jquery-ui.css', tshirt_designer_plugin_url . 'css/jquery-ui.css'); wp_enqueue_script('html2canvas.js', plugins_url('/js/html2canvas.js', __FILE__), array('jquery'), '1.0', false); //wp_enqueue_script( 'circletype.js', plugins_url( '/js/circletype.js', __FILE__ ), array('jquery'), '1.0', false); wp_enqueue_script('jscolor.js', plugins_url('/js/jscolor.js', __FILE__), array('jquery'), '1.0', false); wp_enqueue_script('tshirt_designer_js', plugins_url('/js/scripts.js', __FILE__), array('jquery')); wp_localize_script('tshirt_designer_js', 'tshirt_designer_ajax', array('tshirt_designer_ajaxurl' => admin_url('admin-ajax.php'))); wp_enqueue_style('tshirt_designer_style', tshirt_designer_plugin_url . 'css/style.css'); wp_enqueue_style('wp-color-picker'); wp_enqueue_script('tshirt_designer_color_picker', plugins_url('/js/color-picker.js', __FILE__), false, true); //ParaAdmin wp_enqueue_style('ParaAdmin', tshirt_designer_plugin_url . 'ParaAdmin/css/ParaAdmin.css'); //wp_enqueue_style('ParaDashboard', tshirt_designer_plugin_url.'ParaAdmin/css/ParaDashboard.css'); //wp_enqueue_style('ParaIcons', tshirt_designer_plugin_url.'ParaAdmin/css/ParaIcons.css'); wp_enqueue_script('ParaAdmin', plugins_url('ParaAdmin/js/ParaAdmin.js', __FILE__), array('jquery')); wp_enqueue_script('plupload-handlers'); wp_enqueue_script('sticker_upload', tshirt_designer_plugin_url . 'js/upload-sticker.js', array('jquery')); wp_localize_script('sticker_upload', 'sticker_upload', array('ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('sticker_upload'), 'remove' => wp_create_nonce('sticker_remove'), 'number' => 5, 'upload_enabled' => true, 'confirmMsg' => __('Are you sure you want to delete this?'), 'plupload' => array('runtimes' => 'html5,flash,html4', 'browse_button' => 'sticker-uploader', 'container' => 'sticker-upload-container', 'file_data_name' => 'sticker_upload_file', 'max_file_size' => $tshirt_designer_sticker_size . 'b', 'url' => admin_url('admin-ajax.php') . '?action=sticker_upload&nonce=' . wp_create_nonce('sticker_allow'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => 'gif,png')), 'multipart' => true, 'urlstream_upload' => true))); }
/** * Used to setup the meta box content template * * @since 1.0 * @access private * @see _init() */ function _setup() { $this->in_template = TRUE; // also make current post data available global $post; // shortcuts $mb =& $this; $metabox =& $this; $id = $this->id; $meta = $this->_meta(NULL, TRUE); // use include because users may want to use one template for multiple meta boxes if (!is_array($this->template) and file_exists($this->template)) { include $this->template; } else { $fields = $this->_enfactor($this->template); $this->_enbind($fields); $fields = $this->_endep($fields); echo '<div class="vp-metabox">'; $this->_enview($fields); echo '</div>'; } // create a nonce for verification echo '<input type="hidden" name="' . $this->id . '_nonce" value="' . wp_create_nonce($this->id) . '" />'; $this->in_template = FALSE; }
public function enqueue_scripts($data) { wp_register_script('wpml-user-language', ICL_PLUGIN_URL . '/res/js/wpml-user-language.js', array('jquery')); $wp_mail_script_data = array('ajax_url' => admin_url('admin-ajax.php'), 'mail' => $data['mail'], 'auto_refresh_page' => $data['auto_refresh_page'], 'nonce' => wp_create_nonce($this->nonce_name)); wp_localize_script('wpml-user-language', 'wpml_user_language_data', $wp_mail_script_data); wp_enqueue_script('wpml-user-language'); }
protected function tfoot_append() { $prev = isset($_REQUEST['prev']) ? esc_attr($_REQUEST['prev']) : ''; $clear_cart_url = add_query_arg(array('prev' => $prev, '_wp_nonce' => wp_create_nonce('wpsc-clear-cart')), wpsc_get_cart_url('clear')); ?> <tr class="wpsc-cart-item-table-actions"> <td></td> <td colspan="<?php echo count($this->columns) - 1; ?> "> <a class="wpsc-button wpsc-button-small wpsc-clear-cart" href="<?php echo esc_url($clear_cart_url); ?> "><?php esc_html_e('Clear Cart', 'wp-e-commerce'); ?> </a> <input type="hidden" name="action" value="update_quantity" /> <input type="hidden" name="prev" value="<?php echo $prev; ?> "> </td> </tr> <?php }
public function register_settings() { // If no options exist, create them. if (!get_option($this->slug)) { update_option($this->slug, apply_filters('aal_default_options', array('logs_lifespan' => '30'))); } register_setting('aal-options', $this->slug, array($this, 'validate_options')); $section = $this->get_setup_section(); switch ($section) { case 'general': // First, we register a section. This is necessary since all future options must belong to a add_settings_section('general_settings_section', __('Display Options', 'aryo-activity-log'), array('AAL_Settings_Fields', 'general_settings_section_header'), $this->slug); add_settings_field('logs_lifespan', __('Keep logs for', 'aryo-activity-log'), array('AAL_Settings_Fields', 'number_field'), $this->slug, 'general_settings_section', array('id' => 'logs_lifespan', 'page' => $this->slug, 'classes' => array('small-text'), 'type' => 'number', 'sub_desc' => __('days.', 'aryo-activity-log'), 'desc' => __('Maximum number of days to keep activity log. Leave blank to keep activity log forever (not recommended).', 'aryo-activity-log'))); if (apply_filters('aal_allow_option_erase_logs', true)) { add_settings_field('raw_delete_log_activities', __('Delete Log Activities', 'aryo-activity-log'), array('AAL_Settings_Fields', 'raw_html'), $this->slug, 'general_settings_section', array('html' => sprintf(__('<a href="%s" id="%s">Reset Database</a>', 'aryo-activity-log'), add_query_arg(array('action' => 'aal_reset_items', '_nonce' => wp_create_nonce('aal_reset_items')), admin_url('admin-ajax.php')), 'aal-delete-log-activities'), 'desc' => __('Warning: Clicking this will delete all activities from the database.', 'aryo-activity-log'))); } break; case 'notifications': // Email Notifications Settings add_settings_section('email_notifications', __('Notifications', 'aryo-activity-log'), array('AAL_Settings_Fields', 'email_notifications_section_header'), $this->slug); add_settings_field('notification_rules', __('Notification Events', 'aryo-activity-log'), array('AAL_Settings_Fields', 'email_notification_buffer_field'), $this->slug, 'email_notifications', array('id' => 'notification_rules', 'page' => $this->slug, 'desc' => __('Maximum number of days to keep activity log. Leave blank to keep activity log forever (not recommended).', 'aryo-activity-log'))); $notification_handlers = AAL_Main::instance()->notifications->get_available_handlers(); $enabled_notification_handlers = AAL_Main::instance()->settings->get_option('notification_handlers'); // Loop through custom notification handlers foreach ($notification_handlers as $handler_id => $handler_obj) { if (!is_object($handler_obj)) { continue; } add_settings_section("notification_{$handler_id}", $handler_obj->name, array($handler_obj, '_settings_section_callback'), $this->slug); add_settings_field("notification_handler_{$handler_id}_enabled", __('Enable?', 'aryo-activity-log'), array($handler_obj, '_settings_enabled_field_callback'), $this->slug, "notification_{$handler_id}", array('id' => 'notification_transport', 'page' => $this->slug, 'name' => "{$this->slug}[notification_handlers][{$handler_id}]", 'value' => (bool) (1 == $enabled_notification_handlers[$handler_id]))); $handler_obj->settings_fields(); } break; } }