Exemplo n.º 1
0
/**
 * Polylang
 *
 * @param $string
 * @param $context
 * @param $name
 *
 * @return bool|string|void
 */
function wpmtst_l10n_polylang($string, $context, $name)
{
    if (function_exists('pll__')) {
        return pll__($string);
    }
    return $string;
}
Exemplo n.º 2
0
 public function translate_strings($form)
 {
     if (function_exists('pll__')) {
         $this->iterate_form($form, function (&$value, $key) {
             $value = pll__($value);
         });
     }
     return $form;
 }
Exemplo n.º 3
0
 /**
  * Add content to the WC emails.
  *
  * Note: The difference from WC_Gateway_BACS is that we use __() before
  * passing the string through wptexturize() and wpautop().
  *
  * @param WC_Order $order
  * @param bool     $sent_to_admin
  * @param bool     $plain_text
  */
 public function email_instructions($order, $sent_to_admin, $plain_text = false)
 {
     if (!$sent_to_admin && 'bacs' === $order->payment_method && $order->has_status('on-hold')) {
         if ($this->instructions) {
             echo wpautop(wptexturize(function_exists('pll__') ? pll__($this->instructions) : __($this->instructions, 'woocommerce'))) . PHP_EOL;
         }
         $this->bank_details($order->id);
     }
 }
 public function translate_string($string)
 {
     if (function_exists('pll__')) {
         return pll__($string);
     } else {
         return $string;
         // Don't kill anything.
     }
 }
Exemplo n.º 5
0
 /**
  * Get translations by their strings.
  *
  * @param string $key
  * @param string|null $lang
  *
  * @throws \BadFunctionCallException
  *
  * @return string
  */
 function trans($key, $lang = null)
 {
     if (!function_exists('pll__')) {
         throw new BadFunctionCallException('Please active the Polylang plugin.');
     }
     if ($lang) {
         return pll_translate_string($key, $lang);
     }
     return pll__($key);
 }
/**
 * Get multilanguage string
 *
 * @since   1.0.0
 *
 * @param     string   $plugin_name_human_format  The Plugin name 
 * @param     string   $string_name               The name of the string
 * @param     string   $value					  The value
 */
function get_string($plugin_name_human_format, $string_name, $value)
{
    if (function_exists('icl_t')) {
        return icl_t($plugin_name_human_format, $string_name, $value);
    } elseif (has_filter('cml_my_translations')) {
        return CMLTranslations::get(CMLLanguage::get_current_id(), $string_name, str_replace(' ', '-', $plugin_name_human_format));
    } elseif (function_exists('pll__')) {
        return pll__($string_name);
    } else {
        return $value;
    }
}
 /**
  * Retrieves the translation for a string, if available. Needs a supported translation plugin active.
  * Parameters should be identical to respective call of ci_register_string_translation()
  *
  * @param string $name A description of the value, e.g. 'Booking - Button Text'
  * @param string $value The text to be registered for translation, e.g. 'Book Now'
  * @param string $context A context for grouping and disambiguation of the value, e.g. 'Widgets'
  * @return string A translation of $value if available, else $value.
  */
 function ci_get_string_translation($name, $value, $context)
 {
     $translation = $value;
     // WPML support
     if (function_exists('icl_t')) {
         $translation = icl_t($context, $name . ' - ' . md5($value), $value);
     } elseif (function_exists('pll__')) {
         // Doesn't work before the 'wp' action.
         $translation = pll__($value);
     }
     // qTranslate seems to be working out of the box.
     return $translation;
 }
Exemplo n.º 8
0
 function populateDropdownOptions()
 {
     foreach ($this->fields as $key => $val) {
         if ($val['metaType'] == 'taxonomy') {
             $this->fields[$key]['dropdownOptions'] = $this->getDropdownOptionsFromTaxonomy($val['taxonomySlug']);
         }
     }
     $this->fields['country']['dropdownOptions'] = $this->countryList;
     $this->fields['country']['dropdownOptions'][0] = pll__('Pasirinkite');
     $this->fields['license_territory']['dropdownOptions'] = $this->countryList;
     $this->fields['license_territory']['dropdownOptions'][0] = pll__('Pasirinkite');
     $this->fields['film_original_language']['dropdownOptions'] = $this->countryList22;
     $this->fields['film_original_language']['dropdownOptions'][0] = pll__('Pasirinkite');
     $this->fields['film_subtitle_language']['dropdownOptions'] = $this->countryList22;
     $this->fields['film_subtitle_language']['dropdownOptions'][0] = pll__('Pasirinkite');
 }
