public final function set_language_details($language_code = null)
 {
     global $sitepress;
     $package = $this->package;
     $post_id = $package->ID;
     $post = $this->get_translatable_item($post_id);
     $post_id = $post->ID;
     $element_type = $package->get_translation_element_type();
     if (!$language_code) {
         $language_code = icl_get_default_language();
     }
     $sitepress->set_element_language_details($post_id, $element_type, false, $language_code, null, false);
 }
function um_submit_account_details($args)
{
    global $ultimatemember;
    $tab = get_query_var('um_tab') ? get_query_var('um_tab') : 'general';
    if ($_POST['user_password'] && $_POST['confirm_user_password']) {
        $changes['user_pass'] = $_POST['user_password'];
        add_filter('send_password_change_email', 'um_send_password_change_email');
    }
    foreach ($_POST as $k => $v) {
        if (!strstr($k, 'password') && !strstr($k, 'um_account')) {
            $changes[$k] = $v;
        }
    }
    if (isset($changes['hide_in_members']) && $changes['hide_in_members'] == __('No', 'ultimatemember')) {
        delete_user_meta(um_user('ID'), 'hide_in_members');
        unset($changes['hide_in_members']);
    }
    // fired on account page, just before updating profile
    do_action('um_account_pre_update_profile', $changes, um_user('ID'));
    $ultimatemember->user->update_profile($changes);
    // delete account
    if ($_POST['single_user_password'] && $tab == 'delete') {
        if (current_user_can('delete_users') || um_user('can_delete_profile')) {
            if (!um_user('super_admin')) {
                $ultimatemember->user->delete();
                if (um_user('after_delete') && um_user('after_delete') == 'redirect_home') {
                    um_redirect_home();
                } elseif (um_user('delete_redirect_url')) {
                    exit(wp_redirect(um_user('delete_redirect_url')));
                } else {
                    um_redirect_home();
                }
            }
        }
    }
    do_action('um_post_account_update');
    do_action('um_after_user_account_updated', get_current_user_id());
    $url = $ultimatemember->account->tab_link($tab);
    $url = add_query_arg('updated', 'account', $url);
    if (function_exists('icl_get_current_language')) {
        if (icl_get_current_language() != icl_get_default_language()) {
            $url = $ultimatemember->permalinks->get_current_url(true);
            $url = add_query_arg('updated', 'account', $url);
            exit(wp_redirect($url));
        }
    }
    exit(wp_redirect($url));
}
Beispiel #3
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $post;
        // get the page id outside the loop (check if WPML plugin is installed and use the WPML way of getting the page ID in the current language)
        $page_id = function_exists('icl_object_id') && function_exists('icl_get_default_language') ? icl_object_id($post->ID, 'page', true, icl_get_default_language()) : $post->ID;
        $curr_page_id = get_post($page_id, ARRAY_A);
        $curr_page_title = $curr_page_id['post_title'];
        $curr_page_parent = $post->post_parent;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', $instance['title']);
        /* Before widget (defined by themes). */
        /* Display the subpages. */
        if ($curr_page_parent) {
            $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $curr_page_parent . "&echo=0");
        } else {
            $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $page_id . "&echo=0");
        }
        if ($children) {
            echo $before_widget;
            /* Display the widget title if one was input, if not display the parent page title instead. */
            if ($title) {
                echo $before_title . $title . $after_title;
            } else {
                ?>
			    <h3><?php 
                $parent = get_post($post->post_parent);
                echo $parent->post_title;
                ?>
</h3>
<?php 
            }
            ?>
		    <ul>
<?php 
            echo $children;
            ?>
		    </ul>

<?php 
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }
 function rewrite_rules()
 {
     global $ultimatemember;
     if (isset($ultimatemember->permalinks->core['user'])) {
         $user_page_id = $ultimatemember->permalinks->core['user'];
         $account_page_id = $ultimatemember->permalinks->core['account'];
         $user = get_post($user_page_id);
         if (isset($user->post_name)) {
             $user_slug = $user->post_name;
             $account = get_post($account_page_id);
             $account_slug = $account->post_name;
             $add_lang_code = '';
             if (function_exists('icl_object_id') || function_exists('icl_get_current_language')) {
                 if (function_exists('icl_get_current_language')) {
                     $language_code = icl_get_current_language();
                 } else {
                     if (function_exists('icl_object_id') && defined('ICL_LANGUAGE_CODE')) {
                         $language_code = ICL_LANGUAGE_CODE;
                     }
                 }
                 // User page translated slug
                 $lang_post_id = icl_object_id($user->ID, 'post', FALSE, $language_code);
                 $lang_post_obj = get_post($lang_post_id);
                 if (isset($lang_post_obj->post_name)) {
                     $user_slug = $lang_post_obj->post_name;
                 }
                 // Account page translated slug
                 $lang_post_id = icl_object_id($account->ID, 'post', FALSE, $language_code);
                 $lang_post_obj = get_post($lang_post_id);
                 if (isset($lang_post_obj->post_name)) {
                     $account_slug = $lang_post_obj->post_name;
                 }
                 if ($language_code != icl_get_default_language()) {
                     $add_lang_code = $language_code;
                 }
             }
             add_rewrite_rule($user_slug . '/([^/]+)/?$', 'index.php?page_id=' . $user_page_id . '&um_user=$matches[1]&lang=' . $add_lang_code, 'top');
             add_rewrite_rule($account_slug . '/([^/]+)?$', 'index.php?page_id=' . $account_page_id . '&um_tab=$matches[1]&lang=' . $add_lang_code, 'top');
             if (!apply_filters('um_rewrite_flush_rewrite_rules', um_get_option('um_flush_stop'))) {
                 flush_rewrite_rules(true);
             }
         }
     }
 }
