当前位置: 首页>>代码示例>>PHP>>正文


PHP osc_get_locales函数代码示例

本文整理汇总了PHP中osc_get_locales函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_get_locales函数的具体用法?PHP osc_get_locales怎么用?PHP osc_get_locales使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osc_get_locales函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: osc_locale_currency_format

function osc_locale_currency_format()
{
    $aLocales = osc_get_locales();
    $cLocale = $aLocales[0];
    foreach ($aLocales as $locale) {
        if ($locale['pk_c_code'] == osc_current_user_locale()) {
            $cLocale = $locale;
            break;
        }
    }
    return $cLocale['s_currency_format'];
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:12,代码来源:hLocale.php

示例2: update

 /**
  * Generate and updates mails.
  * @param  String $template HTML template to serve as a base.
  * @param  Array $data      New datas for emails and footer to use
  *                          to generate and update emails in oc_t_pages.
  * @return int 				Number of locales updated.
  */
 public function update($template, $id, $newDatas, $nEmail)
 {
     $m = new Mustache_Engine();
     $activeLocales = Madhouse_Utils_Collections::getFieldsFromList(osc_get_locales(), "pk_c_code");
     if ($nEmail["s_internal_name"] == "exemple_page") {
         mdh_error_log(array($nEmail));
     }
     $i = 0;
     foreach ($nEmail["locales"] as $l) {
         // Find the correct footer content.
         $footer = Madhouse_Utils_Collections::findByField($newDatas["footer"]["locales"], "fk_c_locale_code", $l["fk_c_locale_code"]);
         if (in_array($l["fk_c_locale_code"], $activeLocales) && !Madhouse_EmailMagick_Utils::isLocaleEmpty($l)) {
             // Updates the description using DAO method.
             Page::newInstance()->updateDescription($id, $l["fk_c_locale_code"], $l["s_title"], $m->render($template, array("CONTENT" => $l["s_text"], "TITLE" => $l["s_title"], "EXCERPT" => $l["s_excerpt"], "FOOTER" => $footer["s_text"])));
             $i++;
         }
     }
     return $i;
 }
开发者ID:bomvendador,项目名称:soroka_r,代码行数:26,代码来源:Emails.php

示例3: update

 /**
  * Generates emails from the templates & datas.
  *  - For each emails and for each active locale :
  *  	- Check if the emails is empty or does not exists anymore. If so, do nothing.
  *  	- Combines templates and datas to produce the s_title and s_text fields.
  * 	- Saves those settings for next run.
  * @return void.
  */
 public function update()
 {
     // Decode and transform into a PHP array (true as a second parameter).
     $data = json_decode(Params::getParam("email_datas", false, false), true);
     if (!is_array($data)) {
         mdh_handle_error(sprintf(__("Given JSON datas are not correct (Error #%d)", mdh_current_plugin_name()), json_last_error()), mdh_emailmagick_url());
     }
     // Get the HTML template.
     $template = Params::getParam("email_template", false, false);
     // This is current emails datas (stored in the database).
     $currentDatas = json_decode(osc_get_preference("email_datas", mdh_current_preferences_section()), true);
     // Create a new array, merge of the old and the new one.
     $newDatas = array("emails" => array(), "footer" => array("locales" => Madhouse_EmailMagick_Utils::mergeLocales($currentDatas["footer"]["locales"], $data["footer"]["locales"])));
     // Iterate through new submitted emails data to update.
     $i = 0;
     foreach ($data["emails"] as $e) {
         // Get the old email datas, as they are right now.
         $oe = Madhouse_Utils_Collections::findByField($currentDatas["emails"], "s_internal_name", $e["s_internal_name"]);
         if (is_null($oe)) {
             // Not found in old emails. => new email has been installed.
             $locales = $e["locales"];
         } else {
             // Found in old emails. Merge with new locales.
             $locales = Madhouse_EmailMagick_Utils::mergeLocales($oe["locales"], $e["locales"]);
         }
         // Email exists, create in order to be filled and pushed to the new datas (at the end).
         $nEmail = array("s_internal_name" => $e["s_internal_name"], "locales" => $locales);
         // Get the email from the database.
         $email = Page::newInstance()->findByInternalName($e["s_internal_name"]);
         if ($email !== false && count($email) > 0) {
             // Update the email.
             $updated = Madhouse_EmailMagick_Models_Emails::newInstance()->update($template, $email["pk_i_id"], $newDatas, $nEmail);
             $i += $updated;
         }
         array_push($newDatas["emails"], $nEmail);
     }
     // Saves the settings.
     Madhouse_Utils_Controllers::doSettingsPost(array("email_template", "email_datas"), array("email_template" => $template, "email_datas" => json_encode($newDatas)), mdh_emailmagick_url(), null, sprintf(__("Sucessfully updated %d emails (out of %d)!", mdh_current_plugin_name()), $i, count($data["emails"]) * count(osc_get_locales())));
 }
开发者ID:bomvendador,项目名称:soroka_r,代码行数:47,代码来源:Admin.php

示例4: computeFillingRate

 /**
  * Computes the filling rate (percentage) of an email.
  * @param  Email $e  The email to compute the filling rate for.
  * @return Int    	 An integer, from 0 to 100%.
  */
 public static function computeFillingRate($e)
 {
     $activeLocales = Madhouse_Utils_Collections::getFieldsFromList(osc_get_locales(), "pk_c_code");
     // Make some calculation on ACTIVES locales.
     // (non-active locales are not considered, see array_filter)
     $filled = array_map(function ($l) {
         $sum = 0;
         if (!empty($l["s_title"])) {
             $sum += 0.5;
         }
         if (!empty($l["s_text"])) {
             $sum += 0.5;
         }
         return $sum;
     }, array_values(array_filter($e["locales"], function ($l) use($activeLocales) {
         if (!in_array($l["fk_c_locale_code"], $activeLocales)) {
             return false;
         }
         return true;
     })));
     return ceil(array_sum($filled) * 100 / count($filled));
 }
开发者ID:bomvendador,项目名称:soroka_r,代码行数:27,代码来源:Utils.php

示例5: osc_user_info

/**
 * Gets description/information of current user
 *
 * @return string
 */
function osc_user_info($locale = "")
{
    if ($locale == "") {
        $locale = osc_current_user_locale();
    }
    $info = osc_user_field("s_info", $locale);
    if ($info == '') {
        $info = osc_user_field("s_info", osc_language());
        if ($info == '') {
            $aLocales = osc_get_locales();
            foreach ($aLocales as $locale) {
                $info = osc_user_field("s_info", $locale['pk_c_code']);
                if ($info != '') {
                    break;
                }
            }
        }
    }
    return (string) $info;
}
开发者ID:mylastof,项目名称:os-class,代码行数:25,代码来源:hUsers.php

示例6: printLocaleDescriptionPage

function printLocaleDescriptionPage($locales = null, $page = null)
{
    if ($locales == null) {
        $locales = osc_get_locales();
    }
    $aFieldsDescription = Session::newInstance()->_getForm("aFieldsDescription");
    $num_locales = count($locales);
    foreach ($locales as $locale) {
        $description = '';
        if (isset($page['locale'][$locale['pk_c_code']])) {
            $description = $page['locale'][$locale['pk_c_code']]['s_text'];
        }
        if (isset($aFieldsDescription[$locale['pk_c_code']]) && isset($aFieldsDescription[$locale['pk_c_code']]['s_text']) && $aFieldsDescription[$locale['pk_c_code']]['s_text'] != '') {
            $description = $aFieldsDescription[$locale['pk_c_code']]['s_text'];
        }
        $name = $locale['pk_c_code'] . '#s_text';
        echo '<div><label for="description">' . __('Description') . ' *</label>';
        echo '<textarea id="' . $name . '" name="' . $name . '" rows="10">' . $description . '</textarea></div>';
    }
}
开发者ID:naneri,项目名称:Osclass,代码行数:20,代码来源:functions.php

示例7: osc_get_locales

<?php

$aLocales = osc_get_locales();
?>
<!DOCTYPE html>
<html dir="ltr" lang="<?php 
echo str_replace('_', '-', osc_current_user_locale());
?>
">
    <head>
        <?php 
osc_current_web_theme_path('head.php');
?>
        <meta name="robots" content="noindex, nofollow" />
        <meta name="googlebot" content="noindex, nofollow" />
        <script type="text/javascript">
            twitter_theme.text_select_subcategory = "<?php 
_e('Select a subcategory...', 'twitter_bootstrap');
?>
" ;
            twitter_theme.category_selected_id    = "<?php 
echo item_selected_category_id();
?>
" ;
            twitter_theme.subcategory_selected_id = "<?php 
echo item_selected_subcategory_id();
?>
" ;
            twitter_theme.max_number_photos       = <?php 
echo osc_max_images_per_item();
?>
开发者ID:nsswaga,项目名称:OSClass,代码行数:31,代码来源:item-post.php

示例8: pop_item_description

 function pop_item_description()
 {
     $description = osc_item_description();
     foreach (osc_get_locales() as $locale) {
         if (Session::newInstance()->_getForm('description') != "") {
             $description_ = Session::newInstance()->_getForm('description');
             if (@$description_[$locale['pk_c_code']] != "") {
                 $description = $description_[$locale['pk_c_code']];
             }
         }
     }
     return $description;
 }
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:13,代码来源:functions.php

示例9: _e

                                <h2><?php 
_e('General Information', 'modern');
?>
</h2>
                                <div class="row">
                                    <label><?php 
_e('Category', 'modern');
?>
 *</label>
                                    <?php 
ItemForm::category_select(null, null, __('Select a category', 'modern'));
?>
                                </div>
                                <div class="row">
                                    <?php 
ItemForm::multilanguage_title_description(osc_get_locales());
?>
                                </div>
                                <?php 
if (osc_price_enabled_at_items()) {
    ?>
                                <div class="row price">
                                    <label><?php 
    _e('Price', 'modern');
    ?>
</label>
                                    <?php 
    ItemForm::price_input_text();
    ?>
                                    <?php 
    ItemForm::currency_select();
开发者ID:nsswaga,项目名称:OSClass,代码行数:31,代码来源:item-edit.php

示例10: multilanguage_form

function multilanguage_form($fields)
{
    $locales = osc_get_locales();
    $item = osc_item();
    $num_locales = count($locales);
    foreach ($locales as $locale) {
        foreach ($fields as $field) {
            if ($num_locales > 1) {
                echo '<div class="switch-locale locale-' . $locale['pk_c_code'] . '">';
            }
            multilanguage_form_create_field($locale, $field);
            if ($num_locales > 1) {
                echo '</div>';
            }
        }
    }
}
开发者ID:blairmain,项目名称:theme-realestate,代码行数:17,代码来源:functions.php

示例11: osc_item_title

 /**
  * Gets title from current item, if $locale is unspecified $locale is current user locale
  *
  * @param string $locale
  * @return string
  */
 function osc_item_title($locale = "") {
     if ($locale == "") $locale = osc_current_user_locale();
     $title = osc_item_field("s_title", $locale);
     if($title=='') {
         $title = osc_item_field("s_title", osc_language());
         if($title=='') {
             $aLocales = osc_get_locales();
             foreach($aLocales as $locale) {
                 $title = osc_item_field("s_title", @$locale['pk_c_code']);
                 if($title!='') {
                     break;
                 }
             }
         }
     }
     return (string) $title;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:23,代码来源:hItems.php

示例12: seo_sitemap_generator

function seo_sitemap_generator()
{
    $start_time = microtime(true);
    $min = 1;
    $show_items = '';
    if (Params::getParam('sitemap_items') != '') {
        $show_items = Params::getParam('sitemap_items');
    } else {
        $show_items = osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') : '';
    }
    $limit_items = '';
    if (Params::getParam('sitemap_items_limit') != '') {
        $limit_items = Params::getParam('sitemap_items_limit');
    } else {
        $limit_items = osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') : '';
    }
    $limit_items = intval($limit_items);
    $locales = osc_get_locales();
    $filename = osc_base_path() . 'sitemap.xml';
    //link sitemap
    @unlink($filename);
    //remove original sitemap
    $start_xml = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;
    file_put_contents($filename, $start_xml);
    // INDEX
    seo_sitemap_add_url(osc_base_url(), date('Y-m-d'), 'always');
    $categories = Category::newInstance()->listAll(false);
    $countries = Country::newInstance()->listAll();
    foreach ($categories as $c) {
        $search = new Search();
        $search->addCategory($c['pk_i_id']);
        if ($search->count() >= $min) {
            seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'])), date('Y-m-d'), 'hourly');
            foreach ($countries as $country) {
                if (count($countries) > 1) {
                    $search = new Search();
                    $search->addCategory($c['pk_i_id']);
                    $search->addCountry($country['pk_c_code']);
                    if ($search->count() > $min) {
                        seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'], 'sCountry' => $country['s_name'])), date('Y-m-d'), 'hourly');
                    }
                }
                $regions = Region::newInstance()->findByCountry($country['pk_c_code']);
                foreach ($regions as $region) {
                    $search = new Search();
                    $search->addCategory($c['pk_i_id']);
                    $search->addCountry($country['pk_c_code']);
                    $search->addRegion($region['pk_i_id']);
                    if ($search->count() > $min) {
                        seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'], 'sCountry' => $country['s_name'], 'sRegion' => $region['s_name'])), date('Y-m-d'), 'hourly');
                        $cities = City::newInstance()->findByRegion($region['pk_i_id']);
                        foreach ($cities as $city) {
                            $search = new Search();
                            $search->addCategory($c['pk_i_id']);
                            $search->addCountry($country['pk_c_code']);
                            $search->addRegion($region['pk_i_id']);
                            $search->addCity($city['pk_i_id']);
                            if ($search->count() > $min) {
                                seo_sitemap_add_url(osc_search_url(array('sCategory' => $c['s_slug'], 'sCountry' => $country['s_name'], 'sRegion' => $region['s_name'], 'sCity' => $city['s_name'])), date('Y-m-d'), 'hourly');
                            }
                        }
                    }
                }
            }
        }
    }
    foreach ($countries as $country) {
        $regions = Region::newInstance()->findByCountry($country['pk_c_code']);
        foreach ($regions as $region) {
            $cities = CityStats::newInstance()->listCities($region['pk_i_id']);
            $l = min(count($cities), 30);
            for ($k = 0; $k < $l; $k++) {
                if ($cities[$k]['items'] > $min) {
                    seo_sitemap_add_url(osc_search_url(array('sCountry' => $country['s_name'], 'sRegion' => $region['s_name'], 'sCity' => $cities[$k]['city_name'])), date('Y-m-d'), 'hourly');
                }
            }
        }
    }
    // ITEMS
    if ($show_items == 1) {
        $max_secure = 10000;
        $mSearch = new Search();
        $mSearch->limit(0, $limit_items);
        // fetch number of item for sitemap
        $aItems = $mSearch->doSearch();
        View::newInstance()->_exportVariableToView('items', $aItems);
        //exporting our searched item array
        if (osc_count_items() > 0) {
            $i = 0;
            while (osc_has_items() and $i < $limit_items and $i < $max_secure) {
                seo_sitemap_add_url(osc_item_url(), substr(osc_item_mod_date() != '' ? osc_item_mod_date() : osc_item_pub_date(), 0, 10), 'daily');
                $i++;
            }
        }
    }
    $end_xml = '</urlset>';
    file_put_contents($filename, $end_xml, FILE_APPEND);
    // PING SEARCH ENGINES
    seo_sitemap_ping_engines();
    $time_elapsed = microtime(true) - $start_time;
//.........这里部分代码省略.........
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:101,代码来源:sitemap.php

示例13: _e

                            <?php 
UserForm::address_text(osc_user());
?>
                        </div>
                        <div class="row ui-row-text">
                            <label for="webSite"><?php 
_e('Website', 'realestate');
?>
</label>
                            <?php 
UserForm::website_text(osc_user());
?>
                        </div>
                        <div class="row ui-row-text">
                            <?php 
UserForm::multilanguage_info(osc_get_locales(), osc_user());
?>
                        </div>
                        <div class="actions">
                            <a href="#" class="ui-button ui-button-gray js-submit"><?php 
_e("Update", 'realestate');
?>
</a>
                        </div>
                        <?php 
osc_run_hook('user_form');
?>
                    </fieldset>
                </form>
            </div>
        </div>    
开发者ID:blairmain,项目名称:theme-realestate,代码行数:31,代码来源:user-profile.php

示例14: multilanguage_title_description

 public static function multilanguage_title_description($locales = null, $item = null)
 {
     if ($locales == null) {
         $locales = osc_get_locales();
     }
     if ($item == null) {
         $item = osc_item();
     }
     $num_locales = count($locales);
     if ($num_locales > 1) {
         echo '<div class="tabber">';
     }
     foreach ($locales as $locale) {
         if ($num_locales > 1) {
             echo '<div class="tabbertab">';
         }
         if ($num_locales > 1) {
             echo '<h2>' . $locale['s_name'] . '</h2>';
         }
         echo '<div class="title">';
         echo '<div><label for="title">' . __('Title') . ' *</label></div>';
         $title = isset($item) && isset($item['locale'][$locale['pk_c_code']]) && isset($item['locale'][$locale['pk_c_code']]['s_title']) ? $item['locale'][$locale['pk_c_code']]['s_title'] : '';
         if (Session::newInstance()->_getForm('title') != "") {
             $title_ = Session::newInstance()->_getForm('title');
             if ($title_[$locale['pk_c_code']] != "") {
                 $title = $title_[$locale['pk_c_code']];
             }
         }
         self::title_input('title', $locale['pk_c_code'], $title);
         echo '</div>';
         echo '<div class="description">';
         echo '<div><label for="description">' . __('Description') . ' *</label></div>';
         $description = isset($item) && isset($item['locale'][$locale['pk_c_code']]) && isset($item['locale'][$locale['pk_c_code']]['s_description']) ? $item['locale'][$locale['pk_c_code']]['s_description'] : '';
         if (Session::newInstance()->_getForm('description') != "") {
             $description_ = Session::newInstance()->_getForm('description');
             if ($description_[$locale['pk_c_code']] != "") {
                 $description = $description_[$locale['pk_c_code']];
             }
         }
         self::description_textarea('description', $locale['pk_c_code'], $description);
         echo '</div>';
         if ($num_locales > 1) {
             echo '</div>';
         }
     }
     if ($num_locales > 1) {
         echo '</div>';
     }
 }
开发者ID:randomecho,项目名称:OSClass,代码行数:49,代码来源:Item.form.class.php

示例15: printLocaleTitle

                    <div id="left-side">
                        <?php 
printLocaleTitle(osc_get_locales());
?>
                        <div class="category">
                            <label><?php 
_e('Category');
?>
</label>
                            <?php 
ItemForm::category_two_selects();
?>
                        </div>
                        <div class="input-description-wide">
                            <?php 
printLocaleDescription(osc_get_locales());
?>
                        </div>
                        <?php 
if (osc_price_enabled_at_items()) {
    ?>
                            <div>
                                <label><?php 
    _e('Price');
    ?>
</label>
                                <?php 
    ItemForm::price_input_text();
    ?>
                                <span class="input-currency"><?php 
    ItemForm::currency_select();
开发者ID:jmcclenon,项目名称:Osclass,代码行数:31,代码来源:frm.php


注:本文中的osc_get_locales函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。