/**
  * Test the whole array as input
  */
 public function test_urlencode_deep_should_encode_all_values_in_array()
 {
     $data = $this->data_test_values();
     $actual = wp_list_pluck($data, 0);
     $expected = wp_list_pluck($data, 1);
     $this->assertEquals($expected, urlencode_deep($actual));
 }
 public function process_request()
 {
     global $post;
     $postID = $post->ID;
     if (is_product() && isset($_GET['wsd_share'])) {
         switch ($_GET['wsd_share']) {
             case 'facebook':
                 $fb_url = $this->http() . '://www.facebook.com/sharer.php?u=' . rawurlencode(get_permalink($postID)) . '&t=' . rawurlencode($post->post_title);
                 // Redirect to Facebook
                 wp_redirect($fb_url);
                 die;
                 break;
             case 'twitter':
                 $post_title = html_entity_decode(wp_kses($post->post_title, null));
                 $post_link = get_permalink($postID);
                 $text = $post_title;
                 $url = $post_link;
                 $twitter_url = add_query_arg(urlencode_deep(array_filter(compact('text', 'url'))), 'https://twitter.com/intent/tweet');
                 // Redirect to Twitter
                 wp_redirect($twitter_url);
                 die;
                 break;
         }
     }
 }
Example #3
0
function um_browser_url_redirect_to($args)
{
    global $ultimatemember;
    if (isset($_REQUEST['redirect_to']) && !empty($_REQUEST['redirect_to'])) {
        $url = urlencode_deep($_REQUEST['redirect_to']);
        echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_attr($url) . '" />';
    } else {
        if (isset($args['after_login']) && !empty($args['after_login'])) {
            switch ($args['after_login']) {
                case 'redirect_admin':
                    $url = admin_url();
                    break;
                case 'redirect_profile':
                    $url = um_user_profile_url();
                    break;
                case 'redirect_url':
                    $url = $args['redirect_url'];
                    break;
                case 'refresh':
                    $url = $ultimatemember->permalinks->get_current_url();
                    break;
            }
            $url = urlencode_deep($url);
            echo '<input type="hidden" name="redirect_to" id="redirect_to" value="' . esc_attr($url) . '" />';
        }
    }
}
 /**
  * @param string $action
  *
  * @return string
  */
 public function get_signed_url($action = '')
 {
     $args = $this->data;
     // add signature to url args
     $args['s'] = $this->signature;
     return add_query_arg(urlencode_deep($args), home_url(rtrim(EDD_HELPSCOUT_API_PATH, '/') . '/' . $action));
 }
Example #5
0
 /**
  * Returns text with {variables} replaced.
  *
  * @param string $string
  * @param array $additional_replacements
  * @param array $list_ids Array of list ID's (needed if {subscriber_count} is set
  * @param string $output
  *
  * @return string $text       The text with {variables} replaced.
  * replaced.
  */
 public static function replace_variables($string, $additional_replacements = array(), $list_ids = array(), $output = 'string')
 {
     self::$replacement_output = $output;
     // replace general vars
     $replacements = array('{ip}' => self::get_client_ip(), '{current_url}' => mc4wp_get_current_url(), '{current_path}' => !empty($_SERVER['REQUEST_URI']) ? esc_html($_SERVER['REQUEST_URI']) : '', '{date}' => date('m/d/Y'), '{time}' => date('H:i:s'), '{language}' => defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : get_locale(), '{email}' => self::get_known_email(), '{user_email}' => '', '{user_firstname}' => '', '{user_lastname}' => '', '{user_name}' => '', '{user_id}' => '');
     // setup replacements for logged-in users
     if (is_user_logged_in() && ($user = wp_get_current_user()) && $user instanceof WP_User) {
         // logged in user, replace vars by user vars
         $replacements['{user_email}'] = $user->user_email;
         $replacements['{user_firstname}'] = $user->first_name;
         $replacements['{user_lastname}'] = $user->last_name;
         $replacements['{user_name}'] = $user->display_name;
         $replacements['{user_id}'] = $user->ID;
     }
     // merge with additional replacements
     $replacements = array_merge($replacements, $additional_replacements);
     // subscriber count? only fetch these if the tag is actually used
     if (stripos($string, '{subscriber_count}') !== false) {
         $mailchimp = new MC4WP_MailChimp();
         $subscriber_count = $mailchimp->get_subscriber_count($list_ids);
         $replacements['{subscriber_count}'] = $subscriber_count;
     }
     // encode replacements when output type is set to 'url'
     if (self::$replacement_output === 'url') {
         $replacements = urlencode_deep($replacements);
     }
     // perform the replacement
     $string = str_ireplace(array_keys($replacements), array_values($replacements), $string);
     // replace dynamic variables
     if (stristr($string, '{data_') !== false) {
         $string = preg_replace_callback('/\\{data_([\\w-.]+)( default=\\"([^"]*)\\"){0,1}\\}/', array('MC4WP_Tools', 'replace_request_data_variables'), $string);
     }
     return $string;
 }