function um_localize_permalink_filter($core_pages, $page_id, $profile_url)
{
    global $ultimatemember;
    if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
        if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
            $profile_url = get_permalink(get_the_ID());
        }
    }
    // WPML compatibility
    if (function_exists('icl_object_id')) {
        $language_code = ICL_LANGUAGE_CODE;
        $lang_post_id = icl_object_id($page_id, 'page', true, $language_code);
        if ($lang_post_id != 0) {
            $profile_url = get_permalink($lang_post_id);
        } else {
            // No page found, it's most likely the homepage
            global $sitepress;
            $profile_url = $sitepress->language_url($language_code);
        }
    }
    return $profile_url;
}
    function widget($args, $instance)
    {
        extract($args);
        global $post;
        $page_id = function_exists('icl_object_id') && function_exists('icl_get_default_language') ? icl_object_id($post->ID, 'page', true, icl_get_default_language()) : $post->ID;
        $curr_page_id = get_post($page_id, ARRAY_A);
        $curr_page_title = $curr_page_id['post_title'];
        $curr_page_parent = $post->post_parent;
        $title = apply_filters('widget_title', $instance['title']);
        if ($curr_page_parent) {
            $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $curr_page_parent . "&echo=0");
        } else {
            $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=" . $page_id . "&echo=0");
        }
        if ($children) {
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            } else {
                ?>
			    <h3><?php 
                $parent = get_post($post->post_parent);
                echo $parent->post_title;
                ?>
</h3>
			<?php 
            }
            ?>
		    <ul>
			<?php 
            echo $children;
            ?>
		    </ul>
			<?php 
            echo $after_widget;
        }
    }
Beispiel #7
0
 /**
  * @param stdClass|WPML_Package|array|int $data_item
  */
 function __construct($data_item)
 {
     $default_language = icl_get_default_language();
     $this->element_type_prefix = 'package';
     $this->default_language = $default_language;
     $this->language_code = $default_language;
     $this->view_link = '';
     $this->edit_link = '';
     if ($data_item) {
         if (is_object($data_item)) {
             $data_item = get_object_vars($data_item);
         }
         if (is_numeric($data_item)) {
             $data_item = $this->init_from_id($data_item, ARRAY_A);
         }
         if (isset($data_item['title'])) {
             $this->new_title = $data_item['title'];
         }
         if ($data_item && is_array($data_item)) {
             $this->init_from_array($data_item);
         }
         $this->new_title = $this->new_title != $this->title ? $this->new_title : null;
     }
 }
Beispiel #8
0
//if ( !$is_active || !$product->is_on_sale() ) return; 
       
$img = '';                                                               

