本文整理汇总了PHP中Languages::GetLanguageDirection方法的典型用法代码示例。如果您正苦于以下问题:PHP Languages::GetLanguageDirection方法的具体用法?PHP Languages::GetLanguageDirection怎么用?PHP Languages::GetLanguageDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Languages
的用法示例。
在下文中一共展示了Languages::GetLanguageDirection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <info@apphp.com>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAsAdmin() && $objLogin->HasPrivileges('add_pages')) {
if (isset($_REQUEST['language_id'])) {
$language_id = prepare_input($_REQUEST['language_id']);
$objSiteDescription->LoadData($language_id);
} else {
$language_id = Languages::GetDefaultLang();
}
$wysiwyg_dir = Languages::GetLanguageDirection($language_id);
$objPage = new Pages();
$link_target = isset($_POST['link_target']) ? prepare_input($_POST['link_target']) : '_self';
$tag_title = isset($_POST['tag_title']) ? prepare_input($_POST['tag_title']) : $objSiteDescription->GetParameter('tag_title');
$tag_keywords = isset($_POST['tag_keywords']) ? prepare_input($_POST['tag_keywords']) : $objSiteDescription->GetParameter('tag_keywords');
$tag_description = isset($_POST['tag_description']) ? prepare_input($_POST['tag_description']) : $objSiteDescription->GetParameter('tag_description');
$meta_tags_status = isset($_POST['meta_tags_status']) ? prepare_input($_POST['meta_tags_status']) : 'closed';
$copy_to_other_langs = isset($_POST['copy_to_other_langs']) ? prepare_input($_POST['copy_to_other_langs']) : 'yes';
$access_level = isset($_POST['access_level']) ? prepare_input($_POST['access_level']) : '0';
$show_in_search = isset($_POST['show_in_search']) ? prepare_input($_POST['show_in_search']) : '1';
$priority_order = isset($_POST['priority_order']) ? (int) $_POST['priority_order'] : $objPage->GetMaxOrder($language_id) + 1;
$finish_publishing = isset($_POST['finish_publishing']) && check_date($_POST['finish_publishing']) ? prepare_input($_POST['finish_publishing']) : _NEVER;
$is_published = isset($_POST['is_published']) ? prepare_input($_POST['is_published']) : '1';
$submit = isset($_POST['subSavePage']) ? prepare_input($_POST['subSavePage']) : '';
$act = isset($_POST['act']) ? prepare_input($_POST['act']) : '';
$msg = '';
示例2: DrawEditMode
public function DrawEditMode($rid = '0', $buttons = array('reset' => false, 'cancel' => true))
{
$this->IncludeJSFunctions('edit');
$this->curRecordId = $rid;
$sorting_fields = self::GetParameter('sorting_fields');
$sorting_types = self::GetParameter('sorting_types');
$page = self::GetParameter('page');
$operation = self::GetParameter('operation');
$operation_type = self::GetParameter('operation_type');
$operation_field = self::GetParameter('operation_field');
$search_status = self::GetParameter('search_status');
// prepare language direction for textboxes, textareas etc..
$language_dir = @Languages::GetLanguageDirection($this->languageId);
$nl = "\n";
echo '<form name="frmMicroGrid_' . $this->tableName . '" id="frmMicroGrid_' . $this->tableName . '" action="' . $this->formActionURL . '" method="post" enctype="multipart/form-data">' . $nl;
draw_hidden_field('mg_prefix', $this->uPrefix);
echo $nl;
draw_hidden_field('mg_action', 'update');
echo $nl;
draw_hidden_field('mg_rid', $this->curRecordId);
echo $nl;
draw_hidden_field('mg_sorting_fields', $sorting_fields);
echo $nl;
draw_hidden_field('mg_sorting_types', $sorting_types);
echo $nl;
draw_hidden_field('mg_page', $page);
echo $nl;
draw_hidden_field('mg_operation', '');
echo $nl;
draw_hidden_field('mg_operation_type', '');
echo $nl;
draw_hidden_field('mg_operation_field', '');
echo $nl;
draw_hidden_field('mg_search_status', $search_status);
echo $nl;
draw_hidden_field('mg_language_id', $this->languageId);
echo $nl;
draw_hidden_field('mg_operation_code', self::GetRandomString(20));
echo $nl;
draw_token_field();
echo $nl;
// save filter (search) data for view mode
if ($this->isFilteringAllowed) {
foreach ($this->arrFilteringFields as $key => $val) {
//if($val['type'] == 'text'){
$filter_field_value = $search_status == 'active' ? self::GetParameter('filter_by_' . $val['table'] . $val['field'], false) : '';
draw_hidden_field('filter_by_' . $val['table'] . $val['field'], $filter_field_value);
echo $nl;
//}
}
}
// 1. prepare password fields
foreach ($this->arrEditModeFields as $key => $val) {
if (preg_match('/separator/i', $key) && is_array($val)) {
foreach ($val as $v_key => $v_val) {
if ($v_key != 'separator_info') {
// prepare password
if (isset($v_val['type']) && ($v_val['type'] == 'password' || $this->IsSecureField($key, $v_val))) {
$password_field = $this->UncryptValue($v_key, $v_val);
$this->EDIT_MODE_SQL = str_replace($this->tableName . '.' . $v_key, $password_field, $this->EDIT_MODE_SQL);
}
}
}
} else {
// prepare password
if (isset($val['type']) && ($val['type'] == 'password' || $this->IsSecureField($key, $val))) {
$password_field = $this->UncryptValue($key, $val);
$this->EDIT_MODE_SQL = str_replace($this->tableName . '.' . $key, $password_field, $this->EDIT_MODE_SQL);
}
}
}
$this->EDIT_MODE_SQL = str_replace('_RID_', $this->curRecordId, $this->EDIT_MODE_SQL);
if ($this->debug) {
$start_time = $this->GetFormattedMicrotime();
}
$this->result = database_query($this->EDIT_MODE_SQL, DATA_AND_ROWS);
if ($this->debug) {
$finish_time = $this->GetFormattedMicrotime();
}
if ($this->debug) {
$this->arrSQLs['select_edit_mode'] = '<i>Retrieve Edit Mode Record</i> | T: ' . round((double) $finish_time - (double) $start_time, 4) . ' sec. <br>' . $this->EDIT_MODE_SQL;
}
if (!$this->result[1]) {
if ($this->debug) {
echo $this->EDIT_MODE_SQL . '<br>' . mysql_error();
} else {
echo _WRONG_PARAMETER_PASSED;
}
return false;
}
//----------------------------------------------------------------------
// perform operations before drawing Edit Mode
$this->BeforeEditRecord();
// 1. draw hidden fields
// 2. delete files/images
foreach ($this->arrEditModeFields as $key => $val) {
if (preg_match('/separator/i', $key) && is_array($val)) {
foreach ($val as $v_key => $v_val) {
if ($v_key != 'separator_info') {
// delete file/image
//.........这里部分代码省略.........
示例3: DrawEditForm
/**
* Draws Edit Form
* @param $key
* @param $draw
*/
public function DrawEditForm($key = '0', $draw = true)
{
$total_languages = Languages::GetAllLanguages();
$key_value = $key_text = '';
$default_lang_name = 'English';
$default_lang_abbr = 'en';
$lang_to_dir = Languages::GetLanguageDirection($this->languageId);
$default_lang_text = '';
$align_left = Application::Get('lang_dir') == 'ltr' ? 'left' : 'right';
$align_right = Application::Get('lang_dir') == 'ltr' ? 'right' : 'left';
$output = '';
$sql = 'SELECT * FROM ' . TABLE_VOCABULARY . ' WHERE id = ' . (int) $key;
if ($row = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
$key_value = $row['key_value'];
$key_text = $row['key_text'];
$this->currentKey = $key_value;
}
$sql = 'SELECT * FROM ' . TABLE_LANGUAGES . ' WHERE is_default = 1';
if ($row = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
$default_lang_name = $row['lang_name'];
$default_lang_abbr = $row['abbreviation'];
$sql = 'SELECT * FROM ' . TABLE_VOCABULARY . ' WHERE key_value = \'' . $this->currentKey . '\' AND language_id = \'' . $default_lang_abbr . '\'';
if ($row = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
$default_lang_text = strip_tags($row['key_text'], '<b><i><u><br>');
}
}
if ($default_lang_abbr != $this->languageId) {
$output .= '<script type="text/javascript">
google.load("language", "1");
function TranslateText(response){
if(response.data){
jQuery("#txt_message").html("' . _COMPLETED . '!");
jQuery("#txt_key_value").val(response.data.translations[0].translatedText);
jQuery("#btnTranslate").attr("disabled", false);
}else{
//response.error.message
jQuery("#txt_message").html("This feature is only available for Google paid accounts! Please check you have a valid API Key.");
}
}
function GoAndTranslate(){';
// Block all operations in demo mode
if (strtolower(SITE_MODE) == 'demo') {
$output .= 'alert(\'' . _OPERATION_BLOCKED . '\'); return false; ';
} else {
$output .= '// grabbing the text to translate
var YOUR_API_KEY = "";
var text = jQuery("#txt_key_value").val();
if(text.indexOf(" ") <= 0) text = text.toLowerCase();
jQuery("#btnTranslate").attr("disabled", true);
jQuery("#txt_message").html("");
var newScript = document.createElement("script");
newScript.type = "text/javascript";
// WARNING: be aware that YOUR-API-KEY inside html is viewable by all your users.
// Restrict your key to designated domains or use a proxy to hide your key
// to avoid misuage by other party.
var source = "https://www.googleapis.com/language/translate/v2?key="+YOUR_API_KEY+"&source=' . $default_lang_abbr . '&target=' . $this->languageId . '&callback=TranslateText&q=" + text;
newScript.src = source;
// When we add this script to the head, the request is sent off.
document.getElementsByTagName("head")[0].appendChild(newScript);';
}
$output .= '}
</script>';
}
$output .= '<form action="index.php?admin=vocabulary" method="post">';
$output .= draw_hidden_field('submition_type', '1', false);
$output .= draw_hidden_field('key', $key, false);
$output .= draw_hidden_field('filter_by', $this->filterBy, false);
$output .= draw_hidden_field('language_id', $this->languageId, false);
$output .= draw_token_field(false);
$output .= '<table align="center" width="99%" border="0" cellspacing="0" cellpadding="3" class="main_text">
<tr valign="top">
<td><b>' . _EDIT_WORD . '</b></td>
<td><div id="txt_message" style="color:#00a600"></div></td>
<td width="20px" nowrap="nowrap"></td>
<td align="' . $align_right . '">' . draw_languages_box('language_id', $total_languages[0], 'abbreviation', 'lang_name', $this->languageId, '', 'disabled="disabled"', false) . '</td>
</tr>
<tr valign="top">
<td align="' . $align_right . '" width="90px">' . _KEY . ':</td>
<td align="' . $align_left . '" colspan="2">
' . $key_value . '
' . draw_hidden_field('txt_key', $key_value, false) . '
</td>
<td></td>
</tr>';
$output .= '<tr valign="top">
<td align="' . $align_right . '">' . _VALUE . ' <span style="color:#c13a3a">*</span>:</td>
<td align="' . $align_left . '">
<textarea dir="' . $lang_to_dir . '" style="width:100%;height:60px;overflow:auto;padding:3px;" name="txt_key_value" id="txt_key_value" maxlength="4096">' . decode_text($key_text) . '</textarea>
</td>
<td></td>
<td align="right" width="240px">';
//.........这里部分代码省略.........