Example #6
0
 public function url($params = array(), $base = false)
 {
     $blacklist = $this->params_blacklist();
     $params = array_merge($this->params, $params);
     $url = remove_query_arg($blacklist, $base ? $base : awpcp_current_url());
     $url = add_query_arg(urlencode_deep($params), $url);
     return $url;
 }
 /**
  * Gets a Google Analytics Campaign url for this product
  *
  * @param string $path
  * @param string $link_identifier
  * @return string The full URL
  */
 public function get_tracking_url($path = '', $link_identifier = '')
 {
     $tracking_vars = array('utm_campaign' => $this->item_name . ' licensing', 'utm_medium' => 'link', 'utm_source' => $this->item_name, 'utm_content' => $link_identifier);
     // url encode tracking vars
     $tracking_vars = urlencode_deep($tracking_vars);
     $query_string = build_query($tracking_vars);
     return $this->item_url . ltrim($path, '/') . '#' . $query_string;
 }
Example #8
0
 private function get_url($action, $transaction)
 {
     if (get_option('permalink_structure')) {
         return home_url("/awpcpx/payments/{$action}/{$transaction->id}");
     } else {
         $params = array('awpcpx' => true, 'module' => 'payments', 'action' => $action, 'awpcp-txn' => $transaction->id);
         return add_query_arg(urlencode_deep($params), home_url('index.php'));
     }
 }
    function widget($args, $instance)
    {
        extract($args);
        $like_args = $this->normalize_facebook_args($instance['like_args']);
        if (empty($like_args['href']) || !$this->is_valid_facebook_url($like_args['href'])) {
            if (current_user_can('edit_theme_options')) {
                echo $before_widget;
                echo '<p>' . sprintf(__('It looks like your Facebook URL is incorrectly configured. Please check it in your <a href="%s">widget settings</a>.', 'jetpack'), admin_url('widgets.php')) . '</p>';
                echo $after_widget;
            }
            echo '<!-- Invalid Facebook Page URL -->';
            return;
        }
        $title = apply_filters('widget_title', $instance['title']);
        $page_url = is_ssl() ? str_replace('http://', 'https://', $like_args['href']) : $like_args['href'];
        $like_args['show_faces'] = (bool) $like_args['show_faces'] ? 'true' : 'false';
        $like_args['stream'] = (bool) $like_args['stream'] ? 'true' : 'false';
        $like_args['force_wall'] = (bool) $like_args['force_wall'] ? 'true' : 'false';
        $like_args['show_border'] = (bool) $like_args['show_border'] ? 'true' : 'false';
        $like_args['header'] = (bool) $like_args['header'] ? 'true' : 'false';
        $like_bg_colour = apply_filters('jetpack_fb_likebox_bg', 'dark' == $like_args['colorscheme'] ? '#000' : '#fff', $like_args['colorscheme']);
        $locale = $this->get_locale();
        if ($locale && 'en_US' != $locale) {
            $like_args['locale'] = $locale;
        }
        $like_args = urlencode_deep($like_args);
        $like_url = add_query_arg($like_args, set_url_scheme('http://www.facebook.com/plugins/likebox.php'));
        echo $before_widget;
        if (!empty($title)) {
            echo $before_title;
            ?>
<a href="<?php 
            echo esc_url($page_url);
            ?>
"><?php 
            echo esc_html($title);
            ?>
</a><?php 
            echo $after_title;
        }
        ?>
<iframe src="<?php 
        echo esc_url($like_url);
        ?>
" scrolling="no" frameborder="0" style="border: none; overflow: hidden;<?php 
        echo 0 != $like_args['width'] ? ' width: ' . (int) $like_args['width'] . 'px; ' : '';
        ?>
 height: <?php 
        echo (int) $like_args['height'];
        ?>
px; background: <?php 
        echo esc_attr($like_bg_colour);
        ?>
"></iframe><?php 
        echo $after_widget;
        do_action('jetpack_stats_extra', 'widget', 'facebook-likebox');
    }