// set a preset image 
if ( $is_active && $is_active != 'no' ) {
    switch ( $preset ) {
        case 'onsale' : $img = get_stylesheet_directory_uri() . '/woocommerce/images/bullets/sale.png'; break;
        case '-50%'   : $img = get_stylesheet_directory_uri() . '/woocommerce/images/bullets/50.png'; break;
        case '-25%'   : $img = get_stylesheet_directory_uri() . '/woocommerce/images/bullets/25.png'; break;
        case '-10%'   : $img = get_stylesheet_directory_uri() . '/woocommerce/images/bullets/10.png'; break;
        case 'custom' : $img = $custom; break;        
    }
    
} elseif ( $product->is_on_sale() && ( !empty( $regular_price ) || !empty( $regular_price_var ) ) ) {

    $img = 'sale.png';
    if( function_exists('icl_get_default_language') ){
        if( ICL_LANGUAGE_CODE == icl_get_default_language() )  $img = 'sale.png';
        else $img = icl_get_default_language().'_sale.png';
    }

    $img = get_stylesheet_directory_uri() . '/woocommerce/images/bullets/'.$img;
}

if ( empty( $img ) ) return;


$image = apply_filters('woocommerce_sale_flash', yit_image( "echo=no&src=$img&getimagesize=1&class=onsale&alt=" . __( 'On sale!', 'yit' ) ), $post, $product );

echo $image;
/**
 * Choose appropriate template file when paged and not default language
 *
 * Some fix when somebody uses 'page_on_front', set page with custom Template,
 * this page has Loop of posts. Before that, when you changed language to
 * non-default and paged, WPML looses page Template and uses index.php from theme
 *
 * @since 3.1.5
 *
 * @param string $template Template path retrieved from @see wp-includes/template-loader.php
 *
 * @return string New template path (or default)
 *
 */
function icl_template_paged($template)
{
    global $wp_query, $sitepress;
    // we don't want to run this on default language
    if (ICL_LANGUAGE_CODE == icl_get_default_language()) {
        return $template;
    }
    // seems WPML overwrite 'page' param too early, let's fix this
    if ($sitepress->get_setting('language_negotiation_type') == 3) {
        set_query_var('page', get_query_var('paged'));
    }
    // if template is chosen correctly there is no need to change it
    if ($template != get_home_template()) {
        return $template;
    }
    // this is a place where real error occurs. on paged page result we loose
    // $wp_query->queried_object. so if it set correctly, there is no need to
    // change template
    if ($wp_query->get_queried_object() != null) {
        return $template;
    }
    // does our site really use custom page as front page?
    if (1 > intval(get_option('page_on_front'))) {
        return $template;
    }
    // get template slug for custom page chosen as front page
    $template_slug = get_page_template_slug(get_option('page_on_front'));
    // "The function get_page_template_slug() returns an empty string when the value of '_wp_page_template' is either empty or 'default'."
    if (!$template_slug) {
        return $template;
    }
    $templates = array();
    $templates[] = $template_slug;
    $template = get_query_template('page', $templates);
    return $template;
}
Beispiel #10
0
<?php

/**
 * @package WordPress
 * @subpackage U-Design
 */
/**
 * Template Name: Portfolio page 2 Columns
 */
get_header();
global $post;
// get the page id outside the loop (check if WPML plugin is installed and use the WPML way of getting the page ID in the current language)
$page_id = function_exists('icl_object_id') && function_exists('icl_get_default_language') ? icl_object_id($post->ID, 'page', true, icl_get_default_language()) : $post->ID;
$portfolio_cat_ID = $udesign_options['portfolio_cat_for_page_' . $page_id];
// Get the portfolio category specified by the user in the 'U-Design Options' page
$current_categoryID = $_GET['cat'];
$categories = get_categories('child_of=' . $portfolio_cat_ID);
$query_string_prefix = get_option('permalink_structure') != '' ? '?' : '&amp;';
if (preg_match('/\\?/', get_permalink())) {
    $query_string_prefix = '&amp;';
}
$portfolio_items_per_page = $udesign_options['portfolio_items_per_page_for_page_' . $page_id];
$portfolio_title_posistion = $udesign_options['portfolio_title_posistion'];
?>

<div id="content-container" class="container_24">
    <div id="main-content" class="grid_24">
	<div class="main-content-padding">

