Exemple #1
0
 /**
  * Retrieve full calendar permalink even if Calendar page is set to be
  * homepage.
  *
  * @param int|object $post      Optional. Post ID or object.
  * @param bool       $leavename Optional. Leave name.
  * @param bool       $sample    Optional. Sample permalink.
  *
  * @return string
  */
 public function get_full_permalink($post = false, $leavename = false, $sample = false)
 {
     if (false === $post) {
         return '';
     }
     return _get_page_link($post, $leavename, $sample);
 }
Exemple #2
0
 public function getUrl()
 {
     global $wp_rewrite;
     $obj = $this->getPage();
     if ($wp_rewrite->using_permalinks()) {
         $link = _get_page_link($obj->ID, false, false);
         $link = apply_filters('page_link', $link, $obj->ID, false);
         return rtrim($link, "/");
     } else {
         $link = 'index.php?page_id=' . $obj->ID . '&job_resumes=';
         return rtrim(get_home_url(), "/") . "/" . $link;
     }
 }
Exemple #3
0
function wpbdp_get_page_link($name = 'main', $arg0 = null)
{
    $page_id = wpbdp_get_page_id($name);
    if ($page_id) {
        $link = _get_page_link($page_id);
    } else {
        switch ($name) {
            case 'view':
            case 'viewlisting':
            case 'show-listing':
            case 'showlisting':
                $link = get_permalink(intval($arg0));
                break;
            case 'edit':
            case 'editlisting':
            case 'edit-listing':
            case 'delete':
            case 'deletelisting':
            case 'delete-listing':
            case 'upgrade':
            case 'upgradetostickylisting':
            case 'upgradelisting':
            case 'upgrade-listing':
                $link = add_query_arg(array('action' => $name, 'listing_id' => intval($arg0)), wpbdp_get_page_link('main'));
                break;
            case 'viewlistings':
            case 'view-listings':
                $link = add_query_arg(array('action' => 'viewlistings'), wpbdp_get_page_link('main'));
                break;
            case 'add':
            case 'addlisting':
            case 'add-listing':
            case 'submit':
            case 'submitlisting':
            case 'submit-listing':
                $link = add_query_arg(array('action' => 'submitlisting'), wpbdp_get_page_link('main'));
                break;
            case 'search':
                $link = add_query_arg(array('action' => 'search'), wpbdp_get_page_link('main'));
                break;
            default:
                if (!wpbdp_get_page_id('main')) {
                    return '';
                }
                $link = wpbdp_get_page_link('main');
                break;
        }
    }
    return apply_filters('wpbdp_get_page_link', $link, $name, $arg0);
}
Exemple #4
0
 function page_link($link, $id)
 {
     if ($this->options['redirect_lang'] && $this->page_on_front && ($lang = $this->get_post_language($id))) {
         if (!isset($this->posts[$lang->slug][$this->page_on_front])) {
             $this->posts[$lang->slug][$this->page_on_front] = $this->get_post($this->page_on_front, $lang);
         }
         if ($id == $this->posts[$lang->slug][$this->page_on_front]) {
             return $this->options['hide_default'] && $lang->slug == $this->options['default_lang'] ? trailingslashit($this->home) : get_term_link($lang, 'language');
         }
     }
     if ($this->page_on_front && $this->options['hide_default']) {
         if (!isset($this->posts[$this->options['default_lang']][$this->page_on_front])) {
             $this->posts[$this->options['default_lang']][$this->page_on_front] = $this->get_post($this->page_on_front, $this->options['default_lang']);
         }
         if ($id == $this->posts[$this->options['default_lang']][$this->page_on_front]) {
             return trailingslashit($this->home);
         }
     }
     return _get_page_link($id);
 }
			</fieldset></td>
		</tr><?php 
}
if ($page_on_front) {
    ?>
		<tr>
			<td><fieldset>
				<label><?php 
    printf('<input name="redirect_lang" type="checkbox" value="1" %s/> %s', $this->options['redirect_lang'] ? 'checked="checked"' : '', __('The front page url contains the language code instead of the page name or page id', 'polylang'));
    ?>
				</label>
				<p class="description"><?php 
    // that's nice to display the right home urls but don't forget that the page on front may have no language yet
    $lang = $this->model->get_post_language($page_on_front);
    $lang = $lang ? $lang : $this->model->get_language($this->options['default_lang']);
    printf(__('Example: %s instead of %s', 'polylang'), '<code>' . esc_html($this->links_model->home_url($lang)) . '</code>', '<code>' . esc_html(_get_page_link($page_on_front)) . '</code>');
    ?>
				</p>
			</fieldset></td>
		</tr><?php 
}
?>

	<tr id="pll-detect-browser" <?php 
echo 3 > $this->options['force_lang'] ? '' : 'style="display: none;"';
?>
>
		<th><?php 
_e('Detect browser language', 'polylang');
?>
</th>
/**
 * wpsc_refresh_page_urls( $content )
 *
 * Refresh page urls when permalinks are turned on or altered
 *
 * @global object $wpdb
 * @param string $content
 * @return string
 */
function wpsc_refresh_page_urls($content)
{
    global $wpdb;
    $wpsc_pageurl_option['product_list_url'] = '[productspage]';
    $wpsc_pageurl_option['shopping_cart_url'] = '[shoppingcart]';
    $check_chekout = $wpdb->get_var("SELECT `guid` FROM `{$wpdb->posts}` WHERE `post_content` LIKE '%[checkout]%' AND `post_type` NOT IN('revision') LIMIT 1");
    if ($check_chekout != null) {
        $wpsc_pageurl_option['checkout_url'] = '[checkout]';
    } else {
        $wpsc_pageurl_option['checkout_url'] = '[checkout]';
    }
    $wpsc_pageurl_option['transact_url'] = '[transactionresults]';
    $wpsc_pageurl_option['user_account_url'] = '[userlog]';
    $changes_made = false;
    foreach ($wpsc_pageurl_option as $option_key => $page_string) {
        $post_id = $wpdb->get_var("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` IN('page','post') AND `post_content` LIKE '%{$page_string}%' AND `post_type` NOT IN('revision') LIMIT 1");
        $the_new_link = _get_page_link($post_id);
        if (stristr(get_option($option_key), "https://")) {
            $the_new_link = str_replace('http://', "https://", $the_new_link);
        }
        update_option($option_key, $the_new_link);
    }
    return $content;
}
 function translate_link($link, $lang = null)
 {
     $lang = $lang ? $lang : $this->get_current_language();
     if (!$lang) {
         return $link;
     }
     if (wpbdp_rewrite_on()) {
         $main_id = wpbdp_get_page_id('main');
         $trans_id = icl_object_id($main_id, 'page', false, $lang);
         if (!$trans_id) {
             return $link;
         }
         $link = str_replace(_get_page_link($main_id), _get_page_link($trans_id), $link);
         $link = add_query_arg('lang', $lang, $link);
     } else {
         $link = add_query_arg('lang', $lang, $link);
     }
     return $link;
 }
