function appthemes_updated_version_notice()
{
    list($args) = get_theme_support('app-versions');
    if ($args['current_version'] != get_transient(APP_UPDATE_TRANSIENT)) {
        return;
    }
    update_option($args['option_key'], $args['current_version']);
    echo scb_admin_notice(sprintf(__('Successfully updated to version %s.', APP_TD), $args['current_version']));
    delete_transient(APP_UPDATE_TRANSIENT);
}
Beispiel #2
0
 public function admin_tools()
 {
     if (!empty($_POST['cp_tools']['flush_cache'])) {
         $message = cp_flush_all_cache();
         echo scb_admin_notice($message);
     }
     if (!empty($_POST['cp_tools']['delete_tables'])) {
         cp_delete_db_tables();
     }
     if (!empty($_POST['cp_tools']['delete_options'])) {
         cp_delete_all_options();
     }
 }
Beispiel #3
0
 public function admin_tools()
 {
     if (isset($_GET['pruneads']) && $_GET['pruneads'] == 1) {
         cp_check_expired_cron();
         echo scb_admin_notice(__('Expired ads have been pruned.', APP_TD));
     }
     if (isset($_GET['resetstats']) && $_GET['resetstats'] == 1) {
         appthemes_reset_stats();
         echo scb_admin_notice(__('Statistics have been reseted.', APP_TD));
     }
     // flush out the cache so changes can be visible
     cp_flush_all_cache();
 }
Beispiel #4
0
 private function import()
 {
     check_admin_referer('import-upload');
     $file = wp_import_handle_upload();
     if (isset($file['error'])) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'appthemes') . '</strong><br />';
         echo esc_html($file['error']) . '</p>';
         return false;
     }
     $c = $this->process($file['file']);
     if (false === $c) {
         echo scb_admin_notice(__('The file could not be processed.', 'appthemes'), 'error');
     } else {
         echo scb_admin_notice(sprintf(__('Imported %s items.', 'appthemes'), number_format_i18n($c)));
     }
 }
Beispiel #5
0
 public function progress()
 {
     global $pagenow;
     if ($pagenow !== 'admin.php' || (empty($_GET['page']) || !in_array($_GET['page'], array('app-system-info', 'app-settings')))) {
         if (!isset($_GET['appthemes_build_search_index_progress_notice'])) {
             return;
         }
     }
     $total = count($this->get_items(array('nopaging' => true, 'fields' => 'ids')));
     $indexed = count($this->get_items(array('nopaging' => true, 'fields' => 'ids', 'app_search_index_is_empty' => 0)));
     if ($total - $indexed <= 0) {
         return $this->conclude_bulk_update();
     }
     $percent_complete = round($indexed / $total * 100, 2);
     echo scb_admin_notice(html('strong', sprintf(__('Search Index Update Progress: %g%s complete.', APP_TD), $percent_complete, '&#37;')));
 }
 protected static function maybe_display_jetpack_conflict()
 {
     if (!class_exists('Jetpack') or !current_user_can('manage_options')) {
         return;
     }
     if (self::is_dismissed(self::$jetpack_conflict_notice)) {
         return;
     }
     $check_modules = array('subscriptions', 'comments');
     $conflicting_modules = array_filter($check_modules, array('Jetpack', 'is_module_active'));
     if (!$conflicting_modules) {
         return;
     }
     $message = sprintf(__('Heads up: We noticed there is an active Jetpack module which is not compatible with Postmatic. You\'ll need to fix that. <a href="%s" target="_blank">Learn how to do so here</a>.', 'Postmatic'), Prompt_Enum_Urls::JETPACK_HOWTO);
     $message .= html('a', array('href' => esc_url(add_query_arg(self::$dismiss_query_param, self::$jetpack_conflict_notice)), 'class' => 'button postmatic-dismiss'), __('Dismiss'));
     echo scb_admin_notice($message, 'error');
 }
 public function admin_tools()
 {
     if (!empty($_POST['cp_tools']['flush_cache'])) {
         $message = cp_flush_all_cache();
         echo scb_admin_notice($message);
     }
     if (!empty($_POST['cp_tools']['delete_tables'])) {
         cp_delete_db_tables();
     }
     if (!empty($_POST['cp_tools']['delete_options'])) {
         cp_delete_all_options();
     }
     if (!empty($_POST['cp_tools']['rerun_migration'])) {
         update_option('cp_tools_run_convertToCustomPostType', 'no');
         $message = cp_convert_posts2Ads();
         echo scb_admin_notice($message);
     }
 }