Exemplo n.º 9
0
/**
 * Header text
 */
function perth_header_text()
{
    if (!function_exists('pll_register_string')) {
        $header_text = get_theme_mod('header_text', 'Welcome to Perth');
        $button_left = get_theme_mod('button_left', 'Start here');
        $button_right = get_theme_mod('button_right', 'Read more');
    } else {
        $header_text = pll__(get_theme_mod('header_text', 'Welcome to Perth'));
        $button_left = pll__(get_theme_mod('button_left', 'Start here'));
        $button_right = pll__(get_theme_mod('button_right', 'Read more'));
    }
    $button_left_url = get_theme_mod('button_left_url', '#primary');
    $button_right_url = get_theme_mod('button_right_url', '#primary');
    echo '<div class="header-info">
			<h3 class="header-text">' . esc_html($header_text) . '</h3>
			<div class="header-buttons">';
    if ($button_left_url) {
        echo '<a class="button header-button left-button" href="' . esc_url($button_left_url) . '">' . esc_html($button_left) . '</a>';
    }
    if ($button_right_url) {
        echo '<a class="button header-button right-button" href="' . esc_url($button_right_url) . '">' . esc_html($button_right) . '</a>';
    }
    echo '</div>';
    echo '</div>';
}
 /**
  * Add translation strings to translatable strings
  *
  * @param array $parameter ["domain" => "wpsolr facel label", "name" => "categories", "text" => "my categories"]
  */
 function get_translation_string($string, $parameter)
 {
     if (empty($parameter['language'])) {
         // Translate with current language
         $result = pll__($parameter['name']);
     } else {
         // Translate with parameter language
         $result = pll_translate_string($parameter['name'], $parameter['language']);
     }
     return $result;
 }
Exemplo n.º 11
0
 function icl_translate($context, $name, $string, $bool = false)
 {
     PLL_WPML_Compat::instance()->register_string($context, $name, $string);
     return pll__($string);
 }
Exemplo n.º 12
0
function pll_translate_string($string, $lang)
{
    if (pll_current_language() == $lang) {
        return pll__($string);
    }
    static $cache;
    // cache object to avoid loading the same translations object several times
    if (empty($cache)) {
        $cache = new PLL_Cache();
    }
    if (false === ($mo = $cache->get($lang))) {
        $mo = new PLL_MO();
        $mo->import_from_db(PLL()->model->get_language($lang));
        $cache->set($lang, $mo);
    }
    return $mo->translate($string);
}
Exemplo n.º 13
0
 protected function translate_strings_recursive($strings, $values)
 {
     foreach ($values as $name => $value) {
         if (isset($strings[$name])) {
             if (is_string($value) && $strings[$name] == 1) {
                 $values[$name] = pll__($value);
             } elseif (is_array($value) && is_array($strings[$name])) {
                 $values[$name] = $this->translate_strings_recursive($strings[$name], $value);
             }
         }
     }
     return $values;
 }
Exemplo n.º 14
0
 /**
  * Add endpoints
  *
  * Add all endpoints translation in the current langauge
  */
 public function addEndpoints()
 {
     foreach ($this->endpoints as $endpoint) {
         add_rewrite_endpoint(pll__($endpoint), EP_ROOT | EP_PAGES);
     }
 }
Exemplo n.º 15
0
<?php

get_header();
?>
<section class="content">
	<?php 
echo do_shortcode('[sh-latest-posts cat="news" label="' . pll__('Новини') . '"]');
?>
<div class="separator"></div>
<div class="col-right sponsors sponsors-frontpage">
    <?php 
echo do_shortcode('[sponsors]');
?>
    <?php 
echo do_shortcode('[partners]');
?>
</div>
<div class="separator"></div>
</section>

<?php 
echo do_shortcode('[transport]');
?>

<?php 
get_footer();
Exemplo n.º 16
0
 /**
  * Translate the attribute label
  *
  * @param string $label original attribute label
  *
  * @return string translated attribute label
  */
 public function translateAttrLable($label)
 {
     return pll__($label);
 }
