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


PHP WPFB_Core::GetCustomFields方法代码示例

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


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

示例1: ParseSorting

 static function ParseSorting($sort = '', $for_cat = false)
 {
     if ($for_cat) {
         $fields =& self::$sort_fields_cat;
     } else {
         $fields =& self::$sort_fields_file;
     }
     if (is_null($fields)) {
         $fields = array_keys($for_cat ? get_class_vars('WPFB_Category') : array_merge(get_class_vars('WPFB_File'), WPFB_Core::GetCustomFields(true)));
     }
     if (!$for_cat && !empty($_REQUEST['wpfb_file_sort'])) {
         $sort = $_REQUEST['wpfb_file_sort'];
     }
     $sort = str_replace(array('&gt;', '&lt;'), array('>', '<'), $sort);
     if (($p = strpos($sort, ',')) !== false) {
         $sort = substr($sort, 0, $p);
     }
     $desc = $for_cat ? WPFB_Core::$settings->filelist_sorting_dir : false;
     if ($sort && $sort[0] == '<') {
         $desc = false;
         $sort = substr($sort, 1);
     } elseif ($sort && $sort[0] == '>') {
         $desc = true;
         $sort = substr($sort, 1);
     }
     if (!$sort || !in_array($sort, $fields)) {
         $sort = $for_cat ? 'cat_name' : WPFB_Core::$settings->filelist_sorting;
     }
     return array($sort, $desc ? 'DESC' : 'ASC');
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:30,代码来源:Output.php

示例2: SearchWhereSql

 static function SearchWhereSql($search_id3 = false, $s = null)
 {
     global $wp_query, $wpdb;
     static $search_fields;
     if (empty($search_fields)) {
         $search_fields = array_merge(array('file_name', 'file_thumbnail', 'file_display_name', 'file_description', 'file_tags', 'file_requirement', 'file_version', 'file_author', 'file_language', 'file_platform', 'file_license'), array_keys(WPFB_Core::GetCustomFields(true)));
     }
     if (empty($s)) {
         $s = empty($wp_query->query_vars['s']) ? empty($_GET['s']) ? null : stripslashes($_GET['s']) : $wp_query->query_vars['s'];
         if (empty($s)) {
             return null;
         }
     }
     $exact = !empty($wp_query->query_vars['exact']);
     $p = $exact ? '' : '%';
     $search_terms = self::getSearchTerms($s);
     $where = "(1";
     // TODO: search fields with match...
     foreach ($search_terms as $term) {
         $where .= ($not = $term[0] === '-') ? " AND NOT (" : " AND (";
         if ($not) {
             $term = substr($term, 1);
         }
         $wc = strpos($term, '*') !== false;
         // check for wildcard
         $or = '';
         foreach ($search_fields as $sf) {
             $col = "{$wpdb->wpfilebase_files}.{$sf}";
             $where .= " {$or}({$col} LIKE '" . ($wc ? str_replace('*', '%', $term) : "{$p}{$term}{$p}") . "')";
             if (empty($or)) {
                 $or = 'OR ';
             }
         }
         // !$not -> dont exclude from id3 files
         if (!$not && $search_id3) {
             $where .= " OR ({$wpdb->wpfilebase_files_id3}.keywords LIKE '{$p}{$term}{$p}')";
         }
         // TODO: MATCH func here
         $where .= ") ";
     }
     $where .= ")";
     return $where;
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:43,代码来源:Search.php

示例3: prepare_items

 function prepare_items()
 {
     global $wpdb;
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->process_bulk_action();
     $pagenum = $this->get_pagenum();
     if (!isset($filesperpage) || $filesperpage < 0) {
         $filesperpage = 50;
     }
     $pagestart = ($pagenum - 1) * $filesperpage;
     $where = $this->get_file_where_cond(empty($_REQUEST['view']) ? null : $_REQUEST['view']);
     $order = "{$wpdb->wpfilebase_files}." . (!empty($_REQUEST['orderby']) && in_array($_REQUEST['orderby'], array_merge(array_keys(get_class_vars('WPFB_File')), array_keys(WPFB_Core::GetCustomFields(true)))) ? $_REQUEST['orderby'] . " " . (!empty($_REQUEST['order']) && $_REQUEST['order'] == "desc" ? "DESC" : "ASC") : "file_id DESC");
     $total_items = WPFB_File::GetNumFiles2($where, 'edit');
     $files = WPFB_File::GetFiles2($where, 'edit', $order, $filesperpage, $pagestart);
     if (empty($files) && !empty($wpdb->last_error)) {
         wp_die("<b>Database error</b>: " . $wpdb->last_error);
     }
     $this->items = $files;
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $filesperpage, 'total_pages' => ceil($total_items / $filesperpage)));
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:23,代码来源:FileListTable.php

示例4: DBSave

 function DBSave()
 {
     global $wpdb;
     if ($this->locked > 0) {
         $this->TriggerLockedError();
         return array('error' => 'Item locked.');
     }
     $values = array();
     $id_var = $this->is_file ? 'file_id' : 'cat_id';
     $vars = get_class_vars(get_class($this));
     foreach ($vars as $var => $def) {
         $pos = strpos($var, $this->is_file ? 'file_' : 'cat_');
         if ($pos === false || $pos != 0 || $var == $id_var || is_array($this->{$var}) || is_object($this->{$var})) {
             continue;
         }
         $values[$var] = $this->{$var};
         // no & ref here, this causes esc of actual objects data!!!!
     }
     if ($this->is_file) {
         $cvars = WPFB_Core::GetCustomFields(true);
         foreach ($cvars as $var => $cn) {
             $values[$var] = empty($this->{$var}) ? '' : $this->{$var};
         }
     }
     $update = !empty($this->{$id_var});
     $tbl = $this->is_file ? $wpdb->wpfilebase_files : $wpdb->wpfilebase_cats;
     if ($update) {
         if (!$wpdb->update($tbl, $values, array($id_var => $this->{$id_var}))) {
             if (!empty($wpdb->last_error)) {
                 return array('error' => 'Failed to update DB! ' . $wpdb->last_error);
             }
         }
     } else {
         if (!$wpdb->insert($tbl, $values)) {
             return array('error' => 'Unable to insert item into DB! ' . $wpdb->last_error);
         }
         $this->{$id_var} = (int) $wpdb->insert_id;
     }
     return array('error' => false, $id_var => $this->{$id_var}, 'id' => $this->{$id_var});
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:40,代码来源:Item.php

示例5: FileSortFields

 static function FileSortFields()
 {
     return array_merge(array('file_display_name' => __('Title', WPFB), 'file_name' => __('Name of the file', WPFB), 'file_version' => __('File version', WPFB), 'file_hits' => __('How many times this file has been downloaded.', WPFB), 'file_size' => __('Formatted file size', WPFB), 'file_date' => __('Formatted file date', WPFB), 'file_last_dl_time' => __('Time of the last download', WPFB), 'file_path' => __('Relative path of the file'), 'file_id' => __('File ID'), 'file_category_name' => __('Category Name', WPFB), 'file_category' => __('Category ID', WPFB), 'file_description' => __('Short description', WPFB), 'file_author' => __('Author', WPFB), 'file_license' => __('License', WPFB), 'file_post_id' => __('ID of the post/page this file belongs to', WPFB), 'file_added_by' => __('User Name of the owner', WPFB)), WPFB_Core::GetCustomFields(true));
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:4,代码来源:Models.php

示例6: checked

			</div>
		</td>
		
		<th scope="row" valign="top"></th>
		<td><input type="checkbox" name="file_offline" id="file_offline" value="1" <?php 
    checked('1', $file->file_offline);
    ?>
/> <label for="file_offline"><?php 
    _e('Offline', WPFB);
    ?>
</label></td>
		
	</tr>
	<?php 
}
$custom_fields = WPFB_Core::GetCustomFields(false, $custom_defaults);
foreach ($custom_fields as $ct => $cn) {
    $hid = 'file_custom_' . esc_attr($ct);
    ?>
	<tr class="form-field">
		<th scope="row" valign="top"><label for="<?php 
    echo $hid;
    ?>
"><?php 
    echo esc_html($cn);
    ?>
</label></th>
		<td colspan="3"><textarea name="<?php 
    echo $hid;
    ?>
" id="<?php 
开发者ID:parsonsc,项目名称:dofe,代码行数:31,代码来源:wpfb_form_file.php

示例7: SyncCustomFields

 public static function SyncCustomFields($remove = false)
 {
     global $wpdb;
     // only once per request!
     static $synced = false;
     if ($synced) {
         return array();
     }
     $synced = true;
     $messages = array();
     $cols = $wpdb->get_col("SHOW COLUMNS FROM {$wpdb->wpfilebase_files} LIKE 'file_custom_%'");
     $custom_fields = WPFB_Core::GetCustomFields();
     foreach ($custom_fields as $ct => $cn) {
         if (!in_array('file_custom_' . $ct, $cols)) {
             $messages[] = sprintf(__($wpdb->query("ALTER TABLE {$wpdb->wpfilebase_files} ADD `file_custom_" . esc_sql($ct) . "` TEXT NOT NULL") ? "Custom field '%s' added." : "Could not add custom field '%s'!", WPFB), $cn);
         }
     }
     if (!$remove) {
         foreach ($cols as $cf) {
             $ct = substr($cf, 12);
             // len(file_custom_)
             if (!isset($custom_fields[$ct])) {
                 $messages[] = sprintf(__($wpdb->query("ALTER TABLE {$wpdb->wpfilebase_files} DROP `{$cf}`") ? "Custom field '%s' removed!" : "Could not remove custom field '%s'!", WPFB), $ct);
             }
         }
     }
     return $messages;
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:28,代码来源:Admin.php


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