Beispiel #8
0
function appthemes_updated_version_notice()
{
    $args_sets = get_theme_support('app-versions');
    foreach ($args_sets as $args) {
        if ($args['current_version'] != get_transient(APP_UPDATE_TRANSIENT . '_' . $args['option_key'])) {
            continue;
        }
        $option_key = $args['option_key'];
        $new_version = $args['current_version'];
        $old_version = get_option($option_key);
        // add a hook here to avoid duplicated versions checks in upgrade procedures
        do_action("appthemes_upgrade_{$option_key}", $new_version, $old_version);
        update_option($option_key, $new_version);
        $app_name = isset($args['app_name']) ? $args['app_name'] : __('Theme', APP_TD);
        echo scb_admin_notice(sprintf(__('%1$s successfully updated to version %2$s.', APP_TD), $app_name, $new_version));
        delete_transient(APP_UPDATE_TRANSIENT . '_' . $option_key);
    }
}
 function maybe_install()
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     $current_ver = get_option('p2p_storage');
     if ($current_ver == self::$version) {
         return;
     }
     self::install();
     if (isset($_GET['p2p-upgrade'])) {
         $n = self::upgrade();
         update_option('p2p_storage', P2P_Storage::$version);
         echo scb_admin_notice(sprintf(__('Upgraded %d connections.', P2P_TEXTDOMAIN), $n));
     } elseif ($current_ver) {
         echo scb_admin_notice(sprintf(__('The Posts 2 Posts connections need to be upgraded. <a href="%s">Proceed.</a>', P2P_TEXTDOMAIN), admin_url('tools.php?p2p-upgrade')));
     } else {
         update_option('p2p_storage', P2P_Storage::$version);
     }
 }
Beispiel #10
0
 function admin_msg($msg = '', $class = "updated")
 {
     if (empty($msg)) {
         $msg = __('Settings <strong>saved</strong>.', WEBNUS_TEXT_DOMAIN);
     }
     echo scb_admin_notice($msg, $class);
 }
Beispiel #11
0
/**
 * Displays notices on admin membership package page.
 *
 * @return void
 */
function cp_package_membership_list_page_notice()
{
    global $pagenow, $typenow, $cp_options;
    if ($pagenow != 'edit.php' || $typenow != CP_PACKAGE_MEMBERSHIP_PTYPE) {
        return;
    }
    if (!$cp_options->enable_membership_packs) {
        echo scb_admin_notice(sprintf(__('Membership Packs are disabled. Enable the <a href="%1$s">membership packs</a> option.', APP_TD), 'admin.php?page=app-pricing&tab=membership'), 'error');
    }
    echo scb_admin_notice(__('Membership Packs allow you to setup subscription-based pricing packages.', APP_TD) . '<br />' . __('This enables your customers to post unlimited ads for a set period of time or until the membership becomes inactive.', APP_TD) . '<br />' . sprintf(__('These memberships affect pricing regardless of the ad packs or pricing model you have set as long as you have enabled the <a href="%1$s">membership packs</a> option.', APP_TD), 'admin.php?page=app-pricing&tab=membership'));
}
Beispiel #12
0
/**
 * Deletes all the ClassiPress options.
 *
 * @return void
 */
function cp_delete_all_options()
{
    global $wpdb;
    $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name like 'cp_%'");
    echo scb_admin_notice(__('All ClassiPress options have been deleted from the WordPress options table.', APP_TD));
}
Beispiel #13
0
 /**
  * Display queued admin notices.
  */
 public function notices()
 {
     foreach ($this->notices as $notice) {
         echo scb_admin_notice($notice[0], $notice[1]);
     }
 }
 function admin_msg($msg = '', $class = "updated")
 {
     if (empty($msg)) {
         $msg = __('Settings <strong>saved</strong>.', $this->textdomain);
     }
     echo scb_admin_notice($msg, $class);
 }
Beispiel #15
0
 /**
  * Displays notices.
  *
  * @param array|string $notices
  * @param string $class (optional)
  *
  * @return void
  */
 public function display_notices($notices, $class = 'updated')
 {
     // add inline class so the notices stays in metabox
     $class .= ' inline';
     foreach ((array) $notices as $notice) {
         echo scb_admin_notice($notice, $class);
     }
 }
Beispiel #16
0
 /**
  * Add a notice.
  *
  * @since 1.0.0
  * @param string $msg
  * @param string $class
  */
 public function admin_msg($msg = '', $class = 'updated')
 {
     $settings_errors = get_settings_errors();
     if (!empty($settings_errors)) {
         return;
     }
     if (empty($msg)) {
         $msg = __('Settings <strong>saved</strong>.', 'Postmatic');
     }
     echo scb_admin_notice($msg, $class);
 }