Exemplo n.º 17
0
 /**
  * Translate shipping method title in My Account page, Order Emails and Paypal requests.
  *
  * @param string   $implode  Comma separated string of shipping methods used in order
  * @param WC_Order $instance Order instance
  *
  * @return string Comma separated string of translated shipping methods' titles
  */
 public function translateOrderShippingMethod($implode, $instance)
 {
     // Convert the imploded array again to an array that is easy to manipulate
     $shipping_methods = explode(', ', $implode);
     // Array with translated shipping methods
     $translated = array();
     foreach ($shipping_methods as $shipping) {
         if (function_exists('pll__')) {
             $translated[] = pll__($shipping);
         } else {
             $translated[] = __($shipping, 'woocommerce');
         }
     }
     // Implode array to string again
     $translated_implode = implode(', ', $translated);
     return $translated_implode;
 }
 protected function translate_strings_recursive($strings, $values)
 {
     foreach ($values as $name => $value) {
         if (isset($strings[$name])) {
             // allow numeric values to be translated
             // https://wordpress.org/support/topic/wpml-configxml-strings-skipped-when-numbers-ids
             if ((is_numeric($value) || is_string($value)) && $strings[$name] == 1) {
                 $values[$name] = pll__($value);
             } elseif (is_array($value) && is_array($strings[$name])) {
                 $values[$name] = $this->translate_strings_recursive($strings[$name], $value);
             }
         }
     }
     return $values;
 }
Exemplo n.º 19
0
function eme_translate($value, $lang = '')
{
    //if (empty($lang))
    //   $lang=eme_detect_lang();
    if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage') && function_exists('qtrans_use')) {
        if (empty($lang)) {
            return qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
        } else {
            return qtrans_use($lang, $value);
        }
    } elseif (function_exists('ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage') && function_exists('ppqtrans_use')) {
        if (empty($lang)) {
            return ppqtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
        } else {
            return ppqtrans_use($lang, $value);
        }
    } elseif (function_exists('qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage') && function_exists('qtranxf_use')) {
        if (empty($lang)) {
            return qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
        } else {
            return qtranxf_use($lang, $value);
        }
    } elseif (function_exists('pll_translate_string') && function_exists('pll__')) {
        if (empty($lang)) {
            return pll__($value);
        } else {
            return pll_translate_string($value, $lang);
        }
    } else {
        return $value;
    }
}
Exemplo n.º 20
0
/**
 * Header text
 */
function west_header_text()
{
    if (!function_exists('pll_register_string')) {
        $header_text = get_theme_mod('header_text', 'TIME TO GO WEST');
        $button_left = get_theme_mod('button_left', 'Explore');
        $button_right = get_theme_mod('button_right', 'Browse');
    } else {
        $header_text = pll__(get_theme_mod('header_text', 'TIME TO GO WEST'));
        $button_left = pll__(get_theme_mod('button_left', 'Explore'));
        $button_right = pll__(get_theme_mod('button_right', 'Browse'));
    }
    $button_left_url = get_theme_mod('button_left_url', '#primary');
    $button_right_url = get_theme_mod('button_right_url', '#primary');
    echo '<div class="header-info">
			<div class="header-info-inner">
				<h3 class="header-text">' . wp_kses_post($header_text) . '</h3>
				<div class="header-buttons">';
    if ($button_left_url) {
        echo '<a class="button header-button left-button" href="' . esc_url($button_left_url) . '">' . esc_html($button_left) . '</a>';
    }
    if ($button_right_url) {
        echo '<a class="button header-button right-button" href="' . esc_url($button_right_url) . '">' . esc_html($button_right) . '</a>';
    }
    echo '</div>';
    echo '</div>';
    echo '</div>';
}
Exemplo n.º 21
0
Arquivo: api.php Projeto: uoyknaht/kc
 function icl_t($context, $name, $string)
 {
     return pll__($string);
 }