<?php 
// BEGIN the actual page content here...
Beispiel #11
0
 /**
  * Get current query information.
  *
  * @global \WP_Query $wp_query
  *
  * @return string[]
  */
 public function getQuery()
 {
     global $wp_query;
     // create, if not set
     if (empty($this->query)) {
         // init vars
         $obj = $wp_query->get_queried_object();
         $type = get_post_type();
         $query = array();
         if (is_home()) {
             $query[] = 'home';
         }
         if (is_front_page()) {
             $query[] = 'front_page';
         }
         if ($type == 'post') {
             if (is_single()) {
                 $query[] = 'single';
             }
             if (is_archive()) {
                 $query[] = 'archive';
             }
             if (is_search()) {
                 $query[] = 'search';
             }
         } else {
             if (is_single()) {
                 $query[] = $type . '-single';
             } elseif (is_search()) {
                 $query[] = $type . '-search';
             } elseif (is_archive()) {
                 $query[] = $type . '-archive';
             }
         }
         if (is_page()) {
             $query[] = $type;
             $query[] = $type . '-' . $obj->ID;
         }
         if (is_category()) {
             $query[] = 'cat-' . $obj->term_id;
         }
         // WooCommerce
         if (is_plugin_active('woocommerce/woocommerce.php')) {
             if (is_shop() && !is_search()) {
                 $query[] = 'page';
                 $query[] = 'page-' . wc_get_page_id('shop');
             }
             if (is_product_category() || is_product_tag()) {
                 $query[] = 'cat-' . $obj->term_id;
             }
         }
         // WPML support
         if (defined('ICL_LANGUAGE_CODE') && function_exists('icl_get_default_language') && ICL_LANGUAGE_CODE != ($lang = icl_get_default_language())) {
             if ($type == 'page') {
                 $query[] = 'page-' . icl_object_id($obj->ID, $type, true, $lang);
             }
             if ($type == 'category') {
                 $query[] = 'cat-' . icl_object_id($obj->term_id, $type, true, $lang);
             }
         }
         $this->query = $query;
     }
     return $this->query;
 }
Beispiel #12
0
 public function getQuery()
 {
     global $wp_query;
     // create, if not set
     if (empty($this->query)) {
         // init vars
         $obj = $wp_query->get_queried_object();
         $query = array();
         // find current page type
         foreach (array('home', 'front_page', 'archive', 'search', 'single', 'page', 'category') as $type) {
             if (call_user_func('is_' . $type)) {
                 $query[] = $type;
                 if ($type == 'page') {
                     $query[] = 'page-' . $obj->ID;
                 }
                 if ($type == 'single') {
                     $query[] = $obj->post_type;
                     $query[] = $obj->post_type . '-' . $obj->ID;
                 }
                 if ($type == 'category') {
                     $query[] = 'cat-' . $obj->cat_ID;
                 }
                 if ($type == 'archive') {
                     $query[] = 'cat-' . $obj->term_id;
                 }
                 // WPML support
                 if (defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE != ($lang = icl_get_default_language())) {
                     if ($type == 'page') {
                         $query[] = 'page-' . icl_object_id($obj->ID, $type, true, $lang);
                     }
                     if ($type == 'category') {
                         $query[] = 'cat-' . icl_object_id($obj->term_id, $type, true, $lang);
                     }
                 }
             }
         }
         $this->query = $query;
     }
     return $this->query;
 }
/**
 * Adjusts MarketPress product ID to be added in cart (original product ID).
 * 
 * @param type $product_id
 * @return type 
 */
