本文整理汇总了PHP中et函数的典型用法代码示例。如果您正苦于以下问题:PHP et函数的具体用法?PHP et怎么用?PHP et使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了et函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rename_column
function rename_column($table, $field, $new_name)
{
if (substr($field, -3) == '_id' || $field == 'sort') {
d()->db->exec("ALTER TABLE `" . $table . "` CHANGE COLUMN `{$field}` " . et($new_name) . " int NULL");
} elseif (substr($field, 0, 3) == 'is_') {
d()->db->exec("ALTER TABLE `" . $table . "` CHANGE COLUMN `{$field}` " . et($new_name) . " tinyint(4) NOT NULL DEFAULT 0");
} elseif (substr($field, -3) == '_at') {
d()->db->exec("ALTER TABLE `" . $table . "` CHANGE COLUMN `{$field}` " . et($new_name) . " datetime NULL");
} else {
d()->db->exec("ALTER TABLE `" . $table . "` CHANGE COLUMN `{$field}` " . et($new_name) . " text NULL, DEFAULT CHARACTER SET=utf8");
}
}
示例2: get
public function get($name, $mutilang = false)
{
if ($this->_options['queryready'] == false) {
$this->fetch_data_now();
}
if (isset($this->_future_data[$name])) {
return $this->_future_data[$name];
}
if ($mutilang && doitClass::$instance->lang != '' && doitClass::$instance->lang != '') {
if (isset($this->_data[$this->_cursor]) && isset($this->_data[$this->_cursor][doitClass::$instance->lang . '_' . $name]) && $this->_data[$this->_cursor][doitClass::$instance->lang . '_' . $name] != '') {
return $this->get(doitClass::$instance->lang . '_' . $name);
}
}
if (isset($this->_data[$this->_cursor])) {
//Item.title //Получение одного свойства
if (isset($this->_data[$this->_cursor][$name])) {
if (isset($this->_data[$this->_cursor]['admin_options']) && $this->_data[$this->_cursor]['admin_options'] != '' && $this->_safe_mode === false) {
$admin_options = unserialize($this->_data[$this->_cursor]['admin_options']);
if (isset($admin_options[$name])) {
return preg_replace_callback('/\\<img\\ssrc=\\"\\/cms\\/external\\/tiny_mce\\/plugins\\/mymodules\\/module\\.php\\?([\\@\\-\\_0-9a-zA-Z\\&]+)\\=([\\-\\_0-9a-zA-Z\\&]+)\\".[^\\>]*\\>/', create_function('$matches', 'if(isset(d()->plugins[str_replace("@","#",$matches[1])])){return d()->call(str_replace("@","#",$matches[1]),array($matches[2]));};return "";'), $this->_data[$this->_cursor][$name]);
}
}
return $this->_data[$this->_cursor][$name];
}
if (!in_array($name, doitClass::$instance->datapool['_known_fields'][$this->_options['table']])) {
//Item.user //Получение связанного объекта
$_is_column_exists = false;
if (isset($this->_data[$this->_cursor][$name . '_id'])) {
$_is_column_exists = true;
} else {
//Проверка на факт наличия столбца $name.'_id'
$columns = $this->columns();
if ($columns !== false) {
$columns = array_flip($columns);
//TODO: возможно, array_keys будет быстрее
if (isset($columns[$name . '_id'])) {
$_is_column_exists = true;
}
}
}
if ($_is_column_exists == true) {
if (!isset($this->_objects_cache[$name])) {
/* кеш собранных массивов */
$ids_array = array();
foreach ($this->_data as $key => $value) {
if (!empty($value[$name . '_id'])) {
$ids_array[$value[$name . '_id']] = true;
}
}
$ids_array = array_keys($ids_array);
$this->_objects_cache[$name] = activerecord_factory_from_table(ActiveRecord::one_to_plural($name))->order('')->where(' ' . DB_FIELD_DEL . id . DB_FIELD_DEL . ' IN (?)', $ids_array);
}
$cursor_key = $this->_objects_cache[$name]->get_cursor_key_by_id($this->_data[$this->_cursor][$name . '_id'], true);
if ($cursor_key === false) {
$trash = clone $this->_objects_cache[$name];
return $trash->limit('0')->where('false');
}
return $this->_objects_cache[$name][$cursor_key];
}
//Item.users
//1. Поиск альтернативных подходящих столбцов
//TODO: удалить позже
$foundedfield = false;
//ищем поле item_id в таблице users
//??щем таблицу с названием $name (например, users)
$columns = $this->columns($name);
if ($columns === false && $name == 'template') {
return '';
//template - ключевое частозапрашиваемое поле, данный оборот ускорит работу
}
/*
DEPRECATED - лишние запросы
if ($columns===false) {
$_tmpael = activerecord_factory_from_table($this->_options["table"]);
return $_tmpael->find_by('url',$name);
}
*/
//при запросе users возможны несколько случаев
//Четрые варианта: 1. есть И user_id, 2. и (3. или) users_to_groups, 4. только вспомогательная таблица
//При запросе users_over_memberships преобразуем $name в users
$over_position = strpos($name, '_over_');
if ($over_position !== false) {
$over_method = substr($name, $over_position + 6);
$name = substr($name, 0, $over_position);
$_tmpael = activerecord_factory_from_table($name);
$second_table_column = ActiveRecord::plural_to_one(strtolower($name)) . '_id';
//Проверка на факт наличия таблицы users_to_groups
$ids_array = $this->{$over_method}->select($second_table_column)->to_array;
$ids = array();
foreach ($ids_array as $key => $value) {
$ids[] = $value[$second_table_column];
}
return $_tmpael->where("`id` IN (?)", $ids);
} else {
$many_to_many_table = $this->calc_many_to_many_table_name($name, $this->_options['table']);
$many_to_many_table_columns = $this->columns($many_to_many_table);
}
if (strpos($name, ' ') !== false) {
return '';
//.........这里部分代码省略.........
示例3: showListTable
function showListTable($listFields, $records, $options = array())
{
global $tableName, $schema;
?>
<table cellspacing="0" class="data sortable">
<input type='hidden' name='_tableName' class='_tableName' value='<?php
echo htmlencode($tableName);
?>
' />
<thead>
<tr class="nodrag nodrop">
<?php
displayColumnHeaders($listFields, @$options['isRelatedRecords']);
?>
</tr>
</thead>
<?php
foreach ($records as $record) {
$trStyle = applyFilters('listRow_trStyle', '', $tableName, $record);
$trClass = @$trClass == "listRowEven" ? 'listRowOdd' : 'listRowEven';
# rotate bgclass
$trClass .= ' draggable droppable';
if (@$schema['menuType'] == 'category') {
// v2.60 add CSS classes with category data for filtering categories with jquery.
$trClass .= ' category_row';
$trClass .= ' category_num_' . $record['num'];
$trClass .= ' category_parent_' . $record['parentNum'];
$trClass .= ' category_depth_' . $record['depth'];
$trClass .= ' category_lineage' . str_replace(':', '_', $record['lineage']);
// eg: lineage_6_13_14_
}
$trClass = applyFilters('listRow_trClass', $trClass, $tableName, $record);
// v2.60
print "<tr class='{$trClass}' style='{$trStyle}'>\n";
displayListColumns($listFields, $record, $options);
print "</tr>\n";
}
?>
<?php
if (count($records) == 0) {
$listFieldCount = count($listFields) + 3;
// for checkbox, modify, and erase
if (@$schema['menuType'] == 'category') {
$listFieldCount++;
}
// for extra order field
?>
<tr>
<td class="listRowOdd listRowNoResults" colspan="<?php
echo $listFieldCount;
?>
">
<?php
if (!@$_REQUEST['search']) {
?>
<?php
et('Sorry, no records were found!');
?>
<?php
}
?>
<?php
if (@$_REQUEST['search']) {
?>
<?php
et('Sorry, the <b>search</b> returned no results!');
?>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
示例4: et
?>
</a></td>
<?php
}
}
?>
</tr>
<?php
}
?>
<tr style="display: none"><td></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="noUploads" style="display: none; width: 100%">
<tr><td style="text-align: center; padding: 30px"><?php
et('There are no files uploaded for this record.');
?>
</td></tr>
</table>
<script type="text/javascript"><!-- // language strings
lang_confirm_erase_image = '<?php
echo addslashes(t("Remove file: %s"));
?>
';
//--></script>
<script type="text/javascript" src="lib/admin_functions.js?<?php
echo filemtime(SCRIPT_DIR . '/lib/admin_functions.js');
// on file change browsers should no longer use cached versions
?>
"></script>
示例5: t
<?php
if ($row['tableName'] == 'accounts') {
?>
<td width="11%" style="text-align:center; color: #666"><?php
echo t('erase');
?>
</td>
<?php
} else {
?>
<td width="11%" style="text-align:center"><a href="javascript:confirmEraseTable('<?php
echo urlencode($row['tableName']);
?>
')"><?php
et('erase');
?>
</a></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
示例6: urlencode
<option value=''> </option>
<?php
if ($CURRENT_USER['isAdmin']) {
?>
<option value="?menu=database&action=editTable&tableName=<?php
echo urlencode($tableName);
?>
"><?php
et('Admin: Edit Section');
?>
</option>
<option value="?menu=_codeGenerator&tableName=<?php
echo urlencode($tableName);
?>
"><?php
et('Admin: Code Generator');
?>
</option>
<?php
}
?>
</select>
<input class="button" type="submit" name="_advancedActionSubmit" value=" go " onclick="$('form').ajaxFormUnbind();" />
<br />
<?php
}
?>
</div>
<div style="float:right">
示例7: disableAutocomplete
" tabindex="2" <?php
disableAutocomplete();
?>
/>
</p>
<p>
<input class="button" type="submit" name="login" value="<?php
et('Login');
?>
" tabindex="4" />
</p>
<p>
<a href="?menu=forgotPassword"><?php
et('Forgot your password?');
?>
</a>
</p>
<?php
$content = ob_get_clean();
// get cached output
$content = applyFilters('login_content', $content);
echo $content;
?>
<div class="clear"></div>
</div> <!-- End .tab-content -->
</div> <!-- End .content-box-content -->
示例8: confirmRestoreDatabase
//
function confirmRestoreDatabase() {
var backupFile = $('#restore').val();
// error checking
if (backupFile == '') { return alert('<?php
et('No backup file selected!');
?>
'); }
// request confirmation
if (!confirm("<?php
et('Restore data from this backup file?');
?>
\n" +backupFile+ "\n\n<?php
et('WARNING: BACKUP DATA WILL OVERWRITE EXISTING DATA!');
?>
")) { return; }
//
redirectWithPost('?', {
'menu': 'admin',
'action': 'restore',
'file': backupFile,
'_CSRFToken': $('[name=_CSRFToken]').val()
});
}
//--></script>
示例9: getTableRow
function getTableRow($record, $value, $formType)
{
global $TABLE_PREFIX;
// load access list
$accessList = array();
if (@$_REQUEST['num']) {
$query = "SELECT * FROM `{$TABLE_PREFIX}_accesslist` WHERE userNum = '" . mysql_escape($_REQUEST['num']) . "'";
$result = mysql_query($query) or die("MySQL Error: " . htmlencode(mysql_error()) . "\n");
while ($record = mysql_fetch_assoc($result)) {
$accessList[$record['tableName']] = $record;
}
}
// get section list
$sectionList = array();
foreach (getSchemaTables() as $tableName) {
$schema = loadSchema($tableName);
$allowedMenuTypes = array('single', 'multi', 'category', 'menugroup', 'link', 'custom');
if (!in_array(@$schema['menuType'], $allowedMenuTypes)) {
continue;
}
$thisMenu = array();
$thisMenu['menuName'] = htmlencode($schema['menuName']);
if (@$schema['menuType'] != 'menugroup') {
$thisMenu['menuName'] = ' ' . $thisMenu['menuName'];
}
if (@$schema['_indent']) {
$thisMenu['menuName'] = ' ' . $thisMenu['menuName'];
}
$thisMenu['menuOrder'] = $schema['menuOrder'];
$thisMenu['tableName'] = $tableName;
$thisMenu['menuType'] = $schema['menuType'];
array_push($sectionList, $thisMenu);
}
uasort($sectionList, '_sortMenusByOrder');
// sort menus by order value
// display field
$allAccessLevel = @$accessList['all']['accessLevel'];
$sectionsDivStyle = $allAccessLevel != 1 ? "display: none;" : '';
//
ob_start();
?>
<tr>
<td valign="top" style="padding-top: 2px"><?php
echo $this->label;
?>
</td>
<td>
<table border="0" cellspacing="1" cellpadding="0">
<thead>
<tr>
<th width="305"><?php
et('Section Name');
?>
</th>
<th width="115" style="text-align: center"><?php
et('Access');
?>
</th>
<th width="100" style="text-align: center"><?php
et('Max Records');
?>
</th>
</tr>
</thead>
<tr>
<td class="listRow listRowOdd"><?php
et('All Sections');
?>
</td>
<td class="listRow listRowOdd" style="text-align: center">
<select name="accessList[all][accessLevel]" style="width: 140px" onchange="(this.value=='1') ? $('.sectionAccessList').slideDown() : $('.sectionAccessList').slideUp();">
<option value="0" <?php
selectedIf($allAccessLevel, '0');
?>
><?php
et('None');
?>
</option>
<option value="3" <?php
selectedIf($allAccessLevel, '3');
?>
><?php
et('Viewer');
?>
</option>
<option value="6" <?php
selectedIf($allAccessLevel, '6');
?>
><?php
et('Author');
?>
</option>
<option value="7" <?php
selectedIf($allAccessLevel, '7');
?>
><?php
eht('Author & Viewer');
?>
</option>
//.........这里部分代码省略.........
示例10: foreach
</b>
<?php
}
?>
</div>
<!-- upload fields -->
<br/>
<?php
if ($uploadsRemaining) {
?>
<?php
foreach (range(1, (int) min($uploadsRemaining, $maxUploadFields)) as $count) {
?>
<?php
et("Upload File");
?>
<input type="file" name="upload<?php
echo $count;
?>
" size="50" style="vertical-align: middle;" /><br />
<?php
}
?>
<?php
}
?>
<?php
printf(t("%s seconds"), showExecuteSeconds());
?>
示例11: et
<div style="float:left">
<select class="listAdvancedCmds" name="do">
<option value=''><?php
et('Advanced Commands...');
?>
</option>
<option value=''> </option>
<option value="enableSystemFieldEditing"><?php
et('Enable System Field Editing');
?>
</option>
<option value="disableSystemFieldEditing"><?php
et('Disable System Field Editing');
?>
</option>
</select>
<input class="button" type="submit" name="_advancedActionSubmit" value=" <?php
echo t('go');
?>
" />
<br />
</div>
<div style="float:right">
<input class="button" type="submit" name="action=listTables" value="<< <?php
echo t('Back');
?>
示例12: cg2_code_loadLibraries
function cg2_code_loadLibraries()
{
$libDirPath = $GLOBALS['PROGRAM_DIR'] . "/lib/";
$escapedLibDirPath = dirname(dirname($libDirPath));
$escapedLibDirPath = str_replace('\\', '\\\\', $escapedLibDirPath);
# escape \\ for UNC paths (eg: \\SERVER/www/index.php)
$programDirName = basename($GLOBALS['PROGRAM_DIR']);
?>
// load viewer library
$libraryPath = '<?php
echo $programDirName;
?>
/lib/viewer_functions.php';
$dirsToCheck = array('<?php
echo $escapedLibDirPath;
?>
/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("<?php
et("Couldn't load viewer library, check filepath in sourcecode.");
?>
"); }
<?php
}
示例13: cg2_categorypage_ajaxJsCode
function cg2_categorypage_ajaxJsCode()
{
$ajaxUrl = "?menu=" . @$_REQUEST['menu'] . "&_generator=" . @$_REQUEST['_generator'] . "&_ajax=schemaFields";
?>
<script type="text/javascript">
$(document).ready(function() {
// register change event
$('select[name=tableName]').live('change', function() {
cg2_updateSchemaFieldPulldowns('defaultCategoryNum');
cg2_updateSchemaFieldPulldowns('rootCategoryNum');
});
});
//
function cg2_updateSchemaFieldPulldowns(fieldname) {
var tableName = $('select[name=tableName]').val(); // get tableName
var jSelector = 'select[name='+fieldname+']';
// show loading... for all pulldowns
$(jSelector).html("<option value=''><?php
et('loading...');
?>
</option>");
// load schema fields
var ajaxUrl = '<?php
echo $ajaxUrl;
?>
&tableName=' + tableName + '&fieldname=' + fieldname;
$.ajax({
url: ajaxUrl,
cache: false,
dataType: 'html',
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("There was an error sending the request! (" + XMLHttpRequest['status'] + " " + XMLHttpRequest['statusText'] + ")\n" + errorThrown);
},
success: function(optionsHTML) {
console.log(fieldname);
if (optionsHTML != '' && !optionsHTML.match(/^<option/)) { return alert("Error loading field list!\n" + optionsHTML); }
$(jSelector).html(optionsHTML);
}
});
}
</script>
<?php
}
示例14: jsencode
echo jsencode(CMS_ASSETS_URL);
?>
"; }
else {
alert("phpConstant: Unknown constant name '" +cname+ "'!");
return '';
}
}
</script>
<body class="simpla">
<div id="body-wrapper"> <!-- Wrapper for the radial gradient background -->
<?php
include "lib/menus/sidebar.php";
?>
<div id="main-content"> <!-- Main Content Section with everything -->
<noscript> <!-- Show a notification if the user has disabled javascript -->
<div class="notification error png_bg">
<div><?php
et("Javascript is disabled or is not supported by your browser. Please upgrade your browser or enable Javascript to navigate the interface properly.");
?>
</div>
</div>
</noscript>
<?php
displayAlertsAndNotices();
示例15: et
</a>
<?php
}
?>
<?php
}
?>
</div>
<div style="float: right">
<input class="button" type="submit" name="_action=uploadModify" value="<?php
et('Save');
?>
" />
<input class="button" type="button" onclick="self.parent.tb_remove()" value="<?php
et('Cancel');
?>
" />
</div>
<?php
printf(t("%s seconds"), showExecuteSeconds());
?>
</div>
</div>
</form>
</body>