本文整理汇总了PHP中get_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP get_settings函数的具体用法?PHP get_settings怎么用?PHP get_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_wp_tables
function upgrade_wp_tables()
{
global $xoopsDB;
require_once dirname(dirname(__FILE__)) . '/wp-config.php';
if ($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('postmeta')) == false) {
$sql1 = "CREATE TABLE " . wp_table('postmeta') . " (\n\t\t\t\t\t\tmeta_id int(11) NOT NULL auto_increment,\n\t\t\t\t\t\tpost_id int(11) NOT NULL default '0',\n\t\t\t\t\t\tmeta_key varchar(255) default NULL,\n\t\t\t\t\t\tmeta_value text,\n\t\t\t\t\t\tPRIMARY KEY\t (meta_id),\n\t\t\t\t\t\tKEY post_id (post_id),\n\t\t\t\t\t\tKEY meta_key (meta_key)\n\t\t\t\t\t)";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('postmeta') . " is added.";
}
if (!$xoopsDB->getRowsNum($xoopsDB->query("SHOW COLUMNS FROM " . wp_table('comments') . " LIKE 'comment_type'"))) {
$sql1 = "ALTER TABLE " . wp_table('comments') . " ADD (\n\t\t\t\t\t\tcomment_agent varchar(255) NOT NULL default '',\n\t\t\t\t\t\tcomment_type varchar(20) NOT NULL default '',\n\t\t\t\t\t\tcomment_parent int(11) NOT NULL default '0',\n\t\t\t\t\t\tuser_id int(11) NOT NULL default '0'\n\t\t\t\t\t)";
$xoopsDB->query($sql1);
$GLOBALS['msgs'][] = "TABLE " . wp_table('comments') . " is modified.";
}
# --------------------------------------------------------
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =7 AND option_name ='new_users_can_blog'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =7");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =8 AND option_name ='users_can_register'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =8");
}
if ($xoopsDB->query("DELETE FROM " . wp_table('options') . " WHERE option_id =91 AND option_name ='gzipcompression'")) {
$xoopsDB->query("DELETE FROM " . wp_table('optiongroup_options') . " WHERE group_id=6 AND option_id =91");
}
if (!get_settings('use_comment_preview')) {
add_option('use_comment_preview', '0', 2, "Display Preview Screen after comment posting.", 2, 8);
}
if (!get_settings('active_plugins')) {
add_option('active_plugins', "\n");
}
}
示例2: timesince
function timesince()
{
global $post;
$older_date = abs(strtotime($post->post_date_gmt . " GMT"));
$newer_date = time();
$chunks = array(array(60 * 60 * 24 * 365, 'year'), array(60 * 60 * 24 * 30, 'month'), array(60 * 60 * 24 * 7, 'week'), array(60 * 60 * 24, 'day'), array(60 * 60, 'hour'), array(60, 'minute'));
$newer_date = $newer_date == false ? time() + 60 * 60 * get_settings("gmt_offset") : $newer_date;
$since = $newer_date - $older_date;
for ($i = 0, $j = count($chunks); $i < $j; $i++) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
if (($count = floor($since / $seconds)) != 0) {
break;
}
}
$output = $count == 1 ? '1 ' . $name : "{$count} {$name}s";
if ($i + 1 < $j) {
$seconds2 = $chunks[$i + 1][0];
$name2 = $chunks[$i + 1][1];
if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
$output .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}s";
}
}
echo $output;
}
示例3: wptouch_time_since
function wptouch_time_since($older_date, $newer_date = false)
{
// array of time period chunks
$chunks = array(array(60 * 60 * 24 * 30, __('mo', 'wptouch')), array(60 * 60 * 24 * 7, __('wk', 'wptouch')), array(60 * 60 * 24, __('day', 'wptouch')), array(60 * 60, __('hr', 'wptouch')), array(60, __('min', 'wptouch')));
$newer_date = $newer_date == false ? time() + 60 * 60 * get_settings("gmt_offset") : $newer_date;
// difference in seconds
$since = $newer_date - $older_date;
for ($i = 0, $j = count($chunks); $i < $j; $i++) {
$seconds = $chunks[$i][0];
$name = $chunks[$i][1];
// finding the biggest chunk (if the chunk fits, break)
if (($count = floor($since / $seconds)) != 0) {
break;
}
}
// set output var
$output = $count == 1 ? '1 ' . $name : "{$count} {$name}s";
// step two: the second chunk
if ($i + 1 < $j) {
$seconds2 = $chunks[$i + 1][0];
$name2 = $chunks[$i + 1][1];
if (($count2 = floor(($since - $seconds * $count) / $seconds2)) != 0) {
// add to output var
$output .= $count2 == 1 ? ', 1 ' . $name2 : ", {$count2} {$name2}s";
}
}
return $output;
}
示例4: widget_king_admin_head
/**
* @desc Output of king widget css and js in admin head area. Is included in every king widget
* @author Georg Leciejewski
*/
function widget_king_admin_head()
{
//$js_dir = str_replace(ABSPATH, get_settings('siteurl').'/', dirname(__FILE__)) . '/js';
$js_dir = get_settings('siteurl') . '/wp-content/plugins/king-includes/js/';
$css_dir = get_settings('siteurl') . '/wp-content/plugins/king-includes/css/';
if (strpos($_SERVER['REQUEST_URI'], 'themes.php') !== false || strpos($_SERVER['REQUEST_URI'], 'king-framework.php') !== false) {
# only include in themes area
echo '<link rel="stylesheet" href="' . $css_dir . 'king_widget.css" type="text/css" media="screen" />' . "\n";
echo '<script type="text/javascript" src="' . $js_dir . 'jquery.js"></script>' . "\n";
echo '<script type="text/javascript" src="' . $js_dir . 'jquery_plugins.js"></script>' . "\n";
echo '<script type="text/javascript" src="' . $js_dir . 'tooltip.js"></script>' . "\n";
echo '<script type="text/javascript" src="' . $js_dir . 'king_widgets.js"></script>' . "\n";
load_plugin_textdomain('widgetKing', '/wp-content/plugins/king-includes/lang');
} elseif (strpos($_SERVER['REQUEST_URI'], 'post.php') !== false) {
# only include in post article temp. disabled since incompatibilities
# and new methods to add js to head in wp2.1
// echo '<link rel="stylesheet" href="'. $css_dir.'king_admin.css" type="text/css" media="screen" />'."\n";
// echo '<script type="text/javascript" src="'.$js_dir.'jquery.js"></script>'."\n";
// echo '<script type="text/javascript" src="'.$js_dir.'jquery_plugins.js"></script>'."\n";
// echo '<script type="text/javascript" src="'.$js_dir.'king_admin.js"></script>'."\n";
}
if (strpos($_SERVER['REQUEST_URI'], 'plugins.php') !== false) {
echo '<script type="text/javascript" src="' . $js_dir . 'prototype-1.4.0.js"></script>' . "\n";
load_plugin_textdomain('widgetKing', '/wp-content/plugins/king-includes/lang');
}
}
示例5: __construct
/**
*
*/
function __construct()
{
$apiKey = get_settings('site_settings', 'gerencianet_apikey');
$apiSecret = get_settings('site_settings', 'gerencianet_apisecret');
$options = ['client_id' => $apiKey, 'client_secret' => $apiSecret, 'sandbox' => ENVIRONMENT == 'development' ? true : false];
$this->api = new Gerencianet($options);
}
示例6: wp_mail
function wp_mail($to, $subject, $message, $headers = '')
{
if ($headers == '') {
$headers = "MIME-Version: 1.0\n" . "From: " . get_settings('admin_email') . "\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
}
return @mail($to, $subject, $message, $headers);
}
示例7: etruel_AdServe_Bannersave
function etruel_AdServe_Bannersave($id)
{
global $wpdb, $table_prefix;
$table_name = $wpdb->prefix . "adserve";
$scriptcode = isset($_POST['scriptcode']) ? 1 : 0;
$src = !empty($_POST['src']) ? $_POST['src'] : '';
$width = !empty($_POST['width']) ? $_POST['width'] : null;
$height = !empty($_POST['height']) ? $_POST['height'] : null;
if ($scriptcode) {
$ok = true;
} else {
$ext = substr($src, strlen($src) - 3, 3);
if ($ext !== 'swf' || $width != null && $height !== null) {
$ok = true;
} else {
$ok = false;
}
}
if ($ok) {
$height = is_null($height) ? 'null' : $height;
$width = is_null($width) ? $height : $width;
if ($id > 0) {
// update
$query = " UPDATE {$table_name}\n SET\n title\t\t='" . $_POST['title'] . "',\n scriptcode \t= " . $scriptcode . ",\n url\t\t\t='" . $_POST['url'] . "',\n src\t\t\t='" . urlencode($src) . "',\n user\t\t='" . $_POST['user'] . "',\n email\t\t='" . $_POST['email'] . "',\n keywords\t='" . $_POST['keywords'] . "',\n width\t\t= " . $width . ",\n height\t\t= " . $height . "\n WHERE id={$id}";
} else {
// insert
$query = " INSERT INTO {$table_name}" . " (title, scriptcode, url, src, email, keywords, impressions, clicks, width, height) " . "VALUES ('" . $_POST['title'] . "', '" . $scriptcode . "', '" . $_POST['url'] . "', '" . urlencode($src) . "', '" . $_POST['email'] . "', '" . $_POST['keywords'] . "',0, 0, {$width}, {$height})";
}
//echo $query."<br>";
$wpdb->query($query);
}
return get_settings('siteurl') . "/wp-admin/admin.php?page=admanage";
}
示例8: mdv_recent_posts
function mdv_recent_posts($no_posts = 10, $before = '<li>', $after = '</li>', $hide_pass_post = true, $skip_posts = 0, $show_excerpts = false)
{
global $wpdb;
$time_difference = get_settings('gmt_offset');
$now = gmdate("Y-m-d H:i:s", time());
$request = "SELECT ID, post_title, post_excerpt FROM {$wpdb->posts} WHERE post_status = 'publish' ";
if ($hide_pass_post) {
$request .= "AND post_password ='' ";
}
$request .= "AND post_date_gmt < '{$now}' ORDER BY post_date DESC LIMIT {$skip_posts}, {$no_posts}";
$posts = $wpdb->get_results($request);
$output = '';
if ($posts) {
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . htmlspecialchars($post_title, ENT_COMPAT) . '">' . htmlspecialchars($post_title) . '</a>';
if ($show_excerpts) {
$post_excerpt = stripslashes($post->post_excerpt);
$output .= '<br />' . $post_excerpt;
}
$output .= $after;
}
} else {
$output .= $before . "None found" . $after;
}
echo $output;
}
示例9: AGCZone_Settings
function AGCZone_Settings()
{
echo '<div class="wrap">';
echo '<h2>AGCZone Plugins Settings</h2>';
echo '<form method="post" action="options.php">';
echo settings_fields('az-settings-group');
echo get_settings('az-settings-group');
echo '<table class="form-table">';
echo '<tr valign="top">';
echo '<th scope="row">Your Amazon Affiliate ID</th>';
echo '<td><input type="text" name="affid" value="' . get_option('affid') . '" /></td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<th scope="row">Your Amazon API Key</th>';
echo '<td><input type="text" name="apikey" value="' . get_option('apikey') . '" /></td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<th scope="row">Your Amazon Secret Key</th>';
echo '<td><input type="text" name="secret_key" value="' . get_option('secret_key') . '" /></td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<th scope="row">Amazon Country</th>';
echo '<td><input type="text" name="region" value="' . get_option('region') . '" /></td>';
echo '</tr>';
echo '<tr valign="top">';
echo '<th scope="row">Sets Category</th>';
echo '<td><input type="text" name="department" value="' . get_option('department') . '" /></td>';
echo '</tr>';
echo '</table>';
echo submit_button();
echo '</form>';
echo '</div>';
}
示例10: ing_recent_posts
public static function ing_recent_posts($no_posts = 8, $before = '<li>', $after = "</li>\n", $hide_pass_post = true, $skip_posts = 0, $type = 'post')
{
global $wpdb;
$time_difference = get_settings('gmt_offset');
$now = gmdate("Y-m-d H:i:s", time());
$request = "SELECT ID, post_title, post_content, DATE_FORMAT(post_date_gmt, '%M %d %Y') as my_date FROM {$wpdb->posts} WHERE post_status = 'publish' ";
if ($hide_pass_post) {
$request .= "AND post_password ='' ";
}
$request .= "AND post_type='{$type}' ";
$request .= "ORDER BY post_date DESC LIMIT {$skip_posts}, {$no_posts}";
$posts = $wpdb->get_results($request);
$output = '';
if ($posts) {
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
$permalink = get_permalink($post->ID);
$content = stripslashes($post->post_content);
$stripedcontent = strip_tags($content);
$shortexcerpt = $this->ing_truncate($stripedcontent, 90);
$output .= $before;
$output .= '<span class="shortexcerpt">' . $shortexcerpt . '</span>';
$output .= '<br /><span class="postdate">' . $post->my_date . '</span> - by <span class="name">' . htmlspecialchars($post_title) . '</span> - <a href="' . $permalink . '" rel="bookmark" class="postlink" title="' . htmlspecialchars($post_title, ENT_COMPAT) . '">Read Post</a> ';
//$output .= '<a href="' . $permalink . '" rel="bookmark" title="' . htmlspecialchars($post_title, ENT_COMPAT) . '">' . htmlspecialchars($post_title). '</a>';
$output .= $after;
}
} else {
$output .= $before . "Sorry, No Recent Stories!" . $after;
}
return $output;
}
示例11: get_news_settings
public static function get_news_settings()
{
if (empty(self::$news_settings)) {
self::$news_settings = get_settings("news");
}
return self::$news_settings;
}
示例12: wpbl_notify
function wpbl_notify($comment_id, $reason, $harvest)
{
global $wpdb, $wp_id, $url, $email, $comment, $user_ip, $comment_post_ID, $author, $tableposts;
$tableposts = $wpdb->posts[$wp_id];
$sql = "SELECT * FROM {$tableposts} WHERE ID='{$comment_post_ID}' LIMIT 1";
$post = $wpdb->get_row($sql);
if (!empty($user_ip)) {
$comment_author_domain = gethostbyaddr($user_ip);
} else {
$comment_author_domain = '';
}
// create the e-mail body
$notify_message = "A new comment on post #{$comment_post_ID} \"" . stripslashes($post->post_title) . "\" has been automatically deleted by the WPBlacklist plugin.\r\n\r\n";
$notify_message .= "Author : {$author} (IP: {$user_ip} , {$comment_author_domain})\r\n";
$notify_message .= "E-mail : {$email}\r\n";
$notify_message .= "URL : {$url}\r\n";
$notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput={$user_ip}\r\n";
$notify_message .= "Comment:\r\n" . stripslashes($comment) . "\r\n\r\n";
$notify_message .= "Triggered by : {$reason}\r\n\r\n";
// add harvested info - if there is any
if (!empty($harvest)) {
$notify_message .= "Harvested the following information:\r\n" . stripslashes($harvest);
}
// e-mail header
$subject = '[' . stripslashes(get_settings('blogname')) . '] Automatically deleted: "' . stripslashes($post->post_title) . '"';
$admin_email = get_settings("admin_email");
$from = "From: {$admin_email}";
// send e-mail
if (function_exists('mb_send_mail')) {
mb_send_mail($admin_email, $subject, $notify_message, $from);
} else {
@mail($admin_email, $subject, $notify_message, $from);
}
return true;
}
示例13: bm_custom_login
function bm_custom_login()
{
// default wordpress mu plugin path
$pluginPath = "/wp-content/mu-plugins/";
// change this to wordpress mu version that has the new login design
$versionCheck = 999;
// is it wordpress mu or wordpress normal?
if (!is_dir($pluginPath)) {
$pluginPath = "/wp-content/plugins/";
$versionCheck = 2.5;
}
$themeVersions = array(array('min' => 0, 'max' => 2.5, 'css' => '/bm-custom-login.css'), array('min' => 2.5, 'max' => 2.7, 'css' => '/bm-custom-login-2.css'), array('min' => 2.7, 'max' => 5, 'css' => '/bm-custom-login-3.css'));
// full plugin path
$pluginUrl = get_settings('siteurl') . $pluginPath . plugin_basename(dirname(__FILE__));
// check which version of wp is being used
$blogVersion = substr(get_bloginfo('version'), 0, 3);
// split style sheets based upon current wp version
foreach ($themeVersions as $version) {
if ($blogVersion >= $version['min'] && $blogVersion < $version['max']) {
$pluginUrl .= $version['css'];
break;
}
}
echo '<link rel="stylesheet" type="text/css" href="' . $pluginUrl . '" />';
}
示例14: check_option
function check_option($opt)
{
$settings = get_settings('bas_options');
if (in_array($opt, $settings)) {
echo ' checked="checked"';
}
}
示例15: pg_action_init
function pg_action_init()
{
global $pg_options;
include 'js/atatari.php';
load_plugin_textdomain('platesgenerator', false, dirname(plugin_basename(__FILE__)) . '/languages/');
$pg_options = array('your_reg_caption' => __('your_reg_caption', 'platesgenerator'), 'your_reg_description' => __('your_reg_description', 'platesgenerator'), 'plate_size_caption' => __('plate_size_caption', 'platesgenerator'), 'text_style_caption' => __('text_style_caption', 'platesgenerator'), 'badge_caption' => __('badge_caption', 'platesgenerator'), 'border_caption' => __('border_caption', 'platesgenerator'), 'slogan_caption' => __('slogan_caption', 'platesgenerator'), 'your_mail' => get_settings('admin_email'));
}