本文整理汇总了PHP中wprss_get_general_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP wprss_get_general_setting函数的具体用法?PHP wprss_get_general_setting怎么用?PHP wprss_get_general_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wprss_get_general_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wprss_licensing_get_manager
/**
* Gets the singleton instance of the Manager class, creating it if it doesn't exist.
*
* @since 4.7.8
* @return Aventura\Wprss\Core\Licensing\Manager
*/
function wprss_licensing_get_manager()
{
static $manager = null;
if (is_null($manager)) {
$manager = new Aventura\Wprss\Core\Licensing\Manager();
$manager->setExpirationNoticePeriod(wprss_get_general_setting('expiration_notice_period'));
$manager->setDefaultAuthorName('Jean Galea');
}
return $manager;
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:16,代码来源:licensing.php
示例2: wprss_date_i18n
/**
* Gets an internationalized and localized datetime string, defaulting
* to WP RSS format.
*
* @see wprss_local_date_i18n;
* @param string|null $format Format to use. Default: Wordpress date and time format.
* @param int|null $timestamp The timestamp to localize. Default: time().
* @return string The formatted datetime, localized and offset for local timezone.
*/
function wprss_date_i18n($timestamp = null, $format = null)
{
$format = is_null($format) ? wprss_get_general_setting('date_format') : $format;
return wprss_local_date_i18n($timestamp, $format);
}
开发者ID:vanlong200880,项目名称:tmdt,代码行数:14,代码来源:wp-rss-aggregator.php
示例3: wprss_send_tracking_data
function wprss_send_tracking_data()
{
// Check the tracking option - if turned off, exit out of function
$tracking_option = wprss_get_general_setting('tracking');
if ($tracking_option == 0 || $tracking_option == FALSE) {
return;
}
// Get the tracking transient.
$transient = get_transient('wprss_tracking_transient');
// If the transient did not expire, exit out of function
if ($transient !== FALSE && !isset($_GET['wprss_send_report'])) {
return;
}
// If the GET parameter is set, show an admin notice
if (isset($_GET['wprss_send_report'])) {
add_action('admin_notices', 'wprss_tracking_notice');
}
// Check if running on localhost
$site_url = site_url();
$running_on_local = preg_match_all("/(localhost|127\\.0\\.0\\.1)/", $site_url, $matches) > 0;
if ($running_on_local) {
return;
}
// Get data about the plugin
$plugin_data = get_plugin_data(WPRSS_FILE_CONSTANT);
// Get the theme name
if (function_exists('wp_get_theme')) {
$theme_data = wp_get_theme();
$theme_name = $theme_data->Name;
} else {
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
$theme_name = $theme_data['Name'];
}
// Get plugins
$plugins = get_plugins();
$active_plugins_option = get_option('active_plugins', array());
// Prepare plugin arrays
$active_plugins = array();
$inactive_plugins = array();
// Loop through plugins
foreach ($plugins as $plugins_path => $plugin_info) {
// If plugin found in active plugins list, then add to the active_plugins array
if (in_array($plugins_path, $active_plugins_option)) {
$add_to =& $active_plugins;
} else {
$add_to =& $inactive_plugins;
}
// Add the plugin info to the chosen array
$add_to[] = $plugin_info['Name'] . ' v' . $plugin_info['Version'];
}
// If multisite
if (is_multisite()) {
// Get network plugins
$network_plugins = wp_get_active_network_plugins();
$network_active_plugins_option = get_site_option('active_sitewide_plugins', array());
// Prepare plugin array
$network_active_plugins = array();
// Loop through plugins
foreach ($network_plugins as $plugin_path) {
// Get plugin basename
$plugin_base = plugin_basename($plugin_path);
// If the plugin basename is found in the active network plugin list
if (array_key_exists($plugin_base, $network_active_plugins_option)) {
// Get the plugin info and add it to the plugin list
$plugin_info = get_plugin_data($plugin_path);
$network_active_plugins[] = $plugin_info['Name'] . ' v' . $plugin_info['Version'];
}
}
} else {
// Otherwise, indicate that the site is not a multisite installation
$network_active_plugins = 'Not multisite';
}
// Detect add-ons
$addons = array();
if (defined('WPRSS_C_VERSION')) {
$addons[] = 'Categories';
}
if (defined('WPRSS_ET_VERSION')) {
$addons[] = 'Excerpts & Thumbnails';
}
if (defined('WPRSS_KF_VERSION')) {
$addons[] = 'Keyword Filtering';
}
if (defined('WPRSS_FTP_VERSION')) {
$addons[] = 'Feed to Post';
}
// Compile the data
$data = array('Site URL' => base64_encode($site_url), 'Plugin Version' => $plugin_data['Version'], 'Active Add-ons' => $addons, 'Theme Name' => $theme_name, 'Site Name' => str_replace(' ', '', get_bloginfo('name')), 'Plugin Count' => count(get_option('active_plugins')), 'Active Plugins' => $active_plugins, 'Network Active Plugins' => $network_active_plugins, 'Inactive Plugins' => $inactive_plugins, 'WordPress Version' => get_bloginfo('version'));
// Send the data
wp_remote_post(WPRSS_TRACKING_SERVER_URL, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => array('wprss_tracking_data' => $data), 'cookies' => array()));
// Set a transient that expires in 1 week. When it expires, this function will run again
// Expiration: 60secs * 60mins * 24hrs * 7days = 1 week
set_transient('wprss_tracking_transient', '-', 60 * 60 * 24 * 7);
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:94,代码来源:admin-statistics.php
示例4: render_certificate_path_setting
/**
* Renders the setting field for the certificate path.
*
* @since 4.7
* @see wprss_admin_init
* @param array $field Data of this field.
*/
public function render_certificate_path_setting($field)
{
$feed_limit = wprss_get_general_setting($field['field_id']);
?>
<input id="<?php
echo $field['field_id'];
?>
" name="wprss_settings_general[<?php
echo $field['field_id'];
?>
]" type="text" value="<?php
echo $feed_limit;
?>
" />
<?php
echo wprss_settings_inline_help($field['field_id'], $field['tooltip']);
}
开发者ID:wangshijun101,项目名称:morketing.cn,代码行数:24,代码来源:feed-access.php
示例5: wprss_feed_processing_meta_box_callback
/**
* Renders the Feed Processing metabox
*
* @since 3.7
*/
function wprss_feed_processing_meta_box_callback()
{
global $post;
// Get the post meta
$state = get_post_meta($post->ID, 'wprss_state', TRUE);
$activate = get_post_meta($post->ID, 'wprss_activate_feed', TRUE);
$pause = get_post_meta($post->ID, 'wprss_pause_feed', TRUE);
$update_interval = get_post_meta($post->ID, 'wprss_update_interval', TRUE);
$age_limit = get_post_meta($post->ID, 'wprss_age_limit', FALSE);
$age_unit = get_post_meta($post->ID, 'wprss_age_unit', FALSE);
$age_limit = count($age_limit) === 0 ? wprss_get_general_setting('limit_feed_items_age') : $age_limit[0];
$age_unit = count($age_unit) === 0 ? wprss_get_general_setting('limit_feed_items_age_unit') : $age_unit[0];
// Set default strings for activate and pause times
$default_activate = 'immediately';
$default_pause = 'never';
// Prepare the states
$states = array('active' => __('Active', 'wprss'), 'paused' => __('Paused', 'wprss'));
// Prepare the schedules
$default_interval = __('Default', 'wprss');
$wprss_schedules = apply_filters('wprss_schedules', wprss_get_schedules());
$default_interval_key = wprss_get_default_feed_source_update_interval();
$schedules = array_merge(array($default_interval_key => array('display' => $default_interval, 'interval' => $default_interval)), $wprss_schedules);
?>
<div class="wprss-meta-side-setting">
<label for="wprss_state">Feed state:</label>
<select id="wprss_state" name="wprss_state">
<?php
foreach ($states as $value => $label) {
?>
<option value="<?php
echo $value;
?>
" <?php
selected($state, $value);
?>
><?php
echo $label;
?>
</option>
<?php
}
?>
</select>
</div>
<div class="wprss-meta-side-setting">
<p>
<label for="">Activate feed: </label>
<strong id="wprss-activate-feed-viewer"><?php
echo $activate !== '' ? $activate : $default_activate;
?>
</strong>
<a href="#">Edit</a>
</p>
<div class="wprss-meta-slider" data-collapse-viewer="wprss-activate-feed-viewer" data-default-value="<?php
echo $default_activate;
?>
">
<input id="wprss_activate_feed" class="wprss-datetimepicker-from-today" name="wprss_activate_feed" value="<?php
echo $activate;
?>
" />
<label class="description" for="wprss_activate_feed">
Leave blank to activate the feed immediately.
</label>
<br/><br/>
<span class="description">
<b>Note:</b> WordPress uses UTC time for schedules, not local time. Current UTC time is: <code><?php
echo date('d/m/Y H:i:s', current_time('timestamp', 1));
?>
</code>
</span>
</div>
</div>
<div class="wprss-meta-side-setting">
<p>
<label for="">Pause feed: </label>
<strong id="wprss-pause-feed-viewer"><?php
echo $pause !== '' ? $pause : $default_pause;
?>
</strong>
<a href="#">Edit</a>
</p>
<div class="wprss-meta-slider" data-collapse-viewer="wprss-pause-feed-viewer" data-default-value="<?php
echo $default_pause;
?>
">
<input id="wprss_pause_feed" class="wprss-datetimepicker-from-today" name="wprss_pause_feed" value="<?php
echo $pause;
?>
//.........这里部分代码省略.........
开发者ID:kivivuori,项目名称:jotain,代码行数:101,代码来源:admin-metaboxes.php
示例6: wprss_addfeed_do_feed
/**
* Generate the feed
*
* @since 3.3
*/
function wprss_addfeed_do_feed($in)
{
// Prepare the post query
/*
$wprss_custom_feed_query = apply_filters(
'wprss_custom_feed_query',
array(
'post_type' => 'wprss_feed_item',
'post_status' => 'publish',
'cache_results' => false, // disable caching
)
);*/
$wprss_custom_feed_query = wprss_get_feed_items_query(apply_filters('wprss_custom_feed_query', array('get-args' => TRUE, 'no-paged' => TRUE, 'feed_limit' => 0)));
// Suppress caching
$wprss_custom_feed_query['cache_results'] = FALSE;
// Get options
$options = get_option('wprss_settings_general');
if ($options !== FALSE) {
// If options exist, get the limit
$limit = $options['custom_feed_limit'];
if ($limit !== FALSE) {
// if limit exists, set the query limit
$wprss_custom_feed_query['posts_per_page'] = $limit;
}
}
// Submit the query to get latest feed items
query_posts($wprss_custom_feed_query);
$custom_feed_title = wprss_get_general_setting('custom_feed_title');
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
header("{$protocol} 200 OK");
// Send content header and start ATOM output
header('Content-Type: application/rss+xml');
// Disabling caching
header('Cache-Control: no-cache, no-store, must-revalidate');
// HTTP 1.1.
header('Pragma: no-cache');
// HTTP 1.0.
header('Expires: 0');
// Proxies.
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?>';
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:media="http://search.yahoo.com/mrss/" >
<channel>
<title><?php
echo $custom_feed_title;
?>
</title>
<description></description>
<link><?php
echo get_site_url();
?>
</link>
<atom:link href="<?php
echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
?>
" rel="self" type="application/rss+xml" />
<?php
// Start the Loop
while (have_posts()) {
the_post();
$source = get_post_meta(get_the_ID(), 'wprss_feed_id', TRUE);
$permalink = get_post_meta(get_the_ID(), 'wprss_item_permalink', true);
?>
<item>
<title><![CDATA[<?php
the_title_rss();
?>
]]></title>
<link><?php
echo $permalink;
?>
</link>
<guid isPermaLink="true"><?php
echo $permalink;
?>
</guid>
<pubDate><?php
echo get_post_time(DATE_RSS);
?>
</pubDate>
<description><![CDATA[<?php
the_content();
?>
]]></description>
<content:encoded><![CDATA[<?php
//.........这里部分代码省略.........
开发者ID:marinabalan,项目名称:votezinformat,代码行数:101,代码来源:custom-feed.php
示例7: wprss_fetch_insert_single_feed_items
/**
* The main feed fetching function.
* Fetches the feed items from the source provided and inserts them into the DB.
*
* Called on hook 'wprss_fetch_single_feed_hook'.
*
* @since 3.2
*/
function wprss_fetch_insert_single_feed_items($feed_ID)
{
// Check if the feed source is active.
if (wprss_is_feed_source_active($feed_ID) === FALSE && wprss_feed_source_force_next_fetch($feed_ID) === FALSE) {
// If it is not active ( paused ), return without fetching the feed items.
return;
}
// If the feed source is forced for next fetch, remove the force next fetch data
if (wprss_feed_source_force_next_fetch($feed_ID)) {
delete_post_meta($feed_ID, 'wprss_force_next_fetch');
}
update_post_meta($feed_ID, 'wprss_feed_is_updating', time());
// Get the feed source URL from post meta, and filter it
$feed_url = get_post_meta($feed_ID, 'wprss_url', true);
$feed_url = apply_filters('wprss_feed_source_url', $feed_url, $feed_ID);
// Get the feed limit from post meta
$feed_limit = get_post_meta($feed_ID, 'wprss_limit', true);
// If the feed has no individual limit
if ($feed_limit === '' || intval($feed_limit) <= 0) {
// Get the global limit
$global_limit = wprss_get_general_setting('limit_feed_items_imported');
// If no global limit is set, mark as NULL
if ($global_limit === '' || intval($global_limit) <= 0) {
$feed_limit = NULL;
} else {
$feed_limit = $global_limit;
}
}
// Filter the URL for validaty
if (filter_var($feed_url, FILTER_VALIDATE_URL)) {
// Get the feed items from the source
$items = wprss_get_feed_items($feed_url, $feed_ID);
// If got NULL, convert to an empty array
if ($items === NULL) {
$items = array();
}
// If using a limit ...
if ($feed_limit === NULL) {
$items_to_insert = $items;
} else {
$items_to_insert = array_slice($items, 0, $feed_limit);
}
// Gather the permalinks of existing feed item's related to this feed source
$existing_permalinks = get_existing_permalinks($feed_ID);
// Generate a list of items fetched, that are not already in the DB
$new_items = array();
foreach ($items_to_insert as $item) {
$permalink = wprss_normalize_permalink($item->get_permalink());
// Check if not blacklisted and not already imported
if (wprss_is_blacklisted($permalink) === FALSE && !in_array(trim($permalink), $existing_permalinks)) {
$new_items[] = $item;
}
}
$items_to_insert = $new_items;
// If using a limit - delete any excess items to make room for the new items
if ($feed_limit !== NULL) {
// Get the number of feed items in DB, and their count
$db_feed_items = wprss_get_feed_items_for_source($feed_ID);
$num_db_feed_items = $db_feed_items->post_count;
// Get the number of feed items we can store until we reach the limit
$num_can_insert = $feed_limit - $num_db_feed_items;
// Calculate how many feed items we must delete before importing, to keep to the limit
$num_feed_items_to_delete = count($new_items) - $num_can_insert;
// Get an array with the DB feed items in reverse order (oldest first)
$db_feed_items_reversed = array_reverse($db_feed_items->posts);
// Cut the array to get only the first few that are to be deleted ( equal to $num_feed_items_to_delete )
$feed_items_to_delete = array_slice($db_feed_items_reversed, 0, $num_feed_items_to_delete);
// Iterate the feed items and delete them
foreach ($feed_items_to_delete as $key => $post) {
wp_delete_post($post->ID, TRUE);
}
}
update_post_meta($feed_ID, 'wprss_last_update', time());
// Insert the items into the db
if (!empty($items_to_insert)) {
wprss_items_insert_post($items_to_insert, $feed_ID);
}
} else {
wprss_log("The feed URL is not valid! Please recheck.");
}
$next_scheduled = get_post_meta($feed_ID, 'wprss_reschedule_event', TRUE);
if ($next_scheduled !== '') {
wprss_feed_source_update_start_schedule($feed_ID);
delete_post_meta($feed_ID, 'wprss_reschedule_event');
}
delete_post_meta($feed_ID, 'wprss_feed_is_updating');
}
开发者ID:zhengxiexie,项目名称:wordpress,代码行数:95,代码来源:feed-importing.php
示例8: wprss_feed_processing_meta_box_callback
/**
* Renders the Feed Processing metabox
*
* @since 3.7
*/
function wprss_feed_processing_meta_box_callback()
{
global $post;
// Get the post meta
$state = get_post_meta($post->ID, 'wprss_state', TRUE);
$activate = get_post_meta($post->ID, 'wprss_activate_feed', TRUE);
$pause = get_post_meta($post->ID, 'wprss_pause_feed', TRUE);
$update_interval = get_post_meta($post->ID, 'wprss_update_interval', TRUE);
$age_limit = get_post_meta($post->ID, 'wprss_age_limit', FALSE);
$age_unit = get_post_meta($post->ID, 'wprss_age_unit', FALSE);
$age_limit = count($age_limit) === 0 ? wprss_get_general_setting('limit_feed_items_age') : $age_limit[0];
$age_unit = count($age_unit) === 0 ? wprss_get_general_setting('limit_feed_items_age_unit') : $age_unit[0];
// Set default strings for activate and pause times
$default_activate = 'immediately';
$default_pause = 'never';
// Prepare the states
$states = array('active' => __('Active', WPRSS_TEXT_DOMAIN), 'paused' => __('Paused', WPRSS_TEXT_DOMAIN));
// Prepare the schedules
$default_interval = __('Default', WPRSS_TEXT_DOMAIN);
$wprss_schedules = apply_filters('wprss_schedules', wprss_get_schedules());
$default_interval_key = wprss_get_default_feed_source_update_interval();
$schedules = array_merge(array($default_interval_key => array('display' => $default_interval, 'interval' => $default_interval)), $wprss_schedules);
// Inline help
$help = WPRSS_Help::get_instance();
$help_options = array('tooltip_handle_class_extra' => $help->get_options('tooltip_handle_class_extra') . ' ' . $help->get_options('tooltip_handle_class') . '-side');
?>
<div class="wprss-meta-side-setting">
<label for="wprss_state">Feed state:</label>
<select id="wprss_state" name="wprss_state">
<?php
foreach ($states as $value => $label) {
?>
<option value="<?php
echo $value;
?>
" <?php
selected($state, $value);
?>
><?php
echo $label;
?>
</option>
<?php
}
?>
</select>
<?php
echo $help->tooltip('field_wprss_state', null, $help_options);
?>
</div>
<div class="wprss-meta-side-setting">
<p>
<label for="">Activate feed: </label>
<strong id="wprss-activate-feed-viewer"><?php
echo $activate !== '' ? $activate : $default_activate;
?>
</strong>
<a href="#">Edit</a>
<?php
echo $help->tooltip('field_wprss_activate_feed', null, $help_options);
?>
</p>
<div class="wprss-meta-slider" data-collapse-viewer="wprss-activate-feed-viewer" data-default-value="<?php
echo $default_activate;
?>
">
<input id="wprss_activate_feed" class="wprss-datetimepicker-from-today" name="wprss_activate_feed" value="<?php
echo $activate;
?>
" />
<span class="description">
Current UTC time is:<br/><code><?php
echo date('d/m/Y H:i:s', current_time('timestamp', 1));
?>
</code>
</span>
</div>
</div>
<div class="wprss-meta-side-setting">
<p>
<label for="">Pause feed: </label>
<strong id="wprss-pause-feed-viewer"><?php
echo $pause !== '' ? $pause : $default_pause;
?>
</strong>
<a href="#">Edit</a>
<?php
echo $help->tooltip('field_wprss_pause_feed', null, $help_options);
?>
</p>
<div class="wprss-meta-slider" data-collapse-viewer="wprss-pause-feed-viewer" data-default-value="<?php
echo $default_pause;
//.........这里部分代码省略.........
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:101,代码来源:admin-metaboxes.php
示例9: wprss_get_max_age_for_feed_source
/**
* Returns the maximum age setting for a feed source.
*
* @since 3.8
*/
function wprss_get_max_age_for_feed_source($source_id)
{
$general_settings = get_option('wprss_settings_general');
// Get the meta data for age for this feed source
$age_limit = trim(get_post_meta($source_id, 'wprss_age_limit', TRUE));
$age_unit = get_post_meta($source_id, 'wprss_age_unit', TRUE);
// If the meta does not exist, use the global settings
if ($age_limit === '') {
$age_limit = trim(wprss_get_general_setting('limit_feed_items_age'));
$age_unit = wprss_get_general_setting('limit_feed_items_age_unit');
}
// If the age limit is an empty string, use no limit
if ($age_limit === '') {
return FALSE;
}
// Return the timestamp of the max age date
return strtotime("-{$age_limit} {$age_unit}");
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:23,代码来源:feed-processing.php
示例10: wprss_fetch_insert_single_feed_items
/**
* The main feed fetching function.
* Fetches the feed items from the source provided and inserts them into the DB.
*
* Called on hook 'wprss_fetch_single_feed_hook'.
*
* @since 3.2
*/
function wprss_fetch_insert_single_feed_items($feed_ID)
{
wprss_log_obj('Starting import of feed', $feed_ID, null, WPRSS_LOG_LEVEL_INFO);
global $wprss_importing_feed;
$wprss_importing_feed = $feed_ID;
register_shutdown_function('wprss_detect_exec_timeout');
// Check if the feed source is active.
if (wprss_is_feed_source_active($feed_ID) === FALSE && wprss_feed_source_force_next_fetch($feed_ID) === FALSE) {
// If it is not active ( paused ), return without fetching the feed items.
wprss_log('Feed is not active and not forced. Import cancelled.', null, WPRSS_LOG_LEVEL_INFO);
return;
}
// If the feed source is forced for next fetch, remove the force next fetch data
if (wprss_feed_source_force_next_fetch($feed_ID)) {
delete_post_meta($feed_ID, 'wprss_force_next_fetch');
wprss_log('Force feed flag removed', null, WPRSS_LOG_LEVEL_SYSTEM);
}
$start_of_update = wprss_flag_feed_as_updating($feed_ID);
wprss_log_obj('Start of import time updated', date('Y-m-d H:i:s', $start_of_update), null, WPRSS_LOG_LEVEL_SYSTEM);
// Get the feed source URL from post meta, and filter it
$feed_url = get_post_meta($feed_ID, 'wprss_url', true);
wprss_log_obj('Original feed source URL', $feed_url, null, WPRSS_LOG_LEVEL_SYSTEM);
$feed_url = apply_filters('wprss_feed_source_url', $feed_url, $feed_ID);
wprss_log_obj('Actual feed source URL', $feed_url, null, WPRSS_LOG_LEVEL_INFO);
// Get the feed limit from post meta
$feed_limit = get_post_meta($feed_ID, 'wprss_limit', true);
wprss_log_obj('Feed limit value is', $feed_limit, null, WPRSS_LOG_LEVEL_SYSTEM);
// If the feed has no individual limit
if ($feed_limit === '' || intval($feed_limit) <= 0) {
wprss_log_obj('Using global limit', $feed_limit, null, WPRSS_LOG_LEVEL_NOTICE);
// Get the global limit
$global_limit = wprss_get_general_setting('limit_feed_items_imported');
// If no global limit is set, mark as NULL
if ($global_limit === '' || intval($global_limit) <= 0) {
$feed_limit = NULL;
} else {
$feed_limit = $global_limit;
}
}
wprss_log_obj('Feed import limit', $feed_limit, null, WPRSS_LOG_LEVEL_INFO);
// Filter the URL for validaty
if (wprss_validate_url($feed_url)) {
wprss_log_obj('Feed URL is valid', $feed_url, null, WPRSS_LOG_LEVEL_INFO);
// Get the feed items from the source
$items = wprss_get_feed_items($feed_url, $feed_ID);
// If got NULL, convert to an empty array
if ($items === NULL) {
$items = array();
wprss_log('Items were NULL. Using empty array', null, WPRSS_LOG_LEVEL_WARNING);
}
// If using a limit ...
if ($feed_limit === NULL) {
$items_to_insert = $items;
} else {
$items_to_insert = array_slice($items, 0, $feed_limit);
wprss_log_obj('Sliced a segment of items', count($items_to_insert), null, WPRSS_LOG_LEVEL_SYSTEM);
}
// Gather the permalinks of existing feed item's related to this feed source
$existing_permalinks = wprss_get_existing_permalinks($feed_ID);
wprss_log_obj('Retrieved existing permalinks', count($existing_permalinks), null, WPRSS_LOG_LEVEL_SYSTEM);
// Check if we should only import uniquely-titled feed items.
$existing_titles = array();
$unique_titles = FALSE;
if (wprss_get_general_setting('unique_titles')) {
$unique_titles = TRUE;
$existing_titles = wprss_get_existing_titles();
wprss_log_obj('Retrieved existing titles from global', count($existing_titles), null, WPRSS_LOG_LEVEL_SYSTEM);
} else {
if (get_post_meta($feed_ID, 'wprss_unique_titles', true) === 'true') {
$unique_titles = TRUE;
$existing_titles = wprss_get_existing_titles($feed_ID);
wprss_log_obj('Retrieved existing titles from feed source', count($existing_titles), null, WPRSS_LOG_LEVEL_SYSTEM);
}
}
// Generate a list of items fetched, that are not already in the DB
$new_items = array();
foreach ($items_to_insert as $item) {
$permalink = wprss_normalize_permalink($item->get_permalink());
wprss_log_obj('Normalizing permalink', sprintf('%1$s -> %2$s', $item->get_permalink(), $permalink), null, WPRSS_LOG_LEVEL_SYSTEM);
// Check if not blacklisted and not already imported
$is_blacklisted = wprss_is_blacklisted($permalink);
$permalink_exists = array_key_exists($permalink, $existing_permalinks);
$title_exists = array_key_exists($item->get_title(), $existing_titles);
if ($is_blacklisted === FALSE && $permalink_exists === FALSE && $title_exists === FALSE) {
$new_items[] = $item;
wprss_log_obj('Permalink OK', $permalink, null, WPRSS_LOG_LEVEL_SYSTEM);
if ($unique_titles) {
$existing_titles[$item->get_title()] = 1;
}
} else {
if ($is_blacklisted) {
wprss_log('Permalink blacklisted', null, WPRSS_LOG_LEVEL_SYSTEM);
//.........这里部分代码省略.........
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:101,代码来源:feed-importing.php
示例11: wprss_setting_time_ago_format_enable_callback
/**
* Time ago format checkbox
* @since 4.2
*/
function wprss_setting_time_ago_format_enable_callback($field)
{
$time_ago_format = wprss_get_general_setting('time_ago_format_enable');
?>
<input type="checkbox" id="<?php
echo $field['field_id'];
?>
" name="wprss_settings_general[time_ago_format_enable]" value="1" <?php
echo checked(1, $time_ago_format, false);
?>
/>
<?php
echo wprss_settings_inline_help($field['field_id'], $field['tooltip']);
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:18,代码来源:admin-options.php
示例12: wprss_pagination_links
/**
* Display pagination links
*
* @since 3.5
*/
function wprss_pagination_links($output)
{
// Get the general setting
$pagination = wprss_get_general_setting('pagination');
// Check the pagination setting, if using page numbers
if ($pagination === 'numbered') {
global $wp_query;
$big = 999999999;
// need an unlikely integer
$output .= paginate_links(array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'format' => '?paged=%#%', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages));
return $output;
} else {
$output .= '<div class="nav-links">';
$output .= ' <div class="nav-previous alignleft">' . get_next_posts_link(__('Older posts', WPRSS_TEXT_DOMAIN)) . '</div>';
$output .= ' <div class="nav-next alignright">' . get_previous_posts_link(__('Newer posts', WPRSS_TEXT_DOMAIN)) . '</div>';
$output .= '</div>';
return $output;
}
}
开发者ID:wangshijun101,项目名称:morketing.cn,代码行数:24,代码来源:feed-display.php
示例13: wprss_addfeed_do_feed
/**
* Generate the feed
*
* @since 3.3
*/
function wprss_addfeed_do_feed($in)
{
// Prepare the post query
/*
$wprss_custom_feed_query = apply_filters(
'wprss_custom_feed_query',
array(
'post_type' => 'wprss_feed_item',
'post_status' => 'publish',
'cache_results' => false, // disable caching
)
);*/
$wprss_custom_feed_query = wprss_get_feed_items_query(apply_filters('wprss_custom_feed_query', array('get-args' => TRUE, 'no-paged' => TRUE, 'feed_limit' => 0)));
// Suppress caching
$wprss_custom_feed_query['cache_results'] = FALSE;
// Get options
$options = get_option('wprss_settings_general');
if ($options !== FALSE) {
// If options exist, get the limit
$limit = $options['custom_feed_limit'];
if ($limit !== FALSE) {
// if limit exists, set the query limit
$wprss_custom_feed_query['posts_per_page'] = $limit;
}
}
// Submit the query to get latest feed items
query_posts($wprss_custom_feed_query);
$custom_feed_title = wprss_get_general_setting('custom_feed_title');
// Send content header and start ATOM output
header('Content-Type: text/xml');
// Disabling caching
header('Cache-Control: no-cache, no-store, must-revalidate');
// HTTP 1.1.
header('Pragma: no-cache');
// HTTP 1.0.
header('Expires: 0');
// Proxies.
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" >
<title type="text"><?php
echo $custom_feed_title;
?>
</title>
<?php
// Start the Loop
while (have_posts()) {
the_post();
$permalink = get_post_meta(get_the_ID(), 'wprss_item_permalink', true);
?>
<entry>
<title><![CDATA[<?php
the_title_rss();
?>
]]></title>
<link href="<?php
echo $permalink;
?>
" />
<?php
// Enable below to link to post on our site rather than original source
?>
<!--<link href="<?php
the_permalink_rss();
?>
" />-->
<published><?php
echo get_post_time('Y-m-d\\TH:i:s\\Z');
?>
</published>
<content type="html"><![CDATA[<?php
the_content();
?>
]]></content>
<?php
do_action('wprss_custom_feed_entry', get_the_ID());
?>
</entry>
<?php
// End of the Loop
}
?>
</feed>
<?php
}
开发者ID:kivivuori,项目名称:jotain,代码行数:91,代码来源:custom-feed.php
示例14: wprss_setting_time_ago_format_enable_callback
/**
* Time ago format checkbox
* @since 4.2
*/
function wprss_setting_time_ago_format_enable_callback()
{
$time_ago_format = wprss_get_general_setting('time_ago_format_enable');
echo "<input type='checkbox' id='time-ago-format' name='wprss_settings_general[time_ago_format_enable]' value='1' " . checked(1, $time_ago_format, false) . " />";
echo "<label class='description' for='time-ago-format'>Check this box to show time since update e.g.: 2 hours ago.</label>";
}
开发者ID:zhengxiexie,项目名称:wordpress,代码行数:10,代码来源:admin-options.php
示例15: wprss_setting_log_level_callback
/**
* Renders the 'log_level' setting field.
*
* @param array $field Info about the field
*/
function wprss_setting_log_level_callback($field)
{
$log_level = wprss_get_general_setting($field['field_id']);
foreach (wprss_log_get_levels(false) as $_level => $_label) {
$options[$_level] = $_label;
if (is_numeric($_level) && $_level / 2 >= 1) {
$options[(int) $_level * -1] = $_label . ' and below';
}
}
krsort($options, defined('SORT_NATURAL' ? SORT_NATURAL : SORT_STRING));
?>
<select id="<?php
echo $field['field_id'];
?>
" name="wprss_settings_general[<?php
echo $field['field_id'];
?>
]">
<?php
foreach ($options as $value => $text) {
$selected = (string) $value === (string) $log_level ? 'selected="selected"' : '';
?>
<option value="<?php
echo $value;
?>
" <?php
echo $selected;
?>
><?php
echo __($text, WPRSS_TEXT_DOMAIN);
?>
</option><?php
}
?>
</select>
<?php
echo wprss_settings_inline_help($field['field_id'], $field['tooltip']);
}
开发者ID:marinabalan,项目名称:votezinformat,代码行数:43,代码来源:admin-log.php
注:本文中的wprss_get_general_setting函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论