/**
 * Catch and route requests for single activity item permalinks.
 *
 * @since 1.2.0
 *
 * @return bool False on failure.
 */
function bp_activity_action_permalink_router()
{
    // Not viewing activity.
    if (!bp_is_activity_component() || !bp_is_current_action('p')) {
        return false;
    }
    // No activity to display.
    if (!bp_action_variable(0) || !is_numeric(bp_action_variable(0))) {
        return false;
    }
    // Get the activity details.
    $activity = bp_activity_get_specific(array('activity_ids' => bp_action_variable(0), 'show_hidden' => true));
    // 404 if activity does not exist
    if (empty($activity['activities'][0])) {
        bp_do_404();
        return;
    } else {
        $activity = $activity['activities'][0];
    }
    // Do not redirect at default.
    $redirect = false;
    // Redirect based on the type of activity.
    if (bp_is_active('groups') && $activity->component == buddypress()->groups->id) {
        // Activity is a user update.
        if (!empty($activity->user_id)) {
            $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
            // Activity is something else.
        } else {
            // Set redirect to group activity stream.
            if ($group = groups_get_group($activity->item_id)) {
                $redirect = bp_get_group_permalink($group) . bp_get_activity_slug() . '/' . $activity->id . '/';
            }
        }
        // Set redirect to users' activity stream.
    } elseif (!empty($activity->user_id)) {
        $redirect = bp_core_get_user_domain($activity->user_id, $activity->user_nicename, $activity->user_login) . bp_get_activity_slug() . '/' . $activity->id . '/';
    }
    // If set, add the original query string back onto the redirect URL.
    if (!empty($_SERVER['QUERY_STRING'])) {
        $query_frags = array();
        wp_parse_str($_SERVER['QUERY_STRING'], $query_frags);
        $redirect = add_query_arg(urlencode_deep($query_frags), $redirect);
    }
    /**
     * Filter the intended redirect url before the redirect occurs for the single activity item.
     *
     * @since 1.2.2
     *
     * @param array $value Array with url to redirect to and activity related to the redirect.
     */
    if (!($redirect = apply_filters_ref_array('bp_activity_permalink_redirect_url', array($redirect, &$activity)))) {
        bp_core_redirect(bp_get_root_domain());
    }
    // Redirect to the actual activity permalink page.
    bp_core_redirect($redirect);
}
 /**
  * Class constructor.
  *
  * @uses plugin_basename()
  * @uses hook()
  *
  * @param string $_api_url The URL pointing to the custom API endpoint.
  * @param string $_plugin_file Path to the plugin file.
  * @param array $_api_data Optional data to send with API calls.
  * @return void
  */
 function __construct($_api_url, $_plugin_file, $_api_data = null)
 {
     $this->api_url = trailingslashit($_api_url);
     $this->api_data = urlencode_deep($_api_data);
     $this->name = plugin_basename($_plugin_file);
     $this->slug = basename($_plugin_file, '.php');
     $this->version = $_api_data['version'];
     // Set up hooks.
     $this->hook();
 }
Example #12
0
/**
 * Builds a URL relative to the GlotPress base
 * 
 * @param mixed $path string path or array of path components
 * @param array $query associative array of query arguments (optional)
 */
