本文整理汇总了PHP中Channel::fetch_custom_channel_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::fetch_custom_channel_fields方法的具体用法?PHP Channel::fetch_custom_channel_fields怎么用?PHP Channel::fetch_custom_channel_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::fetch_custom_channel_fields方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rank
//.........这里部分代码省略.........
$channel = new Weblog();
} else {
if (!class_exists('Channel')) {
require PATH_MOD . '/channel/mod.channel' . EXT;
}
$channel = new Channel();
}
// --------------------------------------------
// Invoke Pagination for EE 2.4 and Above
// --------------------------------------------
if (APP_VER >= '2.4.0') {
ee()->load->library('pagination');
$channel->pagination = new Pagination_object('Channel');
// Used by pagination to determine whether we're coming from the cache
$channel->pagination->dynamic_sql = FALSE;
}
// ----------------------------------------
// Pre-process related data
// ----------------------------------------
// TMPL class is coded so that only
// one method in the weblog class and one
// method in the search class are allowed
// to parse related entries tags. This is
// no doubt for performance reasons.
// ----------------------------------------
ee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data(ee()->TMPL->tagdata);
ee()->TMPL->var_single = array_merge(ee()->TMPL->var_single, ee()->TMPL->related_markers);
// ----------------------------------------
// Execute needed methods
// ----------------------------------------
if (APP_VER < 2.0) {
$channel->fetch_custom_weblog_fields();
} else {
$channel->fetch_custom_channel_fields();
}
$channel->fetch_custom_member_fields();
// --------------------------------------------
// Pagination Tags Parsed Out
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$channel->pagination->get_template();
} else {
$channel->fetch_pagination_data();
}
// ----------------------------------------
// Build Weblog Data Query
// ----------------------------------------
$channel->build_sql_query();
// --------------------------------------------
// Transfer Pagination Variables Over to Channel object
// - Has to go after the building of the query as EE 2.4 does its Pagination work in there
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$transfer = array('paginate' => 'paginate', 'total_pages' => 'total_pages', 'current_page' => 'current_page', 'offset' => 'offset', 'page_next' => 'page_next', 'page_previous' => 'page_previous', 'page_links' => 'pagination_links', 'total_rows' => 'total_rows', 'per_page' => 'per_page', 'per_page' => 'p_limit', 'offset' => 'p_page');
foreach ($transfer as $from => $to) {
$channel->{$to} = $channel->pagination->{$from};
}
}
// ----------------------------------------
// Empty?
// ----------------------------------------
if (trim($channel->sql) == '') {
if ($this->check_yes(ee()->TMPL->fetch_param('favorites_count'))) {
return $this->return_data = str_replace(LD . 'favorites_count' . RD, '0', ee()->TMPL->tagdata);
} else {
return $this->no_results();
示例2: ee
/** ----------------------------------------
/** Show search results
/** ----------------------------------------*/
function search_results()
{
// Fetch the search language file
ee()->lang->loadfile('search');
// Load Pagination Object
ee()->load->library('pagination');
$pagination = ee()->pagination->create();
ee()->TMPL->tagdata = $pagination->prepare(ee()->TMPL->tagdata);
// Check search ID number
// If the QSTR variable is less than 32 characters long we
// don't have a valid search ID number
if (strlen(ee()->uri->query_string) < 32) {
return ee()->output->show_user_error('off', array(lang('search_no_result')));
}
// Clear old search results
ee()->db->delete('search', array('site_id' => ee()->config->item('site_id'), 'search_date <' => ee()->localize->now - $this->cache_expire * 3600));
// Retrieve the search_id
$qstring = explode('/', ee()->uri->query_string);
$search_id = trim($qstring[0]);
// Fetch the cached search query
$query = ee()->db->get_where('search', array('search_id' => $search_id));
if ($query->num_rows() == 0 or $query->row('total_results') == 0) {
// This should be impossible as we already know there are results
return ee()->output->show_user_error('general', array(lang('invalid_action')));
}
$fields = $query->row('custom_fields') == '' ? array() : unserialize(stripslashes($query->row('custom_fields')));
$sql = unserialize(stripslashes($query->row('query')));
$sql = str_replace('MDBMPREFIX', 'exp_', $sql);
$pagination->per_page = (int) $query->row('per_page');
$res_page = $query->row('result_page');
// -------------------------------------------
// 'channel_search_modify_result_query' hook.
// - Take the whole query string, do what you wish
// - added 2.8
//
if (ee()->extensions->active_hook('channel_search_modify_result_query') === TRUE) {
$modified_sql = ee()->extensions->call('channel_search_modify_result_query', $sql, $search_id);
// Make sure its valid
if (is_string($modified_sql) && $modified_sql != '') {
$sql = $modified_sql;
}
}
//
// -------------------------------------------
// Run the search query
$query = ee()->db->query(preg_replace("/SELECT(.*?)\\s+FROM\\s+/is", 'SELECT COUNT(*) AS count FROM ', $sql));
if ($query->row('count') == 0) {
// This should also be impossible
return ee()->output->show_user_error('general', array(lang('invalid_action')));
}
// Calculate total number of pages and add total rows
$pagination->total_items = $query->row('count');
// Build pagination if enabled
// If we're paginating limit the query and do it again
if ($pagination->paginate === TRUE) {
$pagination->build($pagination->total_items, $pagination->per_page);
$sql .= " LIMIT " . $pagination->offset . ", " . $pagination->per_page;
} else {
$sql .= " LIMIT 0, 100";
}
$query = ee()->db->query($sql);
$output = '';
if (!class_exists('Channel')) {
require PATH_ADDONS . 'channel/mod.channel.php';
}
unset(ee()->TMPL->var_single['auto_path']);
unset(ee()->TMPL->var_single['excerpt']);
unset(ee()->TMPL->var_single['id_auto_path']);
unset(ee()->TMPL->var_single['full_text']);
unset(ee()->TMPL->var_single['switch']);
foreach (ee()->TMPL->var_single as $key => $value) {
if (substr($key, 0, strlen('member_path')) == 'member_path') {
unset(ee()->TMPL->var_single[$key]);
}
}
$switch = ee()->TMPL->fetch_param('switch');
if (!empty($switch) && strpos(ee()->TMPL->tagdata, '{switch}') !== FALSE) {
ee()->TMPL->tagdata = str_replace("{switch}", "{switch='{$switch}'}", ee()->TMPL->tagdata);
ee()->load->library('logger');
ee()->logger->developer('The search module\'s {switch} variable has been deprecated, use standard {switch=} tags in your search results template.', TRUE, 604800);
}
$channel = new Channel();
// This allows the channel {absolute_count} variable to work
$channel->pagination->offset = $pagination->per_page * $pagination->current_page - $pagination->per_page;
$channel->fetch_custom_channel_fields();
$channel->fetch_custom_member_fields();
$channel->query = $query;
if ($channel->query->num_rows() == 0) {
return ee()->TMPL->no_results();
}
ee()->load->library('typography');
ee()->typography->initialize(array('convert_curly' => FALSE, 'encode_email' => FALSE));
$channel->fetch_categories();
$channel->parse_channel_entries(array($this, 'callback_search_result_row'));
// Add new pagination
ee()->TMPL->tagdata = $pagination->render($channel->return_data);
// Parse lang variables
//.........这里部分代码省略.........
示例3: strpos
//.........这里部分代码省略.........
}
// Build pagination if enabled
if ($pagination->paginate === TRUE) {
$pagination->build($pagination->total_rows);
}
// If we're paginating, old or new, limit the query and do it again
if ($pagination->paginate === TRUE or $old_pagination) {
$sql .= " LIMIT " . $pagination->offset . ", " . $pagination->per_page;
} else {
if ($pagination->per_page > 0) {
$sql .= " LIMIT 0, " . $pagination->per_page;
} else {
$sql .= " LIMIT 0, 100";
}
}
$query = $this->EE->db->query($sql);
$output = '';
if (!class_exists('Channel')) {
require PATH_MOD . 'channel/mod.channel.php';
}
unset($this->EE->TMPL->var_single['auto_path']);
unset($this->EE->TMPL->var_single['excerpt']);
unset($this->EE->TMPL->var_single['id_auto_path']);
unset($this->EE->TMPL->var_single['full_text']);
unset($this->EE->TMPL->var_single['switch']);
foreach ($this->EE->TMPL->var_single as $key => $value) {
if (substr($key, 0, strlen('member_path')) == 'member_path') {
unset($this->EE->TMPL->var_single[$key]);
}
}
$channel = new Channel();
// This allows the channel {absolute_count} variable to work
$channel->pagination->offset = $pagination->per_page * $pagination->current_page - $pagination->per_page;
$channel->fetch_custom_channel_fields();
$channel->fetch_custom_member_fields();
$channel->query = $this->EE->db->query($sql);
if ($channel->query->num_rows() == 0) {
return $this->EE->TMPL->no_results();
}
$this->EE->load->library('typography');
$this->EE->typography->initialize(array('convert_curly' => FALSE, 'encode_email' => FALSE));
$channel->fetch_categories();
$channel->parse_channel_entries();
$tagdata = $this->EE->TMPL->tagdata;
// Does the tag contain "related entries" that we need to parse out?
if (count($this->EE->TMPL->related_data) > 0 and count($channel->related_entries) > 0) {
$channel->parse_related_entries();
}
if (count($this->EE->TMPL->reverse_related_data) > 0 and count($channel->reverse_related_entries) > 0) {
$channel->parse_reverse_related_entries();
}
$output = $channel->return_data;
$this->EE->TMPL->tagdata = $tagdata;
// Fetch member path variable
// We do it here in case it's used in multiple places.
$m_paths = array();
if (preg_match_all("/" . LD . "member_path(\\s*=.*?)" . RD . "/s", $this->EE->TMPL->tagdata, $matches)) {
for ($j = 0; $j < count($matches['0']); $j++) {
$m_paths[] = array($matches['0'][$j], $this->EE->functions->extract_path($matches['1'][$j]));
}
}
// Fetch switch param
$switch1 = '';
$switch2 = '';
if ($switch = $this->EE->TMPL->fetch_param('switch')) {
if (strpos($switch, '|') !== FALSE) {
示例4: search
function search()
{
$address = '';
$tagdata = $this->EE->TMPL->tagdata;
$prec = !$this->EE->TMPL->fetch_param('prec') ? '' : ',' . $this->EE->TMPL->fetch_param('prec');
$prefix = !$this->EE->TMPL->fetch_param('prefix') ? '' : ',' . $this->EE->TMPL->fetch_param('prefix');
$orderby = !$this->EE->TMPL->fetch_param('orderby') ? false : ($this->EE->TMPL->fetch_param('orderby') == 'distance' ? false : $this->EE->TMPL->fetch_param('orderby'));
$sort = !$this->EE->TMPL->fetch_param('sort') ? 'asc' : $this->EE->TMPL->fetch_param('sort');
$this->EE->TMPL->tagparams['limit'] = !$this->EE->TMPL->fetch_param('limit') ? 99999 : $this->EE->TMPL->fetch_param('limit');
$address_fields = !$this->EE->TMPL->fetch_param('address_fields') ? false : $this->EE->TMPL->fetch_param('address_fields');
$debug = !$this->EE->TMPL->fetch_param('debug') ? false : true;
//@delete
$reverse_geocoding = !$this->EE->TMPL->fetch_param('reverse_geocoding') ? '' : ',' . $this->EE->TMPL->fetch_param('reverse_geocoding');
if (isset($_POST) and count($_POST) > 0 or isset($_GET) and count($_GET) > 0) {
$zipLongitude = $this->EE->security->xss_clean($this->EE->input->get_post('long'));
$zipLatitude = $this->EE->security->xss_clean($this->EE->input->get_post('lat'));
$unit = $this->EE->security->xss_clean($this->EE->input->get_post('unit'));
//@add to site description
if ($address_fields) {
foreach (explode('|', $address_fields) as $field_name) {
$address = $this->EE->input->get_post($field_name) ? $address . $this->EE->security->xss_clean($this->EE->input->get_post($field_name)) . ', ' : '';
}
} else {
$address = $this->EE->security->xss_clean($this->EE->input->get_post('address'));
if (is_array($address)) {
$address = implode(",", $address);
}
}
$address = $prefix . $address;
$radius = $this->EE->security->xss_clean($this->EE->input->get_post('radius'));
} else {
$zipLongitude = $this->EE->TMPL->fetch_param('long') != '' ? $this->EE->TMPL->fetch_param('long') : "";
$zipLatitude = $this->EE->TMPL->fetch_param('lat') != '' ? $this->EE->TMPL->fetch_param('lat') : '';
$unit = $this->EE->TMPL->fetch_param('unit') != '' ? $this->EE->TMPL->fetch_param('unit') : 'ml';
$address = $this->EE->TMPL->fetch_param('address') != '' ? $this->EE->TMPL->fetch_param('address') : '';
$radius = $this->EE->TMPL->fetch_param('radius') != '' ? $this->EE->TMPL->fetch_param('radius') : $this->default_radius;
}
$radius = $radius == '' ? $this->default_radius : $radius;
$earth_radius = $unit == 'km' ? 6371 : 3959;
//earth_radius
if (($zipLongitude == "" or $zipLatitude == "") and $address == "") {
$zipLongitude = $this->default_long;
$zipLatitude = $this->default_lat;
$address = $this->default_address;
}
$entry_id = '';
$points = array();
$entry_id = rtrim($entry_id, '|');
$channel = new Channel();
$LD = '\\{';
$RD = '\\}';
$SLASH = '\\/';
$variable = "entries";
$return_data = "";
if (isset($_POST['categories'])) {
$this->EE->TMPL->tagparams['category'] = (isset($this->EE->TMPL->tagparams['category']) ? $this->EE->TMPL->tagparams['category'] : '') . '|' . implode("|", $this->EE->security->xss_clean($_POST['categories']));
}
if (preg_match("/" . LD . $variable . ".*?" . RD . "(.*?)" . LD . '\\/' . $variable . RD . "/s", $tagdata, $entries)) {
$channel->EE->TMPL->tagdata = $entries[1];
if ($channel->EE->TMPL->fetch_param('related_categories_mode') == 'yes') {
return $channel->related_entries();
}
$channel->initialize();
$channel->uri = $channel->query_string != '' ? $channel->query_string : 'index.php';
if ($channel->enable['custom_fields'] == TRUE) {
$channel->fetch_custom_channel_fields();
}
if ($channel->enable['member_data'] == TRUE) {
$channel->fetch_custom_member_fields();
}
if ($channel->enable['pagination'] == TRUE) {
if (version_compare(APP_VER, '2.4', '>=')) {
$channel->add_pagination_data();
} else {
$channel->fetch_pagination_data();
}
}
$save_cache = FALSE;
$channel->EE->TMPL->tagparams['dynamic'] = 'no';
//$zipLongitude.$zipLatitude.$address
if ($channel->EE->config->item('enable_sql_caching') == 'y') {
if (FALSE == ($channel->sql = $channel->fetch_cache())) {
$save_cache = TRUE;
} else {
if ($channel->EE->TMPL->fetch_param('dynamic') != 'no') {
if (preg_match("#(^|\\/)C(\\d+)#", $channel->query_string, $match) or in_array($channel->reserved_cat_segment, explode("/", $channel->query_string))) {
$channel->cat_request = TRUE;
}
}
}
if (FALSE !== ($cache = $channel->fetch_cache('pagination_count'))) {
if (FALSE !== $channel->fetch_cache('field_pagination')) {
if (FALSE !== ($pg_query = $channel->fetch_cache('pagination_query'))) {
$channel->paginate = TRUE;
$channel->field_pagination = TRUE;
$channel->create_pagination(trim($cache), $channel->EE->db->query(trim($pg_query)));
}
} else {
$channel->create_pagination(trim($cache));
}
//.........这里部分代码省略.........
示例5: implode
function tell_a_friend()
{
if ($this->EE->uri->query_string == '') {
return FALSE;
}
/** ----------------------------------------
/** Recipient Email Checking
/** ----------------------------------------*/
$user_recipients = true;
// By default
$recipients = !$this->EE->TMPL->fetch_param('recipients') ? '' : $this->EE->TMPL->fetch_param('recipients');
$charset = !$this->EE->TMPL->fetch_param('charset') ? '' : $this->EE->TMPL->fetch_param('charset');
$allow_html = !$this->EE->TMPL->fetch_param('allow_html') ? 'n' : $this->EE->TMPL->fetch_param('allow_html');
if (!$this->EE->TMPL->fetch_param('status')) {
$this->EE->TMPL->tagparams['status'] = 'open';
}
// Clean and check recipient emails, if any
if ($recipients != '') {
$array = $this->validate_recipients($recipients);
// Put together into string again
$recipients = implode(',', $array['approved']);
}
/** --------------------------------------
/** Parse page number
/** --------------------------------------*/
// We need to strip the page number from the URL for two reasons:
// 1. So we can create pagination links
// 2. So it won't confuse the query with an improper proper ID
$qstring = $this->EE->uri->query_string;
if (preg_match("#/P(\\d+)#", $qstring, $match)) {
$current_page = $match['1'];
$qstring = $this->EE->functions->remove_double_slashes(str_replace($match['0'], '', $qstring));
}
/** --------------------------------------
/** Remove "N"
/** --------------------------------------*/
// The recent comments feature uses "N" as the URL indicator
// It needs to be removed if presenst
if (preg_match("#/N(\\d+)#", $qstring, $match)) {
$qstring = $this->EE->functions->remove_double_slashes(str_replace($match['0'], '', $qstring));
}
/* -------------------------------------
/* 'email_module_tellafriend_override' hook.
/* - Allow use of Tell-A-Friend for things besides channel entries
/* - Added EE 1.5.1
*/
if ($this->EE->extensions->active_hook('email_module_tellafriend_override') === TRUE) {
$tagdata = $this->EE->extensions->call('email_module_tellafriend_override', $qstring, $this);
if ($this->EE->extensions->end_script === TRUE) {
return $tagdata;
}
} else {
$entry_id = trim($qstring);
// If there is a slash in the entry ID we'll kill everything after it.
$entry_id = preg_replace("#/.+#", "", $entry_id);
/** ----------------------------------------
/** Do we have a vaild channel and ID number?
/** ----------------------------------------*/
$timestamp = $this->EE->TMPL->cache_timestamp != '' ? $this->EE->localize->set_gmt($this->EE->TMPL->cache_timestamp) : $this->EE->localize->now;
$channel = !$this->EE->TMPL->fetch_param('channel') ? '' : $this->EE->TMPL->fetch_param('channel');
$sql = "SELECT entry_id FROM exp_channel_titles, exp_channels\n\t\t\t\t\t\tWHERE exp_channel_titles.channel_id = exp_channels.channel_id\n\t\t\t\t\t\tAND (expiration_date = 0 OR expiration_date > " . $timestamp . ")\n\t\t\t\t\t\tAND status != 'closed' AND ";
$sql .= !is_numeric($entry_id) ? " url_title = '" . $entry_id . "' " : " entry_id = '{$entry_id}' ";
if ($channel != '') {
$sql .= $this->EE->functions->sql_andor_string($channel, 'exp_channels.channel_name') . " ";
}
$query = $this->EE->db->query($sql);
// Bad ID? See ya!
if ($query->num_rows() == 0) {
return FALSE;
}
/** ----------------------------------------
/** Fetch the channel entry
/** ----------------------------------------*/
if (!class_exists('Channel')) {
require PATH_MOD . 'channel/mod.channel' . EXT;
}
$channel = new Channel();
$channel->fetch_custom_channel_fields();
$channel->fetch_custom_member_fields();
$channel->build_sql_query();
if ($channel->sql == '') {
return FALSE;
}
$channel->query = $this->EE->db->query($channel->sql);
if ($channel->query->num_rows() == 0) {
return FALSE;
}
$this->EE->load->library('typography');
$this->EE->typography->initialize();
$this->EE->typography->encode_email = FALSE;
$this->EE->typography->convert_curly = FALSE;
$channel->fetch_categories();
$channel->parse_channel_entries();
$tagdata = $channel->return_data;
}
/*
/* -------------------------------------*/
/** ----------------------------------------
/** Parse conditionals
/** ----------------------------------------*/
//.........这里部分代码省略.........
示例6: prep_occurrences_output
//.........这里部分代码省略.........
require PATH_MOD . '/channel/mod.channel' . EXT;
}
$channel = new Channel();
}
//default is 100 and that could limit events when there are very many to be shown
$channel->limit = 500;
// --------------------------------------------
// Invoke Pagination for EE 2.4 and Above
// --------------------------------------------
if (APP_VER >= '2.4.0') {
ee()->load->library('pagination');
$channel->pagination = new Pagination_object('Channel');
// Used by pagination to determine whether we're coming from the cache
$channel->pagination->dynamic_sql = FALSE;
}
// -------------------------------------
// Prepare parameters
// -------------------------------------
ee()->TMPL->tagparams['entry_id'] = implode('|', $ids);
ee()->TMPL->tagparams['weblog'] = CALENDAR_EVENTS_CHANNEL_NAME;
ee()->TMPL->tagparams['channel'] = CALENDAR_EVENTS_CHANNEL_NAME;
// -------------------------------------
// Pre-process related data
// -------------------------------------
ee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data($tagdata);
ee()->TMPL->var_single = array_merge(ee()->TMPL->var_single, ee()->TMPL->related_markers);
ee()->TMPL->var_single['entry_id'] = 'entry_id';
// -------------------------------------
// Execute needed methods
// -------------------------------------
if (APP_VER < 2.0) {
$channel->fetch_custom_weblog_fields();
} else {
$channel->fetch_custom_channel_fields();
}
$channel->fetch_custom_member_fields();
// --------------------------------------------
// Pagination Tags Parsed Out
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$channel->pagination->get_template();
} else {
$channel->fetch_pagination_data();
}
// -------------------------------------
// Add occurrence_ prefix to custom fields
// -------------------------------------
foreach ($channel->cfields as $sid => $fields) {
foreach ($fields as $name => $fid) {
$channel->cfields[$sid]['occurrence_' . $name] = $fid;
unset($channel->cfields[$sid][$name]);
}
}
// -------------------------------------
// Querification
// -------------------------------------
$channel->build_sql_query();
if ($channel->sql == '') {
return $this->no_results();
}
$channel->query = ee()->db->query($channel->sql);
if ($channel->query->num_rows() == 0) {
//ee()->TMPL->log_item('Calendar: Channel module says no results, bailing');
return $this->no_results();
}
$channel->query->result = $channel->query->result_array();
示例7: _entries
/**
* List of Entires for an Author, Sub-Processing for entries() method
*
* @access private
* @param array
* @return string
*/
private function _entries($params = array())
{
/** ----------------------------------------
/** Execute?
/** ----------------------------------------*/
if ($this->entry_id == '') {
return FALSE;
}
/** ----------------------------------------
/** Invoke Channel/Weblog class
/** ----------------------------------------*/
if (APP_VER < 2.0) {
if (!class_exists('Weblog')) {
require PATH_MOD . 'weblog/mod.weblog' . EXT;
}
$channel = new Weblog();
} else {
if (!class_exists('Channel')) {
require PATH_MOD . 'channel/mod.channel.php';
}
$channel = new Channel();
}
// --------------------------------------------
// Invoke Pagination for EE 2.4 and Above
// --------------------------------------------
if (APP_VER >= '2.4.0') {
ee()->load->library('pagination');
$channel->pagination = new Pagination_object('Channel');
// Used by pagination to determine whether we're coming from the cache
$channel->pagination->dynamic_sql = FALSE;
}
/** ----------------------------------------
/** Pass params
/** ----------------------------------------*/
ee()->TMPL->tagparams['entry_id'] = $this->entry_id;
ee()->TMPL->tagparams['inclusive'] = '';
if (isset($params['dynamic']) and $params['dynamic'] == "off") {
if (APP_VER < 2.0) {
ee()->TMPL->tagparams['dynamic'] = 'off';
} else {
ee()->TMPL->tagparams['dynamic'] = 'no';
}
}
/** ----------------------------------------
/** Pre-process related data
/** ----------------------------------------*/
ee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data(ee()->TMPL->tagdata);
ee()->TMPL->var_single = array_merge(ee()->TMPL->var_single, ee()->TMPL->related_markers);
/** ----------------------------------------
/** Execute needed methods
/** ----------------------------------------*/
if (APP_VER < 2.0) {
$channel->fetch_custom_weblog_fields();
} else {
$channel->fetch_custom_channel_fields();
}
$channel->fetch_custom_member_fields();
// --------------------------------------------
// Pagination Tags Parsed Out
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$channel->pagination->get_template();
} else {
$channel->fetch_pagination_data();
}
if (APP_VER >= '2.4.0') {
$channel->pagination->cfields = $channel->cfields;
$channel->pagination->build();
} else {
$channel->create_pagination();
}
/** ----------------------------------------
/** Grab entry data
/** ----------------------------------------*/
//$channel->create_pagination();
$channel->build_sql_query();
if ($channel->sql == '') {
return $this->no_results();
}
$channel->query = ee()->db->query($channel->sql);
if (APP_VER < 2.0) {
$channel->query->result = $channel->query->result_array();
}
if (!isset($channel->query) or $channel->query->num_rows() == 0) {
return $this->no_results();
}
if (APP_VER < 2.0) {
if (!class_exists('Typography')) {
require PATH_CORE . 'core.typography' . EXT;
}
$channel->TYPE = new Typography();
$channel->TYPE->convert_curly = FALSE;
} else {
//.........这里部分代码省略.........
示例8: tell_a_friend
/**
* Tell a friend form
*
* {exp:email:tell_a_friend charset="utf-8" allow_html='n'}
* {exp:email:tell_a_friend charset="utf-8" allow_html='<p>,<a>' recipients='sales@ellislab.com'}
* {member_email}, {member_name}, {current_time format="%Y %d %m"}
*/
public function tell_a_friend()
{
if (ee()->uri->query_string == '') {
return FALSE;
}
// Recipient Email Checking
$this->_user_recipients = 'yes';
// By default
$recipients = ee()->TMPL->fetch_param('recipients', '');
$charset = ee()->TMPL->fetch_param('charset', '');
$allow_html = ee()->TMPL->fetch_param('allow_html');
// Equalize $allow_html value
$allow_html = (is_string($allow_html) and in_array($allow_html, array('yes', 'y', 'true'))) ? TRUE : $allow_html;
$allow_html = (is_string($allow_html) and in_array($allow_html, array('no', 'n', 'false'))) ? FALSE : $allow_html;
if (!ee()->TMPL->fetch_param('status')) {
ee()->TMPL->tagparams['status'] = 'open';
}
// Clean and check recipient emails, if any
if ($recipients != '') {
$array = $this->validate_recipients($recipients);
// Put together into string again
$recipients = implode(',', $array['approved']);
}
// Parse page number
// We need to strip the page number from the URL for two reasons:
// 1. So we can create pagination links
// 2. So it won't confuse the query with an improper proper ID
// Conditionally get query string based on whether or not the page
// was accessed through the Pages module
$qstring = empty(ee()->uri->page_query_string) ? ee()->uri->query_string : ee()->uri->page_query_string;
if (preg_match("#/P(\\d+)#", $qstring, $match)) {
$current_page = $match['1'];
$qstring = reduce_double_slashes(str_replace($match[0], '', $qstring));
}
// Remove "N"
// The recent comments feature uses "N" as the URL indicator
// It needs to be removed if presenst
if (preg_match("#/N(\\d+)#", $qstring, $match)) {
$qstring = reduce_double_slashes(str_replace($match[0], '', $qstring));
}
/* -------------------------------------
/* 'email_module_tellafriend_override' hook.
/* - Allow use of Tell-A-Friend for things besides channel entries
/* - Added EE 1.5.1
*/
if (ee()->extensions->active_hook('email_module_tellafriend_override') === TRUE) {
$tagdata = ee()->extensions->call('email_module_tellafriend_override', $qstring, $this);
if (ee()->extensions->end_script === TRUE) {
return $tagdata;
}
} else {
$entry_id = trim($qstring);
// If there is a slash in the entry ID we'll kill everything after it.
$entry_id = preg_replace("#/.+#", "", $entry_id);
// Do we have a vaild channel and ID number?
$timestamp = ee()->TMPL->cache_timestamp != '' ? ee()->TMPL->cache_timestamp : ee()->localize->now;
$channel = ee()->TMPL->fetch_param('channel', '');
ee()->db->select('entry_id')->from(array('channel_titles ct', 'channels c'))->where('ct.channel_id = c.channel_id', '', FALSE)->where('(ct.expiration_date = 0 OR expiration_date > ' . $timestamp . ')', '', FALSE)->where('ct.status !=', 'closed');
$table = !is_numeric($entry_id) ? 'ct.url_title' : 'ct.entry_id';
ee()->db->where($table, $entry_id);
if ($channel != '') {
ee()->functions->ar_andor_string($channel, 'c.channel_name');
}
$query = ee()->db->get();
// Bad ID? See ya!
if ($query->num_rows() === 0) {
return FALSE;
}
// Fetch the channel entry
if (!class_exists('Channel')) {
require PATH_MOD . 'channel/mod.channel.php';
}
$channel = new Channel();
$channel->fetch_custom_channel_fields();
$channel->fetch_custom_member_fields();
$channel->build_sql_query();
if ($channel->sql == '') {
return FALSE;
}
$channel->query = ee()->db->query($channel->sql);
if ($channel->query->num_rows() === 0) {
return FALSE;
}
ee()->load->library('typography');
ee()->typography->initialize(array('encode_email' => FALSE, 'convert_curly' => FALSE));
$channel->fetch_categories();
$channel->parse_channel_entries();
$tagdata = $channel->return_data;
}
/*
/* -------------------------------------*/
// Parse conditionals
$cond = array();
//.........这里部分代码省略.........
示例9: ee
/** ----------------------------------------
/** Show search results
/** ----------------------------------------*/
function search_results()
{
// Fetch the search language file
ee()->lang->loadfile('search');
// Load Pagination Object
ee()->load->library('pagination');
$pagination = ee()->pagination->create();
ee()->TMPL->tagdata = $pagination->prepare(ee()->TMPL->tagdata);
// Check search ID number
// If the QSTR variable is less than 32 characters long we
// don't have a valid search ID number
if (strlen(ee()->uri->query_string) < 32) {
return ee()->output->show_user_error('off', array(lang('search_no_result')));
}
// Clear old search results
ee()->db->delete('search', array('site_id' => ee()->config->item('site_id'), 'search_date <' => ee()->localize->now - $this->cache_expire * 3600));
// Retrieve the search_id
$qstring = explode('/', ee()->uri->query_string);
$search_id = trim($qstring[0]);
// Fetch the cached search query
$query = ee()->db->get_where('search', array('search_id' => $search_id));
if ($query->num_rows() == 0 or $query->row('total_results') == 0) {
// This should be impossible as we already know there are results
return ee()->output->show_user_error('general', array(lang('invalid_action')));
}
$fields = $query->row('custom_fields') == '' ? array() : unserialize(stripslashes($query->row('custom_fields')));
$sql = unserialize(stripslashes($query->row('query')));
$sql = str_replace('MDBMPREFIX', 'exp_', $sql);
$pagination->per_page = (int) $query->row('per_page');
$res_page = $query->row('result_page');
// -------------------------------------------
// 'channel_search_modify_result_query' hook.
// - Take the whole query string, do what you wish
// - added 2.8
//
if (ee()->extensions->active_hook('channel_search_modify_result_query') === TRUE) {
$modified_sql = ee()->extensions->call('channel_search_modify_result_query', $sql, $search_id);
// Make sure its valid
if (is_string($modified_sql) && $modified_sql != '') {
$sql = $modified_sql;
}
}
//
// -------------------------------------------
// Run the search query
$query = ee()->db->query(preg_replace("/SELECT(.*?)\\s+FROM\\s+/is", 'SELECT COUNT(*) AS count FROM ', $sql));
if ($query->row('count') == 0) {
// This should also be impossible
return ee()->output->show_user_error('general', array(lang('invalid_action')));
}
// Calculate total number of pages and add total rows
$pagination->total_items = $query->row('count');
// Build pagination if enabled
// If we're paginating limit the query and do it again
if ($pagination->paginate === TRUE) {
$pagination->build($pagination->total_items, $pagination->per_page);
$sql .= " LIMIT " . $pagination->offset . ", " . $pagination->per_page;
} else {
$sql .= " LIMIT 0, 100";
}
$query = ee()->db->query($sql);
$output = '';
if (!class_exists('Channel')) {
require PATH_MOD . 'channel/mod.channel.php';
}
unset(ee()->TMPL->var_single['auto_path']);
unset(ee()->TMPL->var_single['excerpt']);
unset(ee()->TMPL->var_single['id_auto_path']);
unset(ee()->TMPL->var_single['full_text']);
unset(ee()->TMPL->var_single['switch']);
foreach (ee()->TMPL->var_single as $key => $value) {
if (substr($key, 0, strlen('member_path')) == 'member_path') {
unset(ee()->TMPL->var_single[$key]);
}
}
$channel = new Channel();
// This allows the channel {absolute_count} variable to work
$channel->pagination->offset = $pagination->per_page * $pagination->current_page - $pagination->per_page;
$channel->fetch_custom_channel_fields();
$channel->fetch_custom_member_fields();
$channel->query = ee()->db->query($sql);
if ($channel->query->num_rows() == 0) {
return ee()->TMPL->no_results();
}
ee()->load->library('typography');
ee()->typography->initialize(array('convert_curly' => FALSE, 'encode_email' => FALSE));
$channel->fetch_categories();
$channel->parse_channel_entries();
$output = $channel->return_data;
// Fetch member path variable
// We do it here in case it's used in multiple places.
$m_paths = array();
if (preg_match_all("/" . LD . "member_path(\\s*=.*?)" . RD . "/s", ee()->TMPL->tagdata, $matches)) {
for ($j = 0; $j < count($matches['0']); $j++) {
$m_paths[] = array($matches['0'][$j], ee()->functions->extract_path($matches['1'][$j]));
}
}
//.........这里部分代码省略.........
示例10: array
//.........这里部分代码省略.........
$pager = $this->EE->pagination->create_links();
$sql .= " LIMIT ".$cur_page.", ".$per_page;
}
$query = $this->EE->db->query($sql);
$output = '';
if ( ! class_exists('Channel'))
{
require PATH_MOD.'channel/mod.channel'.EXT;
}
unset($this->EE->TMPL->var_single['auto_path']);
unset($this->EE->TMPL->var_single['excerpt']);
unset($this->EE->TMPL->var_single['id_auto_path']);
unset($this->EE->TMPL->var_single['full_text']);
unset($this->EE->TMPL->var_single['switch']);
foreach($this->EE->TMPL->var_single as $key => $value)
{
if (substr($key, 0, strlen('member_path')) == 'member_path')
{
unset($this->EE->TMPL->var_single[$key]);
}
}
$channel = new Channel;
// This allows the channel {absolute_count} variable to work
$channel->p_page = ($per_page * $current_page) - $per_page;
$channel->fetch_custom_channel_fields();
$channel->fetch_custom_member_fields();
$channel->query = $this->EE->db->query($sql);
if ($channel->query->num_rows() == 0)
{
return $this->EE->TMPL->no_results();
}
$this->EE->load->library('typography');
$this->EE->typography->initialize();
$this->EE->typography->convert_curly = FALSE;
$this->EE->typography->encode_email = FALSE;
$channel->fetch_categories();
$channel->parse_channel_entries();
$tagdata = $this->EE->TMPL->tagdata;
// Does the tag contain "related entries" that we need to parse out?
if (count($this->EE->TMPL->related_data) > 0 AND count($channel->related_entries) > 0)
{
$channel->parse_related_entries();
}
if (count($this->EE->TMPL->reverse_related_data) > 0 AND count($channel->reverse_related_entries) > 0)
{
$channel->parse_reverse_related_entries();
}
$output = $channel->return_data;
$this->EE->TMPL->tagdata = $tagdata;