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


PHP Languages::GetAllLanguages方法代码示例

本文整理汇总了PHP中Languages::GetAllLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP Languages::GetAllLanguages方法的具体用法?PHP Languages::GetAllLanguages怎么用?PHP Languages::GetAllLanguages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Languages的用法示例。


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

示例1: RewriteVocabularyFile

 public function RewriteVocabularyFile($all_languages = false)
 {
     // Block all operations in demo mode
     if (strtolower(SITE_MODE) == 'demo') {
         $this->error = _OPERATION_BLOCKED;
         return false;
     }
     $languages = Languages::GetAllLanguages(' priority_order ASC', '', !$all_languages ? ' abbreviation = \'' . $this->languageId . '\'' : '');
     $nl = "\n";
     for ($i = 0; $i < $languages[1]; $i++) {
         $this->GetVocabulary(' AND language_id = \'' . $languages[0][$i]['abbreviation'] . '\'');
         $string_data = '<?php' . $nl;
         for ($j = 0; $j < $this->vocabularySize; $j++) {
             $replace_from = array('"', '\\', '$');
             $replace_to = array('&#034;', '\\\\', '&#36;');
             $key_text = str_replace($replace_from, $replace_to, $this->keys[$j]['key_text']);
             // double slashes
             $string_data .= 'define("' . $this->keys[$j]['key_value'] . '","' . $key_text . '");' . $nl;
         }
         $string_data .= $nl . '?>';
         // Write data to the file
         $voc_file = 'include/messages.' . $languages[0][$i]['abbreviation'] . '.inc.php';
         @chmod($voc_file, 0755);
         $fh = @fopen($voc_file, 'w');
         if (!$fh) {
             $this->error = 'Cannot open vocabulary file: ' . $voc_file;
         } else {
             @fwrite($fh, $string_data);
             @fclose($fh);
         }
         @chmod($voc_file, 0644);
     }
     return true;
 }
开发者ID:mozdial,项目名称:Directory,代码行数:34,代码来源:Vocabulary.class.php

示例2: BeforeDeleteRecord

 /**
  *	After Insert Record
  */
 public function BeforeDeleteRecord()
 {
     $all_languages = Languages::GetAllLanguages('', '', 'is_active = 1');
     $this->d_languages_count = $all_languages[1];
     if ($this->d_languages_count <= 1) {
         $this->error = _LANG_DELETE_LAST_ERROR;
         return false;
     }
     // define language's abbreviation
     $sql = 'SELECT * FROM ' . TABLE_LANGUAGES . ' WHERE id = ' . (int) $this->curRecordId;
     if ($d_language = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
         $this->d_language_abbrev = $d_language['abbreviation'];
         $this->d_priority_order = $d_language['priority_order'];
     }
     return true;
 }
开发者ID:mozdial,项目名称:Directory,代码行数:19,代码来源:Languages.class.php

示例3: PageCreate


//.........这里部分代码省略.........
                            $msg_text = str_replace('_FIELD_', '<b>TITLE</b>', _FIELD_LENGTH_ALERT);
                            $msg_text = str_replace('_LENGTH_', '255', $msg_text);
                            $this->error = $msg_text;
                            $this->focusOnField = 'tag_title';
                            return false;
                        } else {
                            if (strlen($this->page['tag_keywords']) > 512) {
                                $msg_text = str_replace('_FIELD_', '<b>KEYWORDS</b>', _FIELD_LENGTH_ALERT);
                                $msg_text = str_replace('_LENGTH_', '512', $msg_text);
                                $this->error = $msg_text;
                                $this->focusOnField = 'tag_keywords';
                                return false;
                            } else {
                                if (strlen($this->page['tag_description']) > 512) {
                                    $msg_text = str_replace('_FIELD_', '<b>DESCRIPTION</b>', _FIELD_LENGTH_ALERT);
                                    $msg_text = str_replace('_LENGTH_', '512', $msg_text);
                                    $this->error = $msg_text;
                                    $this->focusOnField = 'tag_description';
                                    return false;
                                }
                            }
                        }
                    }
                }
            }
        }
        if (strtolower(SITE_MODE) == 'demo') {
            $this->error = _OPERATION_BLOCKED;
            return false;
        } else {
            if ($copy_to_other_langs == 'yes') {
                $total_languages = Languages::GetAllActive();
            } else {
                $total_languages = Languages::GetAllLanguages(' priority_order ASC', '', 'abbreviation=\'' . $this->page['language_id'] . '\'');
            }
            $page_code = get_random_string(10);
            for ($i = 0; $i < $total_languages[1]; $i++) {
                // Create new record
                $sql = 'INSERT INTO ' . TABLE_PAGES . '(
						id,
						page_code,
						language_id,
						content_type,
						link_url,
						link_target,
						page_key,
						page_title,
						page_text,
						menu_id,
						menu_link,
						tag_title,
						tag_keywords,
						tag_description,
						comments_allowed,
						show_in_search,
						date_created,
						date_updated,
						finish_publishing,
						is_published,
						is_system_page,
						system_page,
						status_changed,
						access_level,
						priority_order
					)VALUES(
						NULL,
开发者ID:mozdial,项目名称:Directory,代码行数:67,代码来源:Pages.class.php


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