Beispiel #17
0
/**
 * Execute changes made in ClassiPress 3.1.0.
 * Geocoding migration script.
 *
 * @since 3.1.0
 */
function cp_update_advanced_search_db()
{
    global $wpdb;
    $output = '';
    $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s ORDER BY ID ASC", APP_POST_TYPE));
    if ($post_ids) {
        echo scb_admin_notice(__('Geocoding ad listing addresses to make the advanced search radius feature work. This process queries Google Maps to get longitude and latitude coordinates based on each ad listings address. Please be patient as this may take a few minutes to complete.', APP_TD));
        foreach ($post_ids as $post_id) {
            if (!cp_get_geocode($post_id)) {
                $result = $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key IN ('cp_street','cp_city','cp_state','cp_zipcode','cp_country')", $post_id), OBJECT_K);
                $address = '';
                foreach ($result as $cur) {
                    if (!empty($cur->meta_key)) {
                        $address .= "{$cur->meta_value}, ";
                    }
                }
                $address = rtrim($address, ', ');
                if ($address) {
                    $output .= sprintf('<p>' . __("Ad #%d - %s ", APP_TD), $post_id, $address);
                    $geocode = json_decode(wp_remote_retrieve_body(wp_remote_get('http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false')));
                    if ('OK' == $geocode->status) {
                        $output .= esc_html("({$geocode->results[0]->geometry->location->lat}, {$geocode->results[0]->geometry->location->lng})");
                        cp_update_geocode($post_id, '', $geocode->results[0]->geometry->location->lat, $geocode->results[0]->geometry->location->lng);
                        $output .= ' &raquo; <font color="green">' . __('Geocoding complete.', APP_TD) . '</font>';
                    } else {
                        $output .= ' &raquo; <font color="red">' . __('Geocoding failed - address not found.', APP_TD) . '</font>';
                    }
                    $output .= '</p>';
                }
            }
        }
        $output .= '<br /><strong>' . __(' Geocoding table updated.', APP_TD) . '</strong><br />';
        $output .= '<small>' . __('Please note: Ads that failed during this process will not show up during a radius search since the address was invalid.', APP_TD) . '</small>';
        update_option('cp_db_version', '1280');
        echo scb_admin_notice($output);
    }
    // end if $post_ids
    update_option('cp_db_version', '1280');
}
Beispiel #18
0
/**
 * Update orders to include urls, checkout type, and hash.
 *
 * @since 3.4
 */