/**
 * Updates permalink slugs
 *
 * @since 3.8.9
 * @return type
 */
function wpsc_update_permalink_slugs()
{
    global $wpdb;
    $wpsc_pageurl_option = array('product_list_url' => '[productspage]', 'shopping_cart_url' => '[shoppingcart]', 'checkout_url' => '[shoppingcart]', 'transact_url' => '[transactionresults]', 'user_account_url' => '[userlog]');
    $ids = array();
    foreach ($wpsc_pageurl_option as $option_key => $page_string) {
        $id = $wpdb->get_var("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` = 'page' AND `post_content` LIKE '%{$page_string}%' LIMIT 1");
        if (!$id) {
            continue;
        }
        $ids[$page_string] = $id;
        $the_new_link = _get_page_link($id);
        if (stristr(get_option($option_key), "https://")) {
            $the_new_link = str_replace('http://', "https://", $the_new_link);
        }
        if ($option_key == 'shopping_cart_url') {
            update_option('checkout_url', $the_new_link);
        }
        update_option($option_key, $the_new_link);
    }
    update_option('wpsc_shortcode_page_ids', $ids);
}
function get_attachment_link($id = false)
{
    global $post, $wp_rewrite;
    $link = false;
    if (!$id) {
        $id = (int) $post->ID;
    }
    $object = get_post($id);
    if ($wp_rewrite->using_permalinks() && $object->post_parent > 0 && $object->post_parent != $id) {
        $parent = get_post($object->post_parent);
        if ('page' == $parent->post_type) {
            $parentlink = _get_page_link($object->post_parent);
        } else {
            $parentlink = get_permalink($object->post_parent);
        }
        if (is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%')) {
            $name = 'attachment/' . $object->post_name;
        } else {
            $name = $object->post_name;
        }
        if (strpos($parentlink, '?') === false) {
            $link = user_trailingslashit(trailingslashit($parentlink) . $name);
        }
    }
    if (!$link) {
        $link = get_bloginfo('url') . "/?attachment_id={$id}";
    }
    return apply_filters('attachment_link', $link, $id);
}
function wpmlm_install()
{
    global $wpdb, $user_level, $wp_rewrite, $wp_version, $wpmlm_page_titles;
    $table_name = $wpdb->prefix . "wpmlm_product_list";
    $first_install = false;
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") !== $table_name) {
        // Table doesn't exist
        $first_install = true;
        add_option('wpmlm_purchaselogs_fixed', true);
    }
    // run the create or update code here.
    wpmlm_create_or_update_tables();
    wpmlm_create_upload_directories();
    // All code to add new database tables and columns must be above here
    $wpmlm_version = get_option('wpmlm_version', 0);
    $wpmlm_minor_version = get_option('wspc_minor_version', 0);
    if ($wpmlm_version === false) {
        add_option('wpmlm_version', WPMLM_VERSION, '', 'yes');
    } else {
        update_option('wpmlm_version', WPMLM_VERSION);
    }
    if ($wpmlm_minor_version === false) {
        add_option('wpmlm_minor_version', WPMLM_MINOR_VERSION, '', 'yes');
    } else {
        update_option('wpmlm_minor_version', WPMLM_MINOR_VERSION);
    }
    if (version_compare($wpmlm_version, '3.8', '<')) {
        update_option('wpmlm_needs_update', true);
    } else {
        update_option('wpmlm_needs_update', false);
    }
    wpmlm_product_files_htaccess();
    /*
     * This part creates the pages and automatically puts their URLs into the options page.
     * As you can probably see, it is very easily extendable, just pop in your page and the deafult content in the array and you are good to go.
     */
    $post_date = date("Y-m-d H:i:s");
    $post_date_gmt = gmdate("Y-m-d H:i:s");
    /*************| Create MLM Pages Menus |***********************************************************/
    $mlmpages = array('my-networks-page' => array('name' => 'my-networks-page', 'title' => __('My Networks', 'wpmlm'), 'tag' => '[mynetworks]', 'option' => 'my_networks_url'), 'my-direct-group-details-page' => array('name' => 'my-direct-group-details-page', 'title' => __('My Direct Group Details', 'wpmlm'), 'tag' => '[mydirectgroup]', 'option' => 'my_direct_group_url'), 'my-left-group-details-page' => array('name' => 'my-left-group-details-page', 'title' => __('My Left Group Details', 'wpmlm'), 'tag' => '[myleftgroup]', 'option' => 'my_left_group_url'), 'my-right-group-details-page' => array('name' => 'my-right-group-details-page', 'title' => __('My Right Group Details', 'wpmlm'), 'tag' => '[myrightgroup]', 'option' => 'my_right_group_url'), 'my-consultants-page' => array('name' => 'my-consultants-page', 'title' => __('My Consultants', 'wpmlm'), 'tag' => '[myconsultant]', 'option' => 'my_consultant_url'), 'unpaid-details-page' => array('name' => 'unpaid-details-page', 'title' => __('Unpaid Consultants', 'wpmlm'), 'tag' => '[unpaidconsultant]', 'option' => 'my_unpaid_consultant_url'), 'my-geneology' => array('name' => 'my-geneology', 'title' => __('View Geneology', 'wpmlm'), 'tag' => '[mygeneology]', 'option' => 'my_geneology_url'), 'registration-page' => array('name' => 'registration-page', 'title' => __('Registration', 'wpmlm'), 'tag' => '[registration]', 'option' => 'registration_url'));
    //indicator. if we will create any new pages we need to flush.. :)
    $newmlmpages = false;
    //get desktop page id. if there's no products page then create one
    $network_page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $mlmpages['my-networks-page']['tag'] . "%'\tAND `post_type` != 'revision'");
    if (empty($network_page_id)) {
        $network_page_id = wp_insert_post(array('post_title' => $mlmpages['my-networks-page']['title'], 'post_type' => 'page', 'post_name' => $mlmpages['my-networks-page']['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $mlmpages['my-networks-page']['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0));
        $newmlmpages = true;
    }
    update_option($mlmpages['my-networks-page']['option'], _get_page_link($network_page_id));
    //done. desktop page created. no we can unset products page data and create all other pages.
    //unset desktop page
    unset($mlmpages['my-networks-page']);
    /*Registration Page */
    $registration_page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $mlmpages['registration-page']['tag'] . "%'\tAND `post_type` != 'revision'");
    if (empty($registration_page_id)) {
        $registration_page_id = wp_insert_post(array('post_title' => $mlmpages['registration-page']['title'], 'post_type' => 'page', 'post_name' => $mlmpages['registration-page']['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $mlmpages['registration-page']['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0));
        $newmlmpages = true;
    }
    update_option($mlmpages['registration-page']['option'], _get_page_link($registration_page_id));
    //done. Registration page created. no we can unset products page data and create all other pages.
    //unset Registration Page
    unset($mlmpages['registration-page']);
    //create other pages
    foreach ((array) $mlmpages as $page) {
        //check if page exists and get it's ID
        $page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $page['tag'] . "%'\tAND `post_type` != 'revision'");
        //if there's no page - create
        if (empty($page_id)) {
            $page_id = wp_insert_post(array('post_title' => $page['title'], 'post_type' => 'page', 'post_name' => $page['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $page['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0, 'post_parent' => $network_page_id));
            $newmlmpages = true;
        }
        //update option
        update_option($page['option'], get_permalink($page_id));
        //also if this is shopping_cart, then update checkout url option
    }
    //if we have created any new pages, then flush... do we need to do this? probably should be removed
    if ($newmlmpages) {
        wp_cache_delete('all_page_ids', 'mlmpages');
        $wp_rewrite->flush_rules();
    }
    /***********| End of the creation of menus and its items |*********************************************/
    // Product categories, temporarily register them to create first default category if none exist
    // @todo: investigate those require once lines and move them to right place (not from here, but from their original location, which seems to be wrong, since i cant access wpmlm_register_post_types and wpmlm_update_categorymeta here) - Vales <*****@*****.**>
    require_once WPMLM_FILE_PATH . '/wpmlm-core/wpmlm-functions.php';
    /*add options for MLM settings*/
    $wpmlm_general_settings_value = array('status1' => 'Beginer', 'status1criteria' => '30', 'status2' => 'Intermediate', 'status2criteria' => '30', 'status3' => 'Advance', 'status3criteria' => '100');
    add_option('wpmlm_general_settings', $wpmlm_general_settings_value);
    $wpmlm_eligibility_settings_value = array('minpersonalpv' => '100', 'directreferrer' => '2', 'group1referrer' => '1', 'group2referrer' => '1', 'minpveachreferrer' => '30');
    add_option('wpmlm_eligibility_settings', $wpmlm_eligibility_settings_value);
    $wpmlm_payout_settings_value = array('group1pv' => '100', 'group2pv' => '100', 'startingunitrate' => '1000', 'startingunits' => '3', 'additionalunitrate' => '800', 'caplimitamount' => '300000', 'servicecharges' => '100', 'tds' => '12.5');
    add_option('wpmlm_payout_settings', $wpmlm_payout_settings_value);
}
function wpsc_install()
{
    global $wpdb, $user_level, $wp_rewrite, $wp_version, $wpsc_page_titles;
    $table_name = $wpdb->prefix . "wpsc_product_list";
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") !== $table_name) {
        // Table doesn't exist
        add_option('wpsc_purchaselogs_fixed', true);
    }
    // the only consistent and reliable way to detect whether this is a fresh install is by checking
    // whether WPSC_TABLE_CART_CONTENTS exists. This is an unfortunate hack, but we can do away with
    // it in 3.9 as we'll drop support for 3.7.x then
    if ($wpdb->get_var("SHOW TABLES LIKE '" . WPSC_TABLE_CART_CONTENTS . "'") != WPSC_TABLE_CART_CONTENTS) {
        add_option('wpsc_db_version', WPSC_DB_VERSION, '', 'no');
    }
    // run the create or update code here.
    wpsc_create_or_update_tables();
    wpsc_create_upload_directories();
    // All code to add new database tables and columns must be above here
    $wpsc_version = get_option('wpsc_version', 0);
    $wpsc_minor_version = get_option('wpsc_minor_version', 0);
    if ($wpsc_version === false) {
        add_option('wpsc_version', WPSC_VERSION, '', 'no');
    } else {
        update_option('wpsc_version', WPSC_VERSION);
    }
    if ($wpsc_minor_version === false) {
        add_option('wpsc_minor_version', WPSC_MINOR_VERSION, '', 'no');
    } else {
        update_option('wpsc_minor_version', WPSC_MINOR_VERSION);
    }
    if (version_compare($wpsc_version, '3.8', '<')) {
        update_option('wpsc_needs_update', true);
    } else {
        update_option('wpsc_needs_update', false);
    }
    if ('' == get_option('show_subcatsprods_in_cat')) {
        update_option('show_subcatsprods_in_cat', 0);
    }
    if ('' == get_option('wpsc_share_this')) {
        update_option('wpsc_share_this', 0);
    }
    if ('' == get_option('wpsc_crop_thumbnails')) {
        update_option('wpsc_crop_thumbnails', 0);
    }
    if ('' == get_option('wpsc_products_per_page')) {
        update_option('wpsc_products_per_page', 0);
    }
    if ('' == get_option('wpsc_force_ssl')) {
        update_option('wpsc_force_ssl', 0);
    }
    if ('' == get_option('use_pagination')) {
        update_option('use_pagination', 0);
    }
    if ('' == get_option('hide_name_link')) {
        update_option('hide_name_link', 0);
    }
    if ('' == get_option('wpsc_enable_comments')) {
        update_option('wpsc_enable_comments', 0);
    }
    if ('' == get_option('multi_add')) {
        update_option('multi_add', 1);
    }
    if ('' == get_option('hide_addtocart_button')) {
        update_option('hide_addtocart_button', 0);
    }
    if ('' == get_option('wpsc_addtocart_or_buynow')) {
        update_option('wpsc_addtocart_or_buynow', 0);
    }
    add_option('show_thumbnails', 1, '', 'no');
    add_option('show_thumbnails_thickbox', 1, '', 'no');
    require_once WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php';
    require_once WPSC_FILE_PATH . '/wpsc-includes/wpsc-theme-engine-bootstrap.php';
    if (!_wpsc_maybe_activate_theme_engine_v2()) {
        add_option('product_list_url', '', '', 'no');
        add_option('shopping_cart_url', '', '', 'no');
        add_option('checkout_url', '', '', 'no');
        add_option('transact_url', '', '', 'no');
        /*
         * This part creates the pages and automatically puts their URLs into the options page.
         * As you can probably see, it is very easily extendable, just pop in your page and the deafult content in the array and you are good to go.
         */
        $post_date = date("Y-m-d H:i:s");
        $post_date_gmt = gmdate("Y-m-d H:i:s");
        $pages = array('products-page' => array('name' => 'products-page', 'title' => __('Products Page', 'wpsc'), 'tag' => '[productspage]', 'option' => 'product_list_url'), 'checkout' => array('name' => 'checkout', 'title' => __('Checkout', 'wpsc'), 'tag' => '[shoppingcart]', 'option' => 'shopping_cart_url'), 'transaction-results' => array('name' => 'transaction-results', 'title' => __('Transaction Results', 'wpsc'), 'tag' => '[transactionresults]', 'option' => 'transact_url'), 'your-account' => array('name' => 'your-account', 'title' => __('Your Account', 'wpsc'), 'tag' => '[userlog]', 'option' => 'user_account_url'));
        //indicator. if we will create any new pages we need to flush.. :)
        $newpages = false;
        //get products page id. if there's no products page then create one
        $products_page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $pages['products-page']['tag'] . "%'\tAND `post_type` != 'revision'");
        if (empty($products_page_id)) {
            $products_page_id = wp_insert_post(array('post_title' => $pages['products-page']['title'], 'post_type' => 'page', 'post_name' => $pages['products-page']['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $pages['products-page']['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0));
            $newpages = true;
        }
        update_option($pages['products-page']['option'], _get_page_link($products_page_id));
        //done. products page created. no we can unset products page data and create all other pages.
        //unset products page
        unset($pages['products-page']);
        //create other pages
        foreach ((array) $pages as $page) {
            //check if page exists and get it's ID
            $page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $page['tag'] . "%'\tAND `post_type` != 'revision'");
            //if there's no page - create
            if (empty($page_id)) {
                $page_id = wp_insert_post(array('post_title' => $page['title'], 'post_type' => 'page', 'post_name' => $page['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $page['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0, 'post_parent' => $products_page_id));
                $newpages = true;
            }
            //update option
            update_option($page['option'], get_permalink($page_id));
            //also if this is shopping_cart, then update checkout url option
            if ($page['option'] == 'shopping_cart_url') {
                update_option('checkout_url', get_permalink($page_id));
            }
        }
        //if we have created any new pages, then flush... do we need to do this? probably should be removed
        if ($newpages) {
            wp_cache_delete('all_page_ids', 'pages');
            wpsc_update_permalink_slugs();
        }
    }
    add_option('payment_gateway', '', '', 'no');
    $default_payment_gateways_names = array('chronopay' => '', 'wpsc_merchant_paypal_express' => '', 'wpsc_merchant_paypal_pro' => '', 'wpsc_merchant_paypal_standard' => '');
    $existing_payment_gateways_names = get_option('payment_gateway_names');
    $new_payment_gatewats_name = array_merge($default_payment_gateways_names, (array) $existing_payment_gateways_names);
    update_option('payment_gateway_names', $new_payment_gatewats_name);
    if (function_exists('register_sidebar')) {
        add_option('cart_location', '4', '', 'no');
    } else {
        add_option('cart_location', '1', '', 'no');
    }
    add_option('currency_type', '156', '', 'no');
    add_option('currency_sign_location', '3', '', 'no');
    add_option('gst_rate', '1', '', 'no');
    add_option('max_downloads', '1', '', 'no');
    add_option('display_pnp', '1', '', 'no');
    add_option('display_specials', '1', '', 'no');
    add_option('do_not_use_shipping', '1', '', 'no');
    add_option('postage_and_packaging', '0', '', 'no');
    add_option('shipwire', '0', '', 'no');
    add_option('shipwire_test_server', '0', '', 'no');
    add_option('purch_log_email', '', '', 'no');
    add_option('return_email', '', '', 'no');
    add_option('terms_and_conditions', '', '', 'no');
    add_option('default_brand', 'none', '', 'no');
    add_option('wpsc_default_category', 'all', '', 'no');
    add_option('product_view', 'default', "", 'no');
    add_option('add_plustax', 'default', "", '1');
    if (!(get_option('show_categorybrands') > 0 && get_option('show_categorybrands') < 3)) {
        update_option('show_categorybrands', 2);
    }
    // PayPal options
    add_option('paypal_business', '', '', 'no');
    add_option('paypal_url', '', '', 'no');
    add_option('paypal_ipn', '1', '', 'no');
    add_option('paypal_multiple_business', '', '', 'no');
    add_option('paypal_multiple_url', "https://www.paypal.com/cgi-bin/webscr");
    add_option('product_ratings', '0', '', 'no');
    add_option('wpsc_email_receipt', __('Thank you for purchasing with %shop_name%, any items to be shipped will be processed as soon as possible, any items that can be downloaded can be downloaded using the links on this page. All prices include tax and postage and packaging where applicable.
You ordered these items:
%product_list%%total_shipping%%total_price%', 'wpsc'), '', 'no');
    add_option('wpsc_email_admin', __('%product_list%%total_shipping%%total_price%', 'wpsc'), '', 'no');
    add_option('wpsc_selected_theme', 'default', '', 'no');
    add_option('product_image_height', 148);
    add_option('product_image_width', 148);
    add_option('category_image_height', 148);
    add_option('category_image_width', 148);
    add_option('single_view_image_height', 148);
    add_option('single_view_image_width', 148);
    add_option('wpsc_gallery_image_height', 31);
    add_option('wpsc_gallery_image_width', 31);
    add_option('wpsc_thousands_separator', ',');
    add_option('wpsc_decimal_separator', '.');
    add_option('custom_gateway_options', array('wpsc_merchant_testmode'), '', 'no');
    add_option('wpsc_category_url_cache', array(), '', 'no');
    // add in some default tax settings
    add_option('wpec_taxes_inprice', 'exclusive');
    add_option('wpec_taxes_product', 'replace');
    add_option('wpec_taxes_logic', 'billing');
    wpsc_product_files_htaccess();
    // Product categories, temporarily register them to create first default category if none exist
    // @todo: investigate those require once lines and move them to right place (not from here, but from their original location, which seems to be wrong, since i cant access wpsc_register_post_types and wpsc_update_categorymeta here) - Vales <*****@*****.**>
    wpsc_core_load_page_titles();
    wpsc_register_post_types();
    $category_list = get_terms('wpsc_product_category', 'hide_empty=0&parent=0');
    if (count($category_list) == 0) {
        require_once WPSC_FILE_PATH . '/wpsc-includes/meta.functions.php';
        $new_category = wp_insert_term(__('Product Category', 'wpsc'), 'wpsc_product_category', "parent=0");
        $category_id = $new_category['term_id'];
        $term = get_term_by('id', $new_category['term_id'], 'wpsc_product_category');
        $url_name = $term->slug;
        wpsc_update_categorymeta($category_id, 'nice-name', $url_name);
        wpsc_update_categorymeta($category_id, 'description', __("This is a description", 'wpsc'));
        wpsc_update_categorymeta($category_id, 'image', '');
        wpsc_update_categorymeta($category_id, 'fee', '0');
        wpsc_update_categorymeta($category_id, 'active', '1');
        wpsc_update_categorymeta($category_id, 'order', '0');
    }
    flush_rewrite_rules(false);
    wpsc_theme_engine_v2_activate();
}
 function cc_get_slug($page = '', $with_end_slash = true, $full_url = true)
 {
     if ('' != $page) {
         $wpc_pages = $this->cc_get_settings('pages');
         if (isset($wpc_pages[$page]) && 0 < $wpc_pages[$page]) {
             $post = get_post($wpc_pages[$page]);
             if (isset($post->post_name) && '' != $post->post_name) {
                 $url = '';
                 //parent exist
                 if (0 < $post->post_parent) {
                     $parent = get_post($post->post_parent);
                     $url = $parent->post_name . '/';
                 }
                 $url .= $post->post_name;
                 if ($full_url) {
                     if (is_multisite()) {
                         $url = get_home_url(get_current_blog_id()) . '/' . $url;
                     } else {
                         if ($this->permalinks) {
                             $url = get_home_url() . '/' . $url;
                         } else {
                             $url = _get_page_link($post);
                         }
                     }
                 }
                 $url = rtrim($url, '/');
                 if ($with_end_slash && $this->permalinks) {
                     $url = $url . '/';
                 }
                 return $url;
             }
         }
     }
     return '';
 }
/**
 * Retrieve the permalink for the post comments feed.
 *
 * @since 2.2.0
 *
 * @param int $post_id Optional. Post ID.
 * @param string $feed Optional. Feed type.
 * @return string
 */
function get_post_comments_feed_link($post_id = '', $feed = '') {
	global $id;

	if ( empty($post_id) )
		$post_id = (int) $id;

	if ( empty($feed) )
		$feed = get_default_feed();

	if ( '' != get_option('permalink_structure') ) {
		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
			$url = _get_page_link( $post_id );
		else
			$url = get_permalink($post_id);

		$url = trailingslashit($url) . 'feed';
		if ( $feed != get_default_feed() )
			$url .= "/$feed";
		$url = user_trailingslashit($url, 'single_feed');
	} else {
		$type = get_post_field('post_type', $post_id);
		if ( 'page' == $type )
			$url = home_url("?feed=$feed&amp;page_id=$post_id");
		else
			$url = home_url("?feed=$feed&amp;p=$post_id");
	}

	return apply_filters('post_comments_feed_link', $url);
}
/**
 * fixes filter for front-page array
 * @since 2.8.5
 *
 */
function xili_nav_page_link_insertion_fixe($link, $post_id, $sample)
{
    global $xili_language;
    //$front_page_id = $xili_language->get_option_wo_xili ('page_on_front');
    $list_pages_check_option = $xili_language->xili_settings['list_pages_check_option'];
    if ($xili_language->show_page_on_front && $list_pages_check_option == 'fixe' && in_array($post_id, $xili_language->show_page_on_front_array)) {
        $post_id = (int) $post_id;
        // issue with 3.4.2
        $post = get_post($post_id);
        $link = _get_page_link($post, false, $sample);
    }
    return $link;
}
Exemple #15
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        echo '<style>
            .custom-widget-wrap {background: #3C92CF; border-radius: 4px; padding: 24px 12px;}
            .custom-widget-title {font-size: 14px; line-height: 20px; font-weight: 800; color: #fff; font-family: "Open Sans" !important;}
            .custom-widget-text {color: #fff; text-align:justify; padding-bottom: 9px; line-height: 20px; font-family: "Open Sans" !important;}
            .custom-widget-wrap img {display: inline-block; width: 80%; margin-bottom: -64px; margin-top: -32px;}
            .custom-widget-separator-wrap {padding: 18px 0;}
            .custom-widget-separator {border-bottom: 1px solid #fff;}
            .custom-widget-form input {margin: 9px 0; border-radius: 4px; font-size: 14px; line-height: 22px; font-family: "Open Sans" !important;}
            .custom-widget-form button[type="submit"] {padding: 12px 24px; background: #1874BA; color: #fff; font-weight: 800; border: none; transition: background 0.3s; line-height: 14px;}
            .custom-widget-form button[type="submit"]:hover {background: #1E82CE;}
          </style>';
        echo '<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>';
        echo '<div class="custom-widget-wrap">';
        echo $before_widget;
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $textContent = empty($instance['textContent']) ? ' ' : apply_filters('widget_text', $instance['textContent']);
        $textSuccess = empty($instance['textSuccess']) ? ' ' : apply_filters('widget_success', $instance['textSuccess']);
        $recipient = empty($instance['recipient']) ? ' ' : apply_filters('widget_recipient', $instance['recipient']);
        $subject = empty($instance['subject']) ? ' ' : apply_filters('widget_subject', $instance['subject']);
        // $textContent = $instance['textContent'];
        if (!empty($title)) {
            echo '<div class="custom-widget-title">' . $title . '</div>';
        }
        if ($textContent) {
            echo '

         <div class="custom-widget-separator-wrap">
            <div class="custom-widget-separator"></div>
         </div>

         <div class="custom-widget-text">' . $textContent . '</div>';
        }
        // WIDGET CODE GOES HERE
        $using_permalink = get_option('permalink_structure');
        $permalink = get_permalink();
        // Fix For Static Page
        if (get_option('show_on_front') == 'page' && is_page()) {
            if (intval(get_option('page_on_front')) > 0) {
                $permalink = _get_page_link();
            }
        }
        //echo '<p class="contact">to: ' . $recipient . '<br />subj: ' . $subject . '<br />URL: <a href="'.plugins_url('sendMail.php', __FILE__).'">URL_link</a></p>';
        echo '<form method="POST" class="custom-widget-form" action="javascript:alert("success!");">
                <input style="width:100%;" name="URL_link" type="URL" placeholder="Please send us link to your site..." required/>
                <button class="submit_btn" type="submit">SEND</button>
                <input type="hidden"  name="recipient" value="' . $recipient . '" />
                <input type="hidden" name="subject" value="' . $subject . '"/>
              </form>';
        // Ajax script for POST method
        echo '<script type="text/javascript">
              $(document).ready(function(){

                $(".custom-widget-form").submit(function(){

                    var str = $(this).serialize();
                    

                    $.ajax({
                    	type 	 : "POST",
                    	url 	 : "' . plugins_url('sendMail.php', __FILE__) . '",
                    	data 	 : str,
                      success: function(msg){
                        if(msg) { 
                          result = "<div class=\\"custom-widget-text\\">' . $textSuccess . '</div><br />";
                          $("form.custom-widget-form").hide();
                        } else {
                          result = "<div class=/"It must be some alien conspiracy... Keep ninja tuned!/"></div><br />"
                        }
                        $("form.custom-widget-form").hide();
                        $("form.custom-widget-form").html(result).slideDown("slow");
                        $("form.custom-widget-form").html(result);
                      }

                    });
                  return false;
                  });
                });
          </script>';
        echo $after_widget;
        echo '<div class="text-right">
                <img src="http://www.shindiristudio.com/testing/wp-content/uploads/ninja-01.png" />';
        echo '</div>';
        echo '</div><div id="test"></div> ';
    }
function print_link($print_post_text = '', $print_page_text = '', $echo = true)
{
    global $id;
    if (function_exists('polyglot_get_lang')) {
        global $polyglot_settings;
        $polyglot_append = $polyglot_settings['uri_helpers']['lang_view'] . '/' . polyglot_get_lang() . '/';
    }
    $output = '';
    $using_permalink = get_option('permalink_structure');
    $print_options = get_option('print_options');
    $print_style = intval($print_options['print_style']);
    if (empty($print_post_text)) {
        $print_text = stripslashes($print_options['post_text']);
    } else {
        $print_text = $print_post_text;
    }
    $print_icon = plugins_url('wp-print/images/' . $print_options['print_icon']);
    $print_link = get_permalink();
    $print_html = stripslashes($print_options['print_html']);
    // Fix For Static Page
    if (get_option('show_on_front') == 'page' && is_page()) {
        if (intval(get_option('page_on_front')) > 0) {
            $print_link = _get_page_link();
        }
    }
    if (!empty($using_permalink)) {
        if (substr($print_link, -1, 1) != '/') {
            $print_link = $print_link . '/';
        }
        if (is_page()) {
            if (empty($print_page_text)) {
                $print_text = stripslashes($print_options['page_text']);
            } else {
                $print_text = $print_page_text;
            }
            $print_link = $print_link . 'printpage/' . $polyglot_append;
        } else {
            $print_link = $print_link . 'print/' . $polyglot_append;
        }
    } else {
        if (is_page()) {
            if (empty($print_page_text)) {
                $print_text = stripslashes($print_options['page_text']);
            } else {
                $print_text = $print_page_text;
            }
        }
        $print_link = $print_link . '&amp;print=1';
    }
    unset($print_options);
    switch ($print_style) {
        // Icon + Text Link
        case 1:
            $output = '<a href="' . $print_link . '" title="' . $print_text . '" rel="nofollow"><img class="WP-PrintIcon" src="' . $print_icon . '" alt="' . $print_text . '" title="' . $print_text . '" style="border: 0px;" /></a>&nbsp;<a href="' . $print_link . '" title="' . $print_text . '" rel="nofollow">' . $print_text . '</a>';
            break;
            // Icon Only
        // Icon Only
        case 2:
            $output = '<a href="' . $print_link . '" title="' . $print_text . '" rel="nofollow"><img class="WP-PrintIcon" src="' . $print_icon . '" alt="' . $print_text . '" title="' . $print_text . '" style="border: 0px;" /></a>';
            break;
            // Text Link Only
        // Text Link Only
        case 3:
            $output = '<a href="' . $print_link . '" title="' . $print_text . '" rel="nofollow">' . $print_text . '</a>';
            break;
        case 4:
            $print_html = str_replace("%PRINT_URL%", $print_link, $print_html);
            $print_html = str_replace("%PRINT_TEXT%", $print_text, $print_html);
            $print_html = str_replace("%PRINT_ICON_URL%", $print_icon, $print_html);
            $output = $print_html;
            break;
    }
    if ($echo) {
        echo $output . "\n";
    } else {
        return $output;
    }
}
function get_attachment_link($id = false) {
	global $post, $wp_rewrite;

	$link = false;

	if (! $id) {
		$id = (int) $post->ID;
	}

	$object = get_post($id);
	if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) && ($object->post_parent != $id) ) {
		$parent = get_post($object->post_parent);
		if ( 'page' == $parent->post_type )
			$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
		else
			$parentlink = get_permalink( $object->post_parent );
		if ( ctype_digit($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
			$name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
		else
			$name = $object->post_name;
		if (strpos($parentlink, '?') === false)
			$link = trailingslashit($parentlink) . $name . '/';
	}

	if (! $link ) {
		$link = get_bloginfo('url') . "/?attachment_id=$id";
	}

	return apply_filters('attachment_link', $link, $id);
}
Exemple #18
0
function email_popup_form_header($echo = true, $temp_id)
{
    global $post;
    $id = intval($post->ID);
    if (intval($temp_id) > 0) {
        $id = $temp_id;
    }
    $using_permalink = get_option('permalink_structure');
    $permalink = get_permalink();
    // Fix For Static Page
    if (get_option('show_on_front') == 'page' && is_page()) {
        if (intval(get_option('page_on_front')) > 0) {
            $permalink = _get_page_link();
        }
    }
    $output = '';
    if (!empty($using_permalink)) {
        if (is_page()) {
            $output .= '<form action="' . $permalink . 'emailpopuppage/" method="post">' . "\n";
            $output .= '<p style="display: none;"><input type="hidden" id="page_id" name="page_id" value="' . $id . '" /></p>' . "\n";
        } else {
            $output = '<form action="' . $permalink . 'emailpopup/" method="post">' . "\n";
            $output .= '<p style="display: none;"><input type="hidden" id="p" name="p" value="' . $id . '" /></p>' . "\n";
        }
    } else {
        if (is_page()) {
            $output .= '<form action="' . $permalink . '&amp;emailpopup=1" method="post">' . "\n";
            $output .= '<p style="display: none;"><input type="hidden" id="page_id" name="page_id" value="' . $id . '" /></p>' . "\n";
        } else {
            $output .= '<form action="' . $permalink . '&amp;emailpopup=1" method="post">' . "\n";
            $output .= '<p style="display: none;"><input type="hidden" id="p" name="p" value="' . $id . '" /></p>' . "\n";
        }
    }
    $output .= '<p style="display: none;"><input type="hidden" id="wp-email_nonce" name="wp-email_nonce" value="' . wp_create_nonce('wp-email-nonce') . '" /></p>' . "\n";
    if ($echo) {
        echo $output;
    } else {
        return $output;
    }
}
Exemple #19
0
function email_popup_form_header($echo = true)
{
    global $id;
    $using_permalink = get_option('permalink_structure');
    $permalink = get_permalink();
    // Fix For Static Page
    if (get_option('show_on_front') == 'page' && is_page()) {
        if (intval(get_option('page_on_front')) > 0) {
            $permalink = _get_page_link();
        }
    }
    $output = '';
    if (!empty($using_permalink)) {
        if (is_page()) {
            $output .= '<form action="' . $permalink . 'emailpopuppage/" method="post">' . "\n";
            $output .= '<p><input type="hidden" name="page_id" value="' . $id . '" /></p>' . "\n";
        } else {
            $output = '<form action="' . $permalink . 'emailpopup/" method="post">' . "\n";
            $output .= '<p><input type="hidden" name="p" value="' . $id . '" /></p>' . "\n";
        }
    } else {
        if (is_page()) {
            $output .= '<form action="' . $permalink . '&amp;emailpopup=1" method="post">' . "\n";
            $output .= '<p><input type="hidden" name="page_id" value="' . $id . '" /></p>' . "\n";
        } else {
            $output .= '<form action="' . $permalink . '&amp;emailpopup=1" method="post">' . "\n";
            $output .= '<p><input type="hidden" name="p" value="' . $id . '" /></p>' . "\n";
        }
    }
    if ($echo) {
        echo $output;
    } else {
        return $output;
    }
}
 public function set_home_url()
 {
     global $polylang;
     // home url for search form (can't use the page url if a static page is used as front page)
     $this->search_url = $polylang->links_model->home_url($this);
     // add a trailing slash as done by WP on homepage (otherwise could break the search form when the permalink structure does not include one)
     // only for pretty permalinks
     if (get_option('permalink_structure')) {
         $this->search_url = trailingslashit($this->search_url);
     }
     $options = get_option('polylang');
     // a static page is used as front page
     if (!$options['redirect_lang'] && 'page' == get_option('show_on_front') && ($page_on_front = get_option('page_on_front')) && ($id = pll_get_post($page_on_front, $this))) {
         $this->home_url = _get_page_link($id);
     } else {
         $this->home_url = $this->search_url;
     }
 }
 private function get_rewrite_rules()
 {
     global $wpdb;
     global $wp_rewrite;
     $rules = array();
     // TODO: move this to WPML Compat.
     if ($page_ids = wpbdp_get_page_ids('main')) {
         foreach ($page_ids as $page_id) {
             $page_link = _get_page_link($page_id);
             $rewrite_base = str_replace('index.php/', '', rtrim(str_replace(home_url() . '/', '', $page_link), '/'));
             $rules['(' . $rewrite_base . ')/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$'] = 'index.php?page_id=' . $page_id . '&paged=$matches[2]';
             $rules['(' . $rewrite_base . ')/' . wpbdp_get_option('permalinks-category-slug') . '/(.+?)/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$'] = 'index.php?page_id=' . $page_id . '&category=$matches[2]&paged=$matches[3]';
             $rules['(' . $rewrite_base . ')/' . wpbdp_get_option('permalinks-category-slug') . '/(.+?)/?$'] = 'index.php?page_id=' . $page_id . '&category=$matches[2]';
             $rules['(' . $rewrite_base . ')/' . wpbdp_get_option('permalinks-tags-slug') . '/(.+?)/' . $wp_rewrite->pagination_base . '/?([0-9]{1,})/?$'] = 'index.php?page_id=' . $page_id . '&tag=$matches[2]&paged=$matches[3]';
             $rules['(' . $rewrite_base . ')/' . wpbdp_get_option('permalinks-tags-slug') . '/(.+?)$'] = 'index.php?page_id=' . $page_id . '&tag=$matches[2]';
             if (wpbdp_get_option('permalinks-no-id')) {
                 //$rules['(' . $rewrite_base . ')/([0-9]{1,})/?$'] = 'index.php?page_id=' . $page_id . '&id=$matches[2]';
                 $rules['(' . $rewrite_base . ')/(.*)/?$'] = 'index.php?page_id=' . $page_id . '&listing=$matches[2]';
             } else {
                 $rules['(' . $rewrite_base . ')/([0-9]{1,})/?(.*)/?$'] = 'index.php?page_id=' . $page_id . '&id=$matches[2]';
             }
         }
     }
     return apply_filters('wpbdp_rewrite_rules', $rules);
 }
Exemple #22
0
    protected function redirect_lang()
    {
        ?>
		<label><?php 
        printf('<input name="redirect_lang" type="checkbox" value="1" %s/> %s', $this->options['redirect_lang'] ? 'checked="checked"' : '', __('The front page url contains the language code instead of the page name or page id', 'polylang'));
        ?>
		</label>
		<p class="description"><?php 
        // that's nice to display the right home urls but don't forget that the page on front may have no language yet
        $lang = $this->model->post->get_language($this->page_on_front);
        $lang = $lang ? $lang : $this->model->get_language($this->options['default_lang']);
        printf(__('Example: %s instead of %s', 'polylang'), '<code>' . esc_html($this->links_model->home_url($lang)) . '</code>', '<code>' . esc_html(_get_page_link($this->page_on_front)) . '</code>');
        ?>
		</p><?php 
    }
function get_attachment_link($id = false) {
	global $post, $wp_rewrite;

	$link = false;

	if (! $id) {
		$id = (int) $post->ID;
	}

	$object = get_post($id);
	if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) && ($object->post_parent != $id) ) {
		$parent = get_post($object->post_parent);
		if ( 'page' == $parent->post_type )
			$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
		else
			$parentlink = get_permalink( $object->post_parent );
		if (strpos($parentlink, '?') === false)
			$link = trim($parentlink, '/') . '/' . $object->post_name . '/';
	}

	if (! $link ) {
		$link = get_bloginfo('url') . "/?attachment_id=$id";
	}

	return apply_filters('attachment_link', $link, $id);
}
Exemple #24
0
/**
 * Retrieve the permalink for the post comments feed.
 *
 * @since 2.2.0
 *
 * @param int $post_id Optional. Post ID.
 * @param string $feed Optional. Feed type.
 * @return string
 */
function get_post_comments_feed_link($post_id = 0, $feed = '')
{
    $post_id = absint($post_id);
    if (!$post_id) {
        $post_id = get_the_ID();
    }
    if (empty($feed)) {
        $feed = get_default_feed();
    }
    if ('' != get_option('permalink_structure')) {
        if ('page' == get_option('show_on_front') && $post_id == get_option('page_on_front')) {
            $url = _get_page_link($post_id);
        } else {
            $url = get_permalink($post_id);
        }
        $url = trailingslashit($url) . 'feed';
        if ($feed != get_default_feed()) {
            $url .= "/{$feed}";
        }
        $url = user_trailingslashit($url, 'single_feed');
    } else {
        $type = get_post_field('post_type', $post_id);
        if ('page' == $type) {
            $url = home_url("?feed={$feed}&amp;page_id={$post_id}");
        } else {
            $url = home_url("?feed={$feed}&amp;p={$post_id}");
        }
    }
    return apply_filters('post_comments_feed_link', $url);
}
/**
 * wpsc_update_page_urls gets the permalinks for products pages and stores them in the options for quick reference
 * @public
 *
 * @since 3.6
 * @param $auto (Boolean) true if coming from WordPress Permalink Page, false otherwise
 * @return nothing
 */
function wpsc_update_page_urls($auto = false)
{
    global $wpdb;
    $wpsc_pageurl_option['product_list_url'] = '[productspage]';
    $wpsc_pageurl_option['shopping_cart_url'] = '[shoppingcart]';
    $check_chekout = $wpdb->get_var("SELECT `guid` FROM `{$wpdb->posts}` WHERE `post_content` LIKE '%[checkout]%' LIMIT 1");
    if ($check_chekout != null) {
        $wpsc_pageurl_option['checkout_url'] = '[checkout]';
    } else {
        $wpsc_pageurl_option['checkout_url'] = '[checkout]';
    }
    $wpsc_pageurl_option['transact_url'] = '[transactionresults]';
    $wpsc_pageurl_option['user_account_url'] = '[userlog]';
    $changes_made = false;
    foreach ($wpsc_pageurl_option as $option_key => $page_string) {
        $post_id = $wpdb->get_var("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` IN('page','post') AND `post_content` LIKE '%{$page_string}%' LIMIT 1");
        if (!$post_id) {
            continue;
        }
        $the_new_link = _get_page_link($post_id);
        if (stristr(get_option($option_key), "https://")) {
            $the_new_link = str_replace('http://', "https://", $the_new_link);
        }
        update_option($option_key, $the_new_link);
    }
    if (!$auto) {
        $sendback = wp_get_referer();
        if (isset($updated)) {
            $sendback = add_query_arg('updated', $updated, $sendback);
        }
        if (isset($_SESSION['wpsc_settings_curr_page'])) {
            $sendback = add_query_arg('tab', $_SESSION['wpsc_settings_curr_page'], $sendback);
        }
        wp_redirect($sendback);
        exit;
    }
}
/**
 * Retrieve the permalink for the post comments feed.
 *
 * @since 2.2.0
 *
 * @param int    $post_id Optional. Post ID.
 * @param string $feed    Optional. Feed type.
 * @return string The permalink for the comments feed for the given post.
 */
function get_post_comments_feed_link($post_id = 0, $feed = '')
{
    $post_id = absint($post_id);
    if (!$post_id) {
        $post_id = get_the_ID();
    }
    if (empty($feed)) {
        $feed = get_default_feed();
    }
    if ('' != get_option('permalink_structure')) {
        if ('page' == get_option('show_on_front') && $post_id == get_option('page_on_front')) {
            $url = _get_page_link($post_id);
        } else {
            $url = get_permalink($post_id);
        }
        $url = trailingslashit($url) . 'feed';
        if ($feed != get_default_feed()) {
            $url .= "/{$feed}";
        }
        $url = user_trailingslashit($url, 'single_feed');
    } else {
        $type = get_post_field('post_type', $post_id);
        if ('page' == $type) {
            $url = add_query_arg(array('feed' => $feed, 'page_id' => $post_id), home_url('/'));
        } else {
            $url = add_query_arg(array('feed' => $feed, 'p' => $post_id), home_url('/'));
        }
    }
    /**
     * Filter the post comments feed permalink.
     *
     * @since 1.5.1
     *
     * @param string $url Post comments feed permalink.
     */
    return apply_filters('post_comments_feed_link', $url);
}
function get_attachment_link($id = false)
{
    global $post, $wp_rewrite;
    $link = false;
    if (!$id) {
        $id = (int) $post->ID;
    }
    $object = get_post($id);
    if ($wp_rewrite->using_permalinks() && $object->post_parent > 0 && $object->post_parent != $id) {
        $parent = get_post($object->post_parent);
        if ('page' == $parent->post_type) {
            $parentlink = _get_page_link($object->post_parent);
        } else {
            $parentlink = get_permalink($object->post_parent);
        }
        if (!strstr($parentlink, '?')) {
            $link = trim($parentlink, '/') . '/' . $object->post_name . '/';
        }
    }
    if (!$link) {
        $link = get_bloginfo('home') . "/?attachment_id={$id}";
    }
    return apply_filters('attachment_link', $link, $id);
}