function gp_url($path, $query = null)
{
    $url = gp_url_join(gp_url_path(gp_get_option('url')), $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    return apply_filters('gp_url', $url, $path, $query);
}
 function get_data($path, $options = array())
 {
     $options = array_map('urlencode', wp_parse_args($options, array('consumer_key' => $this->source['consumer_key'])));
     $url = add_query_arg(urlencode_deep($options), "https://api.500px.com/v1/{$path}");
     $data = $this->http_get_cached($url);
     if (is_wp_error($data)) {
         return $data;
     }
     return json_decode($data, true);
 }
Example #14
0
function gp_url_add_path_and_query($base, $path, $query)
{
    // todo: same domain with current url?
    $url = gp_url_join($base, $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    return apply_filters('gp_url_add_path_and_query', $url, $base, $path, $query);
}
function um_dynamic_login_page_redirect($redirect_to = '')
{
    global $ultimatemember;
    $uri = um_get_core_page('login');
    if (!$redirect_to) {
        $redirect_to = $ultimatemember->permalinks->get_current_url();
    }
    $redirect_key = urlencode_deep($redirect_to);
    $uri = add_query_arg('redirect_to', $redirect_key, $uri);
    return $uri;
}
 /**
  * Class constructor.
  *
  * @uses plugin_basename()
  * @uses hook()
  *
  * @param string $_api_url The URL pointing to the custom API endpoint.
  * @param string $_remote_key permalink slug of remote download
  * @param array $_api_data Optional data to send with API calls.
  * @return void
  */
 function __construct($_api_url, $_remote_key, $_api_data = null)
 {
     $this->api_url = trailingslashit($_api_url);
     $this->api_data = urlencode_deep($_api_data);
     $this->name = $_api_data['item_name'];
     $this->slug = $_remote_key;
     $this->version = $_api_data['version'];
     $this->global_license = get_option('inboundnow_master_license_key', '');
     // Set up hooks.
     $this->hook();
 }
 /**
  * @throws exception
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since 141226
  */
 function init()
 {
     if ($this->©option->get('edd.update', true)) {
         $this->add_filter('pre_set_site_transient_update_plugins', '©edd_updater.pre_set_site_transient_update_plugins_filter');
         $this->add_filter('plugins_api', '©edd_updater.plugins_api_filter', 10, 3);
         $this->add_filter('http_request_args', '©edd_updater.http_request_args', 10, 2);
     }
     $this->api_url = trailingslashit($this->©option->get('edd.store_url', true));
     $this->api_data = urlencode_deep(array('version' => $this->instance->plugin_version, 'license' => $this->getLicense(), 'item_name' => $this->instance->plugin_name, 'author' => 'Panagiotis Vagenas', 'url' => home_url()));
     $this->slug = $this->instance->plugin_dir_basename;
 }
 private function request($params)
 {
     $params = urlencode_deep($params);
     $url = add_query_arg($params, $this->settings->get_runtime_option('easy-digital-downloads-store-url'));
     $response = $this->http->get($url, array('timeout' => 15, 'sslverify' => false));
     $decoded_data = json_decode(wp_remote_retrieve_body($response));
     if (isset($decoded_data->error)) {
         throw new AWPCP_Exception($decoded_data->error);
     }
     return $decoded_data;
 }
Example #19
0
 /**
  * Class constructor.
  *
  * @uses plugin_basename()
  * @uses hook()
  *
  * @param string $_api_url The URL pointing to the custom API endpoint.
  * @param string $_plugin_file Path to the plugin file.
  * @param array $_api_data Optional data to send with API calls.
  * @return void
  */
 function __construct($_api_url, $_plugin_file, $_api_data = null)
 {
     $this->api_url = trailingslashit($_api_url);
     $this->api_data = urlencode_deep($_api_data);
     $this->name = plugin_basename($_plugin_file);
     $this->slug = basename($_plugin_file, '.php');
     $this->version = $_api_data['version'];
     // Set up hooks.
     $this->init();
     add_action('admin_init', array($this, 'show_changelog'));
 }
 /**
  * Generates a ccBill link.
  *
  * @package s2Member\ccBill
  * @since 1.5
  *
  * @param array $vars An array of variables to include in the ccBill link.
  * @return string A full URL to the ccBill Payment Gateway.
  *
  * @todo Optimize this routine with ``empty()`` and ``isset()``.
  * @todo Candidate for the use of ``ifsetor()``?
  */
 public static function ccbill_link_gen($vars = FALSE)
 {
     $gateway = "https://bill.ccbill.com/jpost/signup.cgi";
     $digest_vars = $vars["formPrice"] . $vars["formPeriod"];
     // These are always required.
     $digest_vars .= $vars["formRecurringPrice"] . $vars["formRecurringPeriod"] . $vars["formRebills"];
     $digest_vars .= $vars["currencyCode"];
     // Add the currency code to this too (always req).
     $vars["formDigest"] = md5($digest_vars . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_ccbill_salt_key"]);
     return add_query_arg(urlencode_deep($vars), $gateway);
     // ccBill link.
 }
 /**
  * Class constructor
  *
  * @access      public
  * @since       1.0.0
  * @param       string $_api_url The URL of the remote API
  * @param       string $_plugin_file The main plugin file
  * @param       array $_api_data The data to pass to the API
  * @return      void
  */
 public function __construct($_api_url, $_plugin_file, $_api_data)
 {
     $this->api_url = trailingslashit($_api_url);
     $this->api_data = urlencode_deep($_api_data);
     $this->name = plugin_basename($_plugin_file);
     $this->slug = basename($_plugin_file, '.php');
     $this->version = $_api_data['version'];
     $this->unique = $_api_data['unique'];
     $this->license = isset($_api_data['license']) ? $_api_data['license'] : false;
     $this->hooks();
     // Uncomment these line for testing
     //add_filter( 'plugins_api_result', array(&$this, 'debug_result'), 10, 3 );
     //set_site_transient( 'update_plugins', false );
 }
 /**
  * Class constructor.
  *
  * @since 1.2.0
  *
  * @param string $_api_url The URL pointing to the custom API endpoint.
  * @param string $_plugin_file Path to the plugin file.
  * @param array $_api_data Optional data to send with API calls.
  * @return void
  */
 function __construct($_api_data = null)
 {
     // Setup our add-on data
     $this->api_data = urlencode_deep($_api_data);
     $this->api_url = 'http://badgeos.org/';
     $this->name = plugin_basename($_api_data['plugin_file']);
     $this->slug = basename($_api_data['plugin_file'], '.php');
     $this->version = $_api_data['version'];
     $this->item_name = $_api_data['item_name'];
     // Setup the license
     $this->api_data['license'] = trim(get_option($this->slug . '-license_key'));
     $this->api_data['license_status'] = trim(get_option($this->slug . '-license_status'));
     // Set up hooks.
     $this->hook();
 }
Example #23
0
function uber_grid_get_timthumb_url($file, $options = array())
{
    $options = wp_parse_args($options, array('pixel_ratio' => 1));
    $timthumb_options = array('src' => $file);
    if (isset($options['width']) && (int) $options['width']) {
        $timthumb_options['w'] = $options['width'] * $options['pixel_ratio'];
    }
    if (isset($options['height']) && (int) $options['height']) {
        $timthumb_options['h'] = $options['height'] * $options['pixel_ratio'];
    }
    if (isset($options['width']) && (int) $options['width'] && isset($options['height']) && $options['height']) {
        $timthumb_options['zc'] = 1;
    }
    return add_query_arg(urlencode_deep($timthumb_options), uber_grid_get_timthumb_file_url());
}
Example #24
0
 function account()
 {
     global $ultimatemember;
     if (um_is_core_page('account') && !is_user_logged_in()) {
         $redirect_to = add_query_arg('redirect_to', urlencode_deep(um_get_core_page('account')), um_get_core_page('login'));
         exit(wp_redirect($redirect_to));
     }
     if (um_is_core_page('account')) {
         $ultimatemember->fields->set_mode = 'account';
         $ultimatemember->fields->editing = true;
         if (get_query_var('um_tab')) {
             $this->current_tab = get_query_var('um_tab');
         }
     }
 }
 /**
  * Class constructor.
  *
  * @uses plugin_basename()
  * @uses hook()
  *
  * @param string $_api_url The URL pointing to the custom API endpoint.
  * @param string $_plugin_file Path to the plugin file.
  * @param array $_api_data Optional data to send with API calls.
  * @return void
  */
 function __construct($_api_url, $_plugin_file, $_api_data = null, $license_status_optname = null, $license_settings_url = null, $display_warnings = true)
 {
     $this->api_url = trailingslashit($_api_url);
     $this->api_data = urlencode_deep($_api_data);
     $this->name = plugin_basename($_plugin_file);
     $this->slug = basename($_plugin_file, '.php');
     $this->version = $_api_data['version'];
     $this->display_warnings = $display_warnings;
     if (is_null($license_status_optname)) {
         $license_status_optname = 'eddsl_' . $this->slug;
     }
     $this->license_status_optname = $license_status_optname;
     if (!is_null($license_settings_url)) {
         $this->license_settings_url = $license_settings_url;
     }
 }
 function template_redirect()
 {
     global $post, $ultimatemember;
     do_action('um_access_global_settings');
     do_action('um_access_frontpage_per_role');
     do_action('um_access_homepage_per_role');
     do_action('um_access_category_settings');
     do_action('um_access_post_settings');
     if ($this->redirect_handler && $this->allow_access == false && !um_is_core_page('login')) {
         // login page add protected page automatically
         if (strstr($this->redirect_handler, um_get_core_page('login'))) {
             $curr = $ultimatemember->permalinks->get_current_url();
             $this->redirect_handler = esc_url(add_query_arg('redirect_to', urlencode_deep($curr), $this->redirect_handler));
         }
         wp_redirect($this->redirect_handler);
     }
 }
 public static function maybe_ping()
 {
     if (!apply_filters('c_ws_plugin__s2member_pro_stats_pinger_enable', TRUE)) {
         return;
     }
     // Stats collection off.
     if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_last_stats_log'] >= strtotime('-1 week')) {
         return;
     }
     // No reason to keep pinging.
     $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_last_stats_log'] = (string) time();
     update_option('ws_plugin__s2member_options', $GLOBALS['WS_PLUGIN__']['s2member']['o']);
     if (is_multisite() && is_main_site()) {
         // Update site options on a multisite network.
         update_site_option('ws_plugin__s2member_options', $GLOBALS['WS_PLUGIN__']['s2member']['o']);
     }
     $stats_api_url = 'https://www.websharks-inc.com/products/stats-log.php';
     $stats_api_url_args = array('os' => PHP_OS, 'php_version' => PHP_VERSION, 'mysql_version' => $GLOBALS['wpdb']->db_version(), 'wp_version' => get_bloginfo('version'), 'product_version' => WS_PLUGIN__S2MEMBER_PRO_VERSION, 'product' => 's2member-pro');
     $stats_api_url = add_query_arg(urlencode_deep($stats_api_url_args), $stats_api_url);
     wp_remote_get($stats_api_url, array('blocking' => false, 'sslverify' => false));
 }
Example #28
0
function gp_url_add_path_and_query($base, $path, $query)
{
    // todo: same domain with current url?
    $url = gp_url_join($base, $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    /**
     * Filter a GlotPress URL with path and query.
     *
     * @since 1.0.0
     *
     * @param string $url Generated URL.
     * @param string $base The base path.
     * @param array  $path The GlotPress path or the components as an array.
     * @param string $query The query part of the URL.
     */
    return apply_filters('gp_url_add_path_and_query', $url, $base, $path, $query);
}
Example #29
0
 /**
  * Plugin activation hook.
  *
  * @since 150422 Rewrite.
  *
  * @attaches-to {@link \register_activation_hook()}
  */
 public function activate()
 {
     $this->setup();
     // Ensure setup is complete.
     if (defined('WP_CLI') && WP_CLI) {
         $this->updateOptions(['enable' => '1']);
     }
     if (!$this->options['welcomed'] && !$this->options['enable']) {
         $settings_url = add_query_arg(urlencode_deep(['page' => GLOBAL_NS]), network_admin_url('/admin.php'));
         $this->enqueueMainNotice(sprintf(__('<strong>%1$s</strong> successfully installed! :-) <strong>Please <a href="%2$s">enable caching and review options</a>.</strong>', 'comet-cache'), esc_html(NAME), esc_attr($settings_url)), ['push_to_top' => true]);
         $this->updateOptions(['welcomed' => '1']);
     }
     if (!$this->options['enable']) {
         return;
         // Nothing to do.
     }
     $this->addWpCacheToWpConfig();
     $this->addWpHtaccess();
     $this->addAdvancedCache();
     $this->updateBlogPaths();
     $this->autoClearCache();
 }
Example #30
0
function ajax_save_template_map()
{
    global $wpdb;
    // this is how you get access to the database
    /* Full Template Map */
    $templatemap = get_option('pagelines_template_map');
    /* Order of the sections */
    $section_order = $_GET['orderdata'];
    /* Get array / variable format */
    parse_str($section_order);
    /* Selected Template */
    $selected_template = esc_attr($_GET['template']);
    /* Explode by slash to get heirarchy */
    $template_heirarchy = explode('-', $selected_template);
    if (isset($template_heirarchy[1])) {
        $templatemap[$template_heirarchy[0]]['templates'][$template_heirarchy[1]]['sections'] = urlencode_deep($section);
    } else {
        $templatemap[$selected_template]['sections'] = $section;
    }
    save_template_map($templatemap);
    echo true;
    die;
}