function cp_upgrade_340_orders()
{
    $order_ids = get_option('cp_upgrade_340_orders');
    if (!$order_ids || $order_ids == 'done') {
        return;
    }
    $i = 0;
    $left_orders = $order_ids;
    foreach ($order_ids as $key => $order_id) {
        $i++;
        // all orders updated, quit the loop
        if (empty($left_orders)) {
            break;
        }
        // save current progress, and continue on next page load (memory and execution time have limits)
        if ($i > 50) {
            echo scb_admin_notice(sprintf(__('Orders Update Progress: %d orders left.', APP_TD), count($left_orders)));
            update_option('cp_upgrade_340_orders', $left_orders);
            return;
        }
        unset($left_orders[$key]);
        // updated order check
        if ($checkout_hash = get_post_meta($order_id, 'checkout_hash', true)) {
            continue;
        }
        // retrieve order object
        $order = appthemes_get_order($order_id);
        if (!$order) {
            continue;
        }
        // determine checkout type and url
        if ($item = $order->get_item(CP_ITEM_LISTING)) {
            $listing_orders_args = array('connected_type' => APPTHEMES_ORDER_CONNECTION, 'connected_query' => array('post_status' => 'any'), 'connected_to' => $item['post_id'], 'post_status' => 'any', 'fields' => 'ids', 'nopaging' => true);
            $listing_orders = new WP_Query($listing_orders_args);
            if (empty($listing_orders->posts) || $order_id == min($listing_orders->posts)) {
                $checkout_type = 'create-listing';
                $checkout_url = get_permalink(CP_Add_New::get_id());
            } else {
                $checkout_type = 'renew-listing';
                $checkout_url = add_query_arg('listing_renew', $item['post_id'], get_permalink(CP_Renew_Listing::get_id()));
            }
        } else {
            if ($item = $order->get_item(CP_ITEM_MEMBERSHIP)) {
                $checkout_type = 'membership-purchase';
                $checkout_url = get_permalink(CP_Membership::get_id());
            } else {
                // unknown/invalid order
                continue;
            }
        }
        // generate new checkout hash
        $hash = substr(sha1(time() . mt_rand(0, 1000)), 0, 20);
        // if url set, get the hash
        if ($complete_url = get_post_meta($order_id, 'complete_url', true)) {
            $parsed_url = parse_url($complete_url);
            parse_str($parsed_url['query'], $url_args);
            if (!empty($url_args['hash'])) {
                $hash = $url_args['hash'];
            }
        }
        $complete_url = add_query_arg(array('step' => 'order-summary', 'hash' => $hash), $checkout_url);
        $cancel_url = add_query_arg(array('step' => 'gateway-select', 'hash' => $hash), $checkout_url);
        update_post_meta($order_id, 'complete_url', $complete_url);
        update_post_meta($order_id, 'cancel_url', $cancel_url);
        update_post_meta($order_id, 'checkout_type', $checkout_type);
        update_post_meta($order_id, 'checkout_hash', $hash);
    }
    // mark this upgrage as completed
    update_option('cp_upgrade_340_orders', 'done');
}
function appthemes_disabled_login_redirect_notice()
{
    global $pagenow;
    if (!current_theme_supports('app-login') || !isset($_GET['page'])) {
        return;
    }
    list($options) = get_theme_support('app-login');
    if (!isset($options['redirect']) || $options['redirect']) {
        return;
    }
    $parsed_url = parse_url($options['settings_page']);
    parse_str($parsed_url['query'], $url_args);
    if ($pagenow != $parsed_url['path'] || $_GET['page'] != $url_args['page']) {
        return;
    }
    $notice = __('The default WordPress login page is still accessible.', APP_TD) . '<br />';
    $notice .= sprintf(__('After you ensure that permalinks on your site are working correctly and you are not using any "maintenance mode" plugins, please disable it in your <a href="%s">theme settings</a>.', APP_TD), $options['settings_page']);
    echo scb_admin_notice($notice);
}
Beispiel #20
0
 private function import()
 {
     check_admin_referer('import-upload');
     $file = wp_import_handle_upload();
     if (isset($file['error'])) {
         echo scb_admin_notice(__('Sorry, there has been an error.', APP_TD), 'error');
         echo scb_admin_notice(esc_html($file['error']), 'error');
         return false;
     }
     $c = $this->process($file['file']);
     if ($this->attachments) {
         $this->backfill_attachment_urls();
     }
     if (false === $c) {
         echo scb_admin_notice(__('The file could not be processed.', APP_TD), 'error');
     } else {
         echo scb_admin_notice(sprintf(__('Imported %s items.', APP_TD), number_format_i18n($c)));
     }
 }
Beispiel #21
0
/**
 * Display AppThemes updater missing notice warning.
 */
function _appthemes_no_updater_plugin_warning()
{
    $link = html_link('https://www.appthemes.com/blog/new-plugin-to-keep-your-themes-healthy/', 'AppThemes Updater');
    $msg = sprintf(__('The %s plugin is not detected. We strongly recommend you download and activate it so you can receive the latest updates when available. It also protects your theme from being overwritten by a similarly named theme.', APP_TD), $link);
    echo wp_kses_post(scb_admin_notice($msg, 'notice notice-warning'));
}
Beispiel #22
0
function appthemes_disabled_login_redirect_notice()
{
    if (!current_theme_supports('app-login')) {
        return;
    }
    list($options) = get_theme_support('app-login');
    if (isset($options['redirect']) && !$options['redirect']) {
        $notice = __('The default WordPress login page is still accessible.', APP_TD) . '<br />';
        $notice .= sprintf(__('After you ensure that permalinks on your site are working correctly and you are not using any "maintenance mode" plugins, please disable it in your <a href="%s">theme settings</a>.', APP_TD), $options['settings_page']);
        echo scb_admin_notice($notice);
    }
}
Beispiel #23
0
 /**
  * Displays admin notice about blacklisted email on General Settings page
  *
  * @return void
  */
 public static function blacklisted_email_notice()
 {
     global $pagenow;
     if ($pagenow != 'options-general.php' || !self::$blacklisted_email || self::$blacklisted_email != get_option('admin_email')) {
         return;
     }
     $notice = sprintf(__('Email provider of "%1$s" address do not allow to use their email addresses by other servers. The "%2$s" address will be used to send out emails.', APP_TD), self::$blacklisted_email, self::get_default_email());
     echo scb_admin_notice($notice, 'error');
 }