Exemplo n.º 22
0
    /**
     * outputs [filtered] films list
     */
    function outputFilmsList($the_query)
    {
        // print_r($the_query);exit;
        global $staticVars;
        ob_start();
        ?>

       <?php 
        if ($the_query->post_count < 1) {
            ?>
            <div class="empty-lithfilm-output-list">
                <p><?php 
            pll_e('Pagal pasirinktus paieškos kriterijus filmų nerasta');
            ?>
</p>
            </div>
        <?php 
        } else {
            ?>

            <?php 
            if (!isset($_GET['do']) && $this->options[$this->optionSlugSeparateHomeFilmsByType] && get_the_ID() == $staticVars['lithuanianFilmsSearchPageId']) {
                // home landing page, need to show all posts separated by film type
                $output = array();
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    $postTaxonomies = wp_get_post_terms(get_the_ID(), $this->fields['type']['taxonomySlug']);
                    foreach ($postTaxonomies as $key2 => $val2) {
                        // print_r($val2);exit;
                        if (!isset($output[$val2->term_id])) {
                            // doing nice hack:
                            if (pll_current_language('slug') == 'en') {
                                $name = $val2->name . ' films';
                            } else {
                                $name = substr($val2->name, 0, -1) . 'ai filmai';
                            }
                            $output[$val2->term_id] = array('name' => $name, 'content' => '');
                        }
                        $output[$val2->term_id]['content'] .= $this->outputSingleFilmInList();
                    }
                }
                ksort($output);
                // print_r($output);exit;
                // 1.  Pakeisti titulinio puslapio filmų išdėstymo tvarką į:
                // a.  Vaidybiniai
                // b.  Dokumentiniai
                // c.  Animaciniai
                // d.  Eksperimentiniai
                // no other way but hardcode
                $output2 = array();
                if (pll_current_language('slug') == 'en') {
                    $sortedIds = array(130, 129, 128, 135);
                } else {
                    $sortedIds = array(40, 41, 42, 134);
                }
                foreach ($sortedIds as $val) {
                    $output2[] = $output[$val];
                    unset($output[$val]);
                }
                // if remains types unmentioned in the sorted order
                if (!empty($output)) {
                    foreach ($output as $val) {
                        $output2[] = $val;
                    }
                }
                foreach ($output2 as $key => $val) {
                    ?>
                    <h2 class="lithfilm-type-heading"><?php 
                    echo $val['name'];
                    ?>
</h2>
                    <ul class="lithfilm-list-wrap clearfix">
                        <?php 
                    echo $val['content'];
                    ?>
                    </ul>
                <?php 
                }
            } else {
                ?>

                <div class="lith-film-list-header">
                    <p><?php 
                echo pll__('Rasta filmų') . ': ' . $the_query->post_count;
                ?>
</p>
                </div>

                <ul class="lithfilm-list-wrap clearfix">
                    <?php 
                //print_r($the_query);exit;
                ?>
                <?php 
                while ($the_query->have_posts()) {
                    $the_query->the_post();
                    echo $this->outputSingleFilmInList();
                }
                ?>
                </ul>
            <?php 
            }
            ?>



        <?php 
        }
        ?>

        <?php 
        //kcsite_nice_pagination($the_query->max_num_pages);
        ?>

        <?php 
        $output = ob_get_clean();
        return $output;
    }
Exemplo n.º 23
0
 /**
  * Retrieve a translated string from the translation plugin.
  *
  * @param string $text The string to get the translated content for from the multilingual plugin.
  * @return string
  */
 public function translate($text)
 {
     return pll__($text);
 }
Exemplo n.º 24
0
<section id="news" class="page-section no-pad light-bg border-tb">
	<div class="container-fluid who-we-are">
		<div class="row">
			<div class="col-md-5 no-pad animated fadeInLeft visible" data-animation="fadeInLeft">
				<?php 
echo do_shortcode(get_posts('tag=home-news-video')[0]->post_content);
?>
			</div>
			<div class="col-md-7">
				<div class="row">
					<div class="col-xs-9 news-list">

						<div class="section-title text-left animated fadeInUp visible" data-animation="fadeInUp">
							<!-- Title -->
							<h2 class="title"><?php 
echo strtoupper(pll__('News'));
?>
</h2>
						</div>
						<!-- Content -->
						<div data-animation="fadeInDown" class="animated fadeInDown visible">
							<ul class="list-group widget">
								<?php 
foreach (get_posts(array('category_name' => 'news' . CAT_LANG_SUFFIX, 'posts_per_page' => -1)) as $index => $post) {
    ?>
								<li class="item">
									<div class="title clearfix row">
										<div class="col-sm-9 ellipsis"><a href="<?php 
    echo get_the_permalink($post->ID);
    ?>
"><?php 
Exemplo n.º 25
0
			</ul>
		</div>
	</aside>
	<?php 
}
?>


    <?php 
wp_reset_postdata();
global $staticVars;
global $g_lithuanianFilms;
if (get_the_ID() == $staticVars['lithuanianFilmsSearchPageId'] || get_post_type() == $g_lithuanianFilms->cptSlug) {
    echo do_shortcode('[lithuanian_films_paieskos_forma]');
}
the_widget('TribeEventsListWidget', array("title" => pll__('Artimiausi renginiai')), array('before_title' => '<header class="upcoming-events-header"><h3 class="widget-title">', 'after_title' => '</h3></header>', 'before_widget' => '<aside class="widget clearfix upcoming-events">', 'after_widget' => '</aside>'));
?>
 

	<hr class="double-hr" />

	<?php 
kcsite_sidebar_poll();
?>

	<ul class="sidebar-right-banners widget">
		<?php 
