本文整理汇总了PHP中CMS::lang方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::lang方法的具体用法?PHP CMS::lang怎么用?PHP CMS::lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::lang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: value
public function value()
{
$value = parent::value();
if (empty($value)) {
return '';
}
$value = (string) CMS::lang($value);
return $value;
}
示例2: form_fields
public function form_fields($form, $name, $parms)
{
$items = isset($parms['__items']) ? $parms['__items'] : CMS::items_for_select($parms['items']);
$iobjects = array();
foreach ($items as $id => $title) {
$iobjects[] = (object) array('id' => $id, 'title' => CMS::lang($title));
}
$form->object_multi_select($name, $iobjects);
}
示例3: view_value
public function view_value($value, $name, $data)
{
$path = is_string($value) ? $value : $value[$name];
$path = trim($path);
if ($path == '') {
return '';
}
$caption = CMS::lang()->_common->ta_download;
$url = $this->uploaded_url($path);
return "<a href='{$url}'>{$caption}</a>";
}
示例4: form_validator
public function form_validator($form, $name, $data)
{
$message = CMS::lang()->_common->captcha_error;
if (isset($data['error_message'])) {
$message = $data['error_message'];
}
if (isset($data['validate_error_message'])) {
$message = $data['validate_error_message'];
}
$this->validator($form)->validate_digital_protect($name, $message);
}
示例5: lang_select_items
static function lang_select_items($with_all = true)
{
$out = array();
if ($with_all) {
$out['all'] = CMS::lang()->_common->all_languages;
}
foreach (self::langs() as $lang => $data) {
if (is_string($data)) {
$data = array('caption' => $data);
}
$out[$lang] = $data['caption'];
}
return $out;
}
示例6: read_item
public function read_item($title, $item)
{
$title = CMS::lang($title);
if (is_string($item)) {
$item = array('url' => trim($item));
}
if (isset($item['title'])) {
$title = trim($item['title']);
}
if (isset($item['navigation_id'])) {
$item['id'] = trim($item['navigation_id']);
}
$url = $item['url'];
$url1 = $item['url'];
Events::call('cms.navigation.add', $title, $item, $url);
if ($url1 != $url) {
$item['url'] = $url;
}
return parent::read_item($title, $item);
}
示例7: title
public function title()
{
return CMS::lang()->_vars->file;
}
示例8: add
public function add($title, $item)
{
if (!Core_Types::is_iterable($item)) {
$item = array('uri' => $item, 'url' => $item);
}
if (isset($item['title'])) {
$title = $item['title'];
}
$title = CMS::lang($title);
//Events::dispatch('cms.navigation.add', $ev = Events::Event(array('title' => $title, 'data' => $item, 'url' => $item['url'])));
//$title = $ev['title'];
//$item = $ev['data'];
//$item['url'] = $ev['url'];
$url = $item['url'];
Events::call('cms.navigation.add', $title, $item, $url);
$item['url'] = $url;
$access = isset($item['access']) ? trim($item['access']) : '';
if ($access != '' && !CMS::check_globals_or($access)) {
return $this;
}
if (isset($item['disabled'])) {
if (CMS::check_yes($item['disabled'])) {
return $this;
}
}
$uri = '';
if (isset($item['uri'])) {
$uri = $item['uri'];
}
if (isset($item['url'])) {
$uri = $item['url'];
}
$id = isset($item['id']) ? $item['id'] : md5($title . $uri);
if (isset($item['navigation_id'])) {
$id = trim($item['navigation_id']);
}
$selected = false;
$disabled = false;
if (isset($item['match'])) {
if (preg_match($item['match'], CMS_Navigation3::$uri)) {
$selected = true;
}
}
if (isset($item['flag'])) {
if (CMS::$navigation->is_flag($item['flag'])) {
$selected = true;
}
}
if ($uri == CMS_Navigation3::$uri) {
$selected = true;
}
$item['selected'] = $selected;
$item['disabled'] = $disabled;
$sub = isset($item['sub']) ? $item['sub'] : null;
if (is_string($sub)) {
$sub = trim($sub);
$_component = $sub;
$_parms = $uri;
if ($m = Core_Regexps::match_with_results('{^([^\\s]+)\\s+(.+)$}', $sub)) {
$_component = trim($m[1]);
$_parms = trim($m[2]);
}
if (CMS::component_exists($_component)) {
$_class = CMS::$component_names[$_component];
$_classref = Core_Types::reflection_for($_class);
$sub = $_classref->hasMethod('navigation_tree') ? $_classref->getMethod('navigation_tree')->invokeArgs(NULL, array($_parms, $item)) : false;
}
}
if (Core_Types::is_iterable($sub)) {
$set = new CMS_Navigation3_LinkSet();
$set->level_num = $this->level_num + 1;
$set->process($sub);
$this->link($id, $uri, $title, $item, $set);
} else {
$this->link($id, $uri, $title, $item);
}
return $this;
}
示例9: render
public function render()
{
if (!$this->type->access($this->name, $this->data, 'container_render', $this->item, $this)) {
return '';
}
$value = $this->value();
if (is_null($value)) {
return '';
}
if (!is_string($value)) {
return print_r($value, true);
}
if (is_string($value) && $this->type->enable_multilang()) {
if ($this->forced_lang) {
$value = CMS::lang($value, $this->forced_lang);
} else {
$value = CMS::lang($value);
}
}
return $value;
}
示例10: node_template
public function node_template($name, $data, $items, $node_wrap_class, $caption_wrap_class, $level_up, $current_level, $top_caption)
{
$i = 0;
$size = sizeof($items);
$res = '';
foreach ($items as $key => $item) {
$suff = '';
if ($i == 0) {
$suff .= 'tree_item_first ';
}
if ($i == $size - 1) {
$suff .= 'tree_item_last ';
}
$class_active = $key == $data['__item'][$name] ? 'tree_select_caption_active' : '';
$disabled = '';
if (is_array($item) && isset($item['disabled']) && $item['disabled']) {
$disabled = "tree_select_node_disabled";
}
if (is_array($item['childs']) && !empty($item['childs'])) {
$title = CMS::lang($item['title']);
$elbow_open_icon = $level_up > $current_level ? 'tree_select_elbow_open_icon' : '';
$array_open_icon = $level_up > $current_level ? 'tree_select_array_open_icon' : '';
$sub_display = $level_up > $current_level ? 'block' : 'none';
print <<<HTML
\t\t\t\t<div class="tree_select_array {$suff}" id="{$key}">
\t\t\t\t\t<div class="tree_select_icon tree_select_elbow_icon {$elbow_open_icon}"></div>
\t\t\t\t\t<div class="tree_select_node {$disabled} tree_select_item {$node_wrap_class}">
\t\t\t\t\t\t<div class="tree_select_caption tree_select_caption_array {$caption_wrap_class} {$class_active}">
\t\t\t\t\t\t\t{$title}
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="tree_select_sub" style="display: {$sub_display}">
HTML;
print $this->node_template($name, $data, $item['childs'], $node_wrap_class, $caption_wrap_class, $level_up, $current_level + 1, $top_caption);
print <<<HTML
\t\t\t\t\t</div>
\t\t\t\t</div>
HTML;
} else {
if (is_string($item)) {
$title = CMS::lang((string) $item);
} else {
$title = CMS::lang($item['title']);
}
print <<<HTML
\t\t\t\t<div class="tree_select_one {$suff}" id="{$key}">
\t\t\t\t\t<div class="tree_select_branch"></div>
\t\t\t\t\t<div class="tree_select_node {$disabled} {$node_wrap_class}">
\t\t\t\t\t\t<div class="tree_select_caption tree_select_caption_one {$caption_wrap_class} {$class_active}">{$title}</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
HTML;
}
$i++;
}
return $res;
}
示例11: get
public function get()
{
return CMS::lang((string) $this['value']);
}
示例12: layout_preprocess
protected function layout_preprocess($l, $name, $data)
{
$item = $this->get_item($name, $data);
$l->use_scripts(CMS::stdfile_url('scripts/fields/image.js'));
$l->use_scripts(CMS::stdfile_url('scripts/jquery/block.js'));
$id = $this->url_class();
$l->with('url_class', $id);
if ($item && !$item->is_phantom()) {
$code = "; \$(function() { \$('.{$id}.field-{$name}').each(function() {\n\t\t \t\t\t\t\tTAO.fields.image.process(\$(this));\n\t\t\t\t\t\t\t}\n\t\t\t)});";
$l->append_to('js', $code);
}
Templates_HTML::add_scripts_settings(array('fields' => array($name => array('confirm' => CMS::lang()->_common->ta_diconfirm))));
return parent::layout_preprocess($l, $name, $data);
}
示例13: as_string
public function as_string()
{
return CMS::lang(parent::as_string());
}
示例14: assign_from_object
public function assign_from_object($form, $object, $name, $data)
{
$value = is_object($object) ? $object[$name] : $object;
if ($langs = $this->data_langs($data)) {
$lvalues = CMS::lang()->lang_split($value);
foreach ($langs as $lang => $ldata) {
$current_format_name = $this->name_lang($name . '_format', $lang);
$fvalues = $this->format_split($lvalues[$lang]);
foreach ($fvalues as $code => $fvalue) {
$fname = $this->get_format_name($name, $code);
$flname = $this->name_lang($fname, $lang);
$form[$flname] = $fvalue;
$form[$current_format_name] = $code;
}
if (empty($form[$current_format_name]) && !empty($current_format_name)) {
$form[$current_format_name] = reset(array_keys($this->get_formats($name, $data)));
}
}
} else {
$fvalues = $this->format_split($value);
$current_format_name = $name . '_format';
if (!empty($fvalues)) {
foreach ($fvalues as $code => $fval) {
$form[$this->get_format_name($name, $code)] = $fval;
$form[$current_format_name] = $code;
}
}
$form[$name] = $value;
}
if (empty($form[$current_format_name]) && !empty($current_format_name)) {
$form[$current_format_name] = reset(array_keys($this->get_formats($name, $data)));
}
//return parent::assign_from_object($form,$object,$name,$data);
}
示例15: process_form
protected function process_form($item)
{
$errors = parent::process_form($item);
if (isset($this->form['_name']) && sizeof($errors) == 0) {
$name = trim($this->form['_name']);
if (Core_Regexps::match('{^[a-z0-9_-]+$}i', $name)) {
return array();
}
if (Core_Regexps::match('{^[a-z0-9_-]+\\.[a-z0-9_-]+$}i', $name)) {
return array();
}
return array('_name' => CMS::lang('%LANG{en}Invalid name!%LANG{ru}Некорректный мнемокод!'));
}
return $errors;
}