function wpml_marketpress_mp_product_id_add_to_cart_filter($product_id)
{
    $product_id = icl_object_id($product_id, 'product', true, icl_get_default_language());
    return $product_id;
}
 function profile_url()
 {
     global $ultimatemember;
     $page_id = $this->core['user'];
     $profile_url = get_permalink($page_id);
     if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
         if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
             $profile_url = get_permalink(get_the_ID());
         }
     }
     // WPML compatibility
     if (function_exists('icl_object_id')) {
         $language_code = ICL_LANGUAGE_CODE;
         $lang_post_id = icl_object_id($page_id, 'page', true, $language_code);
         if ($lang_post_id != 0) {
             $profile_url = get_permalink($lang_post_id);
         } else {
             // No page found, it's most likely the homepage
             global $sitepress;
             $profile_url = $sitepress->language_url($language);
         }
     }
     if (um_get_option('permalink_base') == 'user_login') {
         $user_in_url = um_user('user_login');
         if (is_email($user_in_url)) {
             $user_in_url = str_replace('@', '', $user_in_url);
             if (($pos = strrpos($user_in_url, '.')) !== false) {
                 $search_length = strlen('.');
                 $user_in_url = substr_replace($user_in_url, '-', $pos, $search_length);
             }
         } else {
             $user_in_url = sanitize_title($user_in_url);
         }
     }
     if (um_get_option('permalink_base') == 'user_id') {
         $user_in_url = um_user('ID');
     }
     if (um_get_option('permalink_base') == 'name') {
         $user_in_url = rawurlencode(strtolower(str_replace(" ", ".", um_user('full_name'))));
     }
     if (um_get_option('permalink_base') == 'name_dash') {
         $user_in_url = rawurlencode(strtolower(str_replace(" ", "-", um_user('full_name'))));
     }
     if (um_get_option('permalink_base') == 'name_plus') {
         $user_in_url = strtolower(str_replace(" ", "+", um_user('full_name')));
     }
     if (get_option('permalink_structure')) {
         $profile_url = trailingslashit(untrailingslashit($profile_url));
         $profile_url = $profile_url . $user_in_url . '/';
     } else {
         $profile_url = add_query_arg('um_user', $user_in_url, $profile_url);
     }
     return $profile_url;
 }
 function profile_url()
 {
     global $ultimatemember;
     $page_id = $this->core['user'];
     $profile_url = get_permalink($page_id);
     if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
         if (get_the_ID() > 0 && get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
             $profile_url = get_permalink(get_the_ID());
         }
     }
     if (um_get_option('permalink_base') == 'user_login') {
         $user_in_url = um_user('user_login');
         if (is_email($user_in_url)) {
             $user_in_url = str_replace('@', '', $user_in_url);
             if (($pos = strrpos($user_in_url, '.')) !== false) {
                 $search_length = strlen('.');
                 $user_in_url = substr_replace($user_in_url, '-', $pos, $search_length);
             }
         } else {
             $user_in_url = sanitize_title($user_in_url);
         }
     }
     if (um_get_option('permalink_base') == 'user_id') {
         $user_in_url = um_user('ID');
     }
     if (um_get_option('permalink_base') == 'name') {
         $user_in_url = rawurlencode(strtolower(um_user('full_name')));
     }
     if (get_option('permalink_structure')) {
         $profile_url = trailingslashit(untrailingslashit($profile_url));
         $profile_url = $profile_url . $user_in_url . '/';
     } else {
         $profile_url = add_query_arg('um_user', $user_in_url, $profile_url);
     }
     return $profile_url;
 }
Beispiel #16
0
 /**
  * Retrieves the default language
  * 
  * @return string|false
  */
 public function getDefaultLanguage()
 {
     $result = false;
     if (function_exists('icl_get_default_language')) {
         $result = icl_get_default_language();
     }
     return $result;
 }
Beispiel #17
0
 /**
  * Filters JigoShop product ID when adding the product to the cart.
  *
  * @param type $product_id
  * @return type
  */
 function product_id_add_to_cart($product_id)
 {
     $product_id = icl_object_id($product_id, 'product', true, icl_get_default_language());
     return $product_id;
 }
function um_get_core_page($slug, $updated = false)
{
    global $ultimatemember;
    $url = '';
    if (isset($ultimatemember->permalinks->core[$slug])) {
        $url = get_permalink($ultimatemember->permalinks->core[$slug]);
        if ($updated) {
            $url = add_query_arg('updated', esc_attr($updated), $url);
        }
    }
    if (function_exists('icl_get_current_language') && icl_get_current_language() != icl_get_default_language()) {
        $url = um_get_url_for_language($ultimatemember->permalinks->core[$slug], icl_get_current_language());
        if (get_post_meta(get_the_ID(), '_um_wpml_account', true) == 1) {
            $url = get_permalink(get_the_ID());
        }
        if (get_post_meta(get_the_ID(), '_um_wpml_user', true) == 1) {
            $url = um_get_url_for_language($ultimatemember->permalinks->core[$slug], icl_get_current_language());
        }
    }
    if ($url) {
        $url = apply_filters('um_get_core_page_filter', $url, $slug, $updated);
        return $url;
    }
    return '';
}
Beispiel #19
0
 function wpml_get_parent_id($id)
 {
     global $post;
     if (function_exists('icl_object_id') && function_exists('icl_get_default_language')) {
         $id = icl_object_id($id, $post->post_type, true, icl_get_default_language());
     }
     return $id;
 }
 protected function loaded()
 {
     $this->default_language = icl_get_default_language();
 }
Beispiel #21
0
function aviators_property_submission_button_get($type)
{
    if (function_exists('icl_get_languages')) {
        if (icl_get_default_language() == ICL_LANGUAGE_CODE) {
            return get_theme_mod('header_call_to_action_' . $type);
        } else {
            return get_theme_mod('header_call_to_action_' . $type . '_' . ICL_LANGUAGE_CODE);
        }
    }
    return get_theme_mod('header_call_to_action_' . $type);
}