$lang_slug = kcsite_get_lang_slug();
$banners_number_option = of_get_option('kcsite_right_sidebar_banners_number' . $lang_slug);
$banners_number = intval(is_numeric($banners_number_option) && $banners_number_option > 0 ? $banners_number_option : 0);
for ($i = 0; $i < $banners_number; $i++) {
Exemplo n.º 26
0
/**
 * Provides translation support for plugins such as WPML for theme_mods
 *
 * @since 1.6.3
 */
function wpex_translate_theme_mod($id, $val = '')
{
    // Translate theme mod val
    if ($val) {
        // WPML translation
        if (function_exists('icl_t') && $id) {
            $val = icl_t('Theme Mod', $id, $val);
        }
        // Polylang Translation
        if (function_exists('pll__') && $id) {
            $val = pll__($val);
        }
        // Return the value
        return $val;
    }
}
Exemplo n.º 27
0
 /**
  * Translates Woocommerce email subjects and headings content to the order language.
  *
  * @param string   $string      Subject or heading not translated
  * @param WC_Order $order       Order object
  * @param string   $string_type Type of string to translate <subject | heading>
  * @param string   $email_type  Email template
  *
  * @return string Translated string, returns the original $string on error
  */
 public function translateEmailStringToOrderLanguage($string, $order, $string_type, $email_type)
 {
     if (empty($order)) {
         return $string;
         // Returns the original $string on error (no order to get language from)
     }
     // Get order language
     $order_language = pll_get_post_language($order->id, 'locale');
     if ($order_language == '') {
         $order_language = pll_current_language('locale');
     }
     // Get setting used to register string in the Polylang strings translation table
     $_string = $string;
     // Store original string to return in case of error
     if (false == ($string = $this->getEmailSetting($string_type, $email_type)) && !isset($this->default_settings[$email_type . '_' . $string_type])) {
         return $_string;
         // No setting in Polylang strings translations table nor default string found to translate
     }
     // Switch language
     $this->switchLanguage($order_language);
     if ($string) {
         // Retrieve translation from Polylang Strings Translations table
         $string = pll__($string);
     } else {
         // If no user translation found in Polylang Strings Translations table, use WooCommerce default translation
         $string = __($this->default_settings[$email_type . '_' . $string_type], 'woocommerce');
     }
     $find = array();
     $replace = array();
     $find['order-date'] = '{order_date}';
     $find['order-number'] = '{order_number}';
     $find['site_title'] = '{site_title}';
     $replace['order-date'] = date_i18n(wc_date_format(), strtotime($order->order_date));
     $replace['order-number'] = $order->get_order_number();
     $replace['site_title'] = get_bloginfo('name');
     $string = str_replace($find, $replace, $string);
     return $string;
 }
Exemplo n.º 28
0
echo pll__('Full name');
?>
</lable>
	</div>
	<div class="input-row">
		<input class="form-input" name="fphone" type="text" placeholder="<?php 
echo mb_strtoupper(pll__('Phone'));
?>
"/>
		<lable for="phone" class="lable"><?php 
echo pll__('Phone');
?>
</lable>
	</div>
	<div class="input-row">
		<input class="form-input" name="femail" type="text" placeholder="<?php 
echo mb_strtoupper(pll__('Email'));
?>
"/>
		<lable for="email" class="lable"><?php 
echo pll__('Email');
?>
</lable>
	</div>

	<button class="form-submit"><?php 
pll_e('Send');
?>
</button>

</form>
Exemplo n.º 29
0
 /**
  * Translate the payment method in Thank You and Order View pages.
  *
  * @param array    $total_rows Array of the order item totals
  * @param WC_Order $order      Order object
  *
  * @return array Order item totals with translated payment method
  */
 public function translateWoocommerceOrderPaymentMethod($total_rows, $order)
 {
     if (isset($total_rows['payment_method']['value'])) {
         $total_rows['payment_method']['value'] = function_exists('pll__') ? pll__($total_rows['payment_method']['value']) : __($total_rows['payment_method']['value'], 'woocommerce');
     }
     return $total_rows;
 }
Exemplo n.º 30
0
	<div class="container">
		<h2><?php 
the_category();
?>
</h2>
	</div>
</section>
<section class="breadcrumb-box">
	<div class="container">
		<ul class="breadcrumb">
			<li>
				<a href="<?php 
echo site_url();
?>
"><?php 
echo pll__('Home');
?>
</a> <span>》</span>
			</li>
			<li>
				<?php 
the_category();
?>
			</li>
		</ul>
	</div>
</section>
<!-- <img src="<?php 
echo get_stylesheet_directory_uri();
?>
/img/pages/ebest网站-v7-04.jpg"> -->