本文整理汇总了PHP中get_site_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site_url函数的具体用法?PHP get_site_url怎么用?PHP get_site_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_form_feedback
function send_form_feedback()
{
if ($_POST) {
// Set wp_mail html content type
add_filter('wp_mail_content_type', 'set_html_content_type');
$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$phone = isset($_POST['phone']) ? $_POST['phone'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';
$to = get_option('admin_email');
$subject = 'Новое сообщение';
$content = '<p><b>Имя:</b> ' . $name . '</p>';
$content .= '<p><b>E-mail:</b> ' . $email . '</p>';
$content .= '<p><b>Телефон:</b> ' . $phone . '</p>';
$content .= '<p><b>Сообщение:</b></p>';
$content .= '<p>' . $message . '</p>';
$content .= '<br /><br />';
$content .= 'Это сообщение отправлено с сайта <a href="' . get_site_url() . '">' . get_site_url() . '</a>';
if (wp_mail($to, $subject, $content)) {
$json = array('status' => 'success', 'message' => '<b>Поздравляем!</b><br />Сообщение успешно отправлено');
} else {
$json = array('status' => 'error', 'message' => '<b>Ошибка!</b><br />Попробуйте позже или свяжитесь с администрацией сайта');
}
// Reset wp_mail html content type
remove_filter('wp_mail_content_type', 'set_html_content_type');
die(json_encode($json));
}
die(json_encode(array('status' => 'error', 'message' => '<b>Что-то пошло не так!</b><br />Попробуйте позже или свяжитесь с администрацией сайта')));
}
示例2: update_plugins
/**
* Update WordPress plugin list page.
*
* @param object $transient
* @return object
*/
public static function update_plugins( $transient ) {
$extensions = Ai1wm_Extensions::get();
// Get current updates
$updates = get_option( AI1WM_UPDATER, array() );
// Get extension updates
foreach ( $updates as $slug => $update ) {
if ( isset( $extensions[ $slug ]) && ( $extension = $extensions[ $slug ] ) ) {
if ( get_option( $extension['key'] ) ) {
if ( version_compare( $extension['version'], $update['version'], '<' ) ) {
// Get Site URL
$url = urlencode( get_site_url() );
// Get Purchase ID
$key = get_option( $extension['key'] );
// Set plugin details
$transient->response[ $extension['basename'] ] = (object) array(
'slug' => $slug,
'new_version' => $update['version'],
'url' => $update['homepage'],
'plugin' => $extension['basename'],
'package' => sprintf( '%s/%s?siteurl=%s', $update['download_link'], $key, $url ),
);
}
}
}
}
return $transient;
}
示例3: CheckLoginCookie
function CheckLoginCookie()
{
global $wpdb, $ewd_feup_user_table_name;
$LoginTime = get_option("EWD_FEUP_Login_Time");
$Salt = get_option("EWD_FEUP_Hash_Salt");
$CookieName = "EWD_FEUP_Login" . "%" . sha1(md5(get_site_url() . $Salt));
$cookie_name_url_encoded = urlencode($CookieName);
$Cookie = null;
if (isset($_COOKIE[$CookieName])) {
$Cookie = $_COOKIE[$CookieName];
}
if (isset($_COOKIE[$cookie_name_url_encoded])) {
$Cookie = $_COOKIE[$cookie_name_url_encoded];
}
$Username = substr($Cookie, 0, strpos($Cookie, "%"));
$TimeStamp = substr($Cookie, strpos($Cookie, "%") + 1, strrpos($Cookie, "%") - strpos($Cookie, "%"));
$SecCheck = substr($Cookie, strrpos($Cookie, "%") + 1);
$UserAgent = $_SERVER['HTTP_USER_AGENT'];
if (isset($_COOKIE[$CookieName]) || isset($_COOKIE[$cookie_name_url_encoded]) and $TimeStamp < time() + $LoginTime * 60) {
$UserDB = $wpdb->get_row($wpdb->prepare("SELECT User_Sessioncheck , User_Password FROM {$ewd_feup_user_table_name} WHERE Username ='%s'", $Username));
$DBSeccheck = $UserDB->User_Sessioncheck;
if (strcmp(sha1($SecCheck . $UserAgent), $DBSeccheck) === 0) {
$User = array('Username' => $Username, 'User_Password' => $UserDB->User_Password);
return $User;
} else {
return false;
}
}
return false;
}
示例4: avia_menu_item_filter
function avia_menu_item_filter($item)
{
if (isset($item->url) && strpos($item->url, '#DOMAIN') === 0) {
$item->url = str_replace("#DOMAIN", get_site_url(), $item->url);
}
return $item;
}
示例5: flipping_team_install
/** Setup database and sample data */
function flipping_team_install()
{
global $wpdb;
$table_name = $wpdb->prefix . "team";
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
$sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
add_option("flipping_team_db_version", $flipping_team_db_version);
$table_name = $wpdb->prefix . "team";
$name = "Abhishek Gupta";
$website = "http://abhishek.cc";
$info = "Student at IIT Delhi. More about on his website abhishek.cc or his startup zumbl.com .";
$imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
$rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
$table_name = $wpdb->prefix . "team";
$name = "Scii";
$website = "http://scil.coop";
$info = "More about on his website.";
$imageloc = get_site_url() . "/wp-content/plugins/flipping-team/images/images.jpeg";
$rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $name, 'url' => $website, 'imageloc' => $imageloc, 'info' => $info));
}
$installed_ver = get_option("flipping_team_db_version");
if ($installed_ver != $jal_db_version) {
$sql = "CREATE TABLE " . $table_name . " (\n\t\t\tid mediumint(9) NOT NULL AUTO_INCREMENT,\n\t\t\ttime bigint(11) DEFAULT '0' NOT NULL,\n\t\t\tname tinytext NOT NULL,\n\t\t\turl VARCHAR(200) NOT NULL,\n\t\t\timageloc VARCHAR(300) NOT NULL,\n\t\t\tinfo text NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t\t);";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
update_option("flipping_team_db_version", $flipping_team_db_version);
}
}
示例6: activate
/**
*
*/
public function activate()
{
$params = array();
$params['username'] = vc_post_param('username');
$params['version'] = WPB_VC_VERSION;
$params['key'] = vc_post_param('key');
$params['api_key'] = vc_post_param('api_key');
$params['url'] = get_site_url();
$params['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
$params['dkey'] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
$string = 'activatelicense?';
$request_url = self::getWpbControlUrl(array($string, http_build_query($params, '', '&')));
$response = wp_remote_get($request_url, array('timeout' => 300));
if (is_wp_error($response)) {
echo json_encode(array('result' => false));
die;
}
$result = json_decode($response['body']);
if (!is_object($result)) {
echo json_encode(array('result' => false));
die;
}
if ((bool) $result->result === true || (int) $result->code === 401 && isset($result->deactivation_key)) {
$this->setDeactivation(isset($result->code) && (int) $result->code === 401 ? $result->deactivation_key : $params['dkey']);
vc_settings()->set('envato_username', $params['username']);
vc_settings()->set('envato_api_key', $params['api_key']);
vc_settings()->set('js_composer_purchase_code', $params['key']);
echo json_encode(array('result' => true));
die;
}
echo $response['body'];
die;
}
示例7: sf_red_validate
function sf_red_validate($in)
{
$out = array();
$url = get_site_url();
$in = json_decode($in, true);
if (is_array($in)) {
for ($i = 0; $i < count($in); $i++) {
if (is_array($in[$i]) && $in[$i][0]) {
$tmp = strpos($in[$i][0], substr(strstr($url, '//'), 2));
if ($tmp !== false) {
$in[$i][0] = substr($in[$i][0], $tmp + strlen(strstr($url, '//')) - 2);
}
if (substr($in[$i][0], 0, 1) != '/') {
$in[$i][0] = '/' . $in[$i][0];
}
$tmp = strpos($in[$i][1], '//');
if ($tmp === false) {
$in[$i][1] = $url . (strpos($in[$i][1], '/') === 0 ? '' : '/') . $in[$i][1];
} else {
if ($tmp === 0) {
$in[$i][1] = 'http:' . $in[$i][1];
}
}
if ($in[$i][1] == $url . '/') {
$in[$i][1] = $url;
}
$out[] = $in[$i];
}
}
}
return $out;
}
示例8: search
public function search($query)
{
if (function_exists('is_main_query') && !$query->is_main_query()) {
return $query;
}
if (is_search() && !is_admin() && $this->algolia_registry->validCredential && isset($_GET['instant']) === false) {
if ($this->algolia_registry->instant) {
$url = get_site_url() . '/?instant=1&s=' . $query->query['s'] . '#q=' . $query->query['s'] . '&page=0&refinements=%5B%5D&numerics_refinements=%7B%7D&index_name=%22' . $this->algolia_registry->index_name . 'all%22';
header('Location: ' . $url);
die;
}
$algolia_query = get_search_query(false);
$options = array('hitsPerPage' => $this->algolia_registry->number_by_page, 'page' => get_query_var('paged') ? get_query_var('paged') - 1 : 0);
$algolia_helper = new \Algolia\Core\AlgoliaHelper($this->algolia_registry->app_id, $this->algolia_registry->search_key, $this->algolia_registry->admin_key);
$results = $algolia_helper->search($algolia_query, $options, $this->algolia_registry->index_name . 'all');
foreach ($results['hits'] as $result) {
$this->ids[] = $result['objectID'];
}
$this->num_pages = $results['nbPages'];
$this->total_result_count = $results['nbHits'];
$this->page = $results['page'];
$query->query = array();
set_query_var('post__in', $this->ids);
set_query_var('post_type', null);
set_query_var('s', null);
set_query_var('paged', null);
return $query;
}
return $query;
}
示例9: wfap_get_access_token
function wfap_get_access_token()
{
if (isset($_REQUEST['code'])) {
$code = $_REQUEST['code'];
$id = get_option('wfap_app_id');
$sec = get_option('wfap_sec_id');
$page_url = get_site_url();
$auth_url = 'https://graph.facebook.com/oauth/access_token?client_id=' . $id . '&client_secret=' . $sec . '&redirect_uri=' . $page_url . '&code=' . $code;
//echo $auth_url;exit;
//$accesscode = file_get_contents($auth_url);
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $auth_url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'fb_auto');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
$allval = array();
$token = array();
$allval = explode("=", $query);
$token = explode("&", $allval[1]);
$message = "Thank you for authenticate";
if ($token != '') {
update_option('wfap_user_tkn', $token[0]);
}
//echo $query;exit;
$location = admin_url('admin.php?page=wp-facebook-auto-publish/wp-fap-gui.php&msg=' . $message);
wp_redirect($location);
exit;
}
}
示例10: zero_scripts
function zero_scripts()
{
if (!is_admin()) {
//Call Modernizr
wp_register_script('modernizr', get_template_directory_uri() . '/js/libs/modernizr.dev.js', array(), null, false);
wp_enqueue_script('modernizr');
//Call JQuery
wp_deregister_script('jquery');
wp_register_script('jquery', '/wp-includes/js/jquery/jquery.js', '', '', true);
wp_enqueue_script('jquery');
if (is_front_page() || is_page_template('new-story-page.php')) {
wp_register_script('slider_js', get_template_directory_uri() . '/js/libs/slider.min.js', array('jquery'), null, true);
wp_enqueue_script('slider_js');
}
if (is_page(11) || is_child(11)) {
wp_register_script('gallery_js', get_template_directory_uri() . '/js/libs/gallery.js', array('jquery'), null, true);
wp_enqueue_script('gallery_js');
}
//Call Framework js file
wp_register_script('main_js', get_template_directory_uri() . '/js/build/concat.js', array('jquery'), '', true);
wp_enqueue_script('main_js');
}
// Setting the site URL as a global variable
// You can use it to access the template URL in the mainJSfile
$site_parameters = array('site_url' => get_site_url(), 'theme_directory' => get_template_directory_uri());
wp_localize_script('main_js', 'SiteParameters', $site_parameters);
}
示例11: __construct
public function __construct($pluginMainFile)
{
$this->_wpUrl = get_site_url();
$this->_wpUrl = $this->makeUniversalLink($this->_wpUrl);
$this->_wpPluginsUrl = plugins_url('/');
$this->_wpPluginsUrl = $this->makeUniversalLink($this->_wpPluginsUrl);
$this->_pluginDirName = plugin_basename(dirname($pluginMainFile)) . '/';
$this->_pluginMainFile = $pluginMainFile;
$this->_pluginPath = plugin_dir_path($pluginMainFile);
$this->_pluginUrl = plugins_url('/', $pluginMainFile);
$this->_pluginUrl = $this->makeUniversalLink($this->_pluginUrl);
$this->_pluginCachePath = $this->_pluginPath . 'cache/';
$this->_pluginCacheUrl = $this->_pluginUrl . 'cache/';
$this->_pluginStaticPath = $this->_pluginPath . 'static/';
$this->_pluginStaticUrl = $this->_pluginUrl . 'static/';
$this->_pluginCssPath = $this->_pluginStaticPath . 'styles/';
$this->_pluginCssUrl = $this->_pluginStaticUrl . 'styles/';
$this->_pluginImagesPath = $this->_pluginStaticPath . 'images/';
$this->_pluginImagesUrl = $this->_pluginStaticUrl . 'images/';
$this->_pluginJsPath = $this->_pluginStaticPath . 'js/';
$this->_pluginJsUrl = $this->_pluginStaticUrl . 'js/';
$this->_pluginTemplatePath = $this->_pluginPath . 'templates/';
$this->_pluginTemplateUrl = $this->_pluginUrl . 'templates/';
$this->_pluginLanguagesPath = $this->_pluginDirName . 'languages/';
$this->onInit();
}
开发者ID:likelazyeyes,项目名称:woocommerce-multistep-checkout-wizard-lite-moded,代码行数:26,代码来源:FestiPlugin.php
示例12: activity_admin_post_category_check
function activity_admin_post_category_check($post_id, $post, $update)
{
if (is_admin()) {
if (is_plugin_active('activity/activity.php')) {
$post_cat = wp_get_post_categories($post_id);
if (empty($post_cat)) {
return;
} else {
$activity_cat = intval(get_option('activity_category'));
$is_post_activity = in_array($activity_cat, $post_cat);
if ($is_post_activity) {
if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin.php?page=activity_admin') === false) {
$post_cat = array_diff($post_cat, array($activity_cat));
if (empty($post_cat)) {
$post_cat = array(1);
}
$post_data = array('ID' => $post_id, 'post_category' => $post_cat);
$post_update = wp_update_post($post_data);
header('Location: ' . get_site_url() . '/wp-admin/admin.php?page=activity_admin&action=error_add_activity');
exit;
}
}
}
}
}
}
示例13: __construct
public function __construct($parent)
{
//Call parent constructor
parent::__construct($parent);
//Get the textdomain from the Helper class
$this->l10n_domain = ACF_Location_Field_Helper::L10N_DOMAIN;
//Base directory of this field
$this->base_dir = rtrim(dirname(realpath(__FILE__)), DIRECTORY_SEPARATOR);
//Build the base relative uri by searching backwards until we encounter the wordpress ABSPATH
//This may not work if the $base_dir contains a symlink outside of the WordPress ABSPATH
$root = array_pop(explode(DIRECTORY_SEPARATOR, rtrim(realpath(ABSPATH), DIRECTORY_SEPARATOR)));
$path_parts = explode(DIRECTORY_SEPARATOR, $this->base_dir);
$parts = array();
while ($part = array_pop($path_parts)) {
if ($part == $root) {
break;
}
array_unshift($parts, $part);
}
$this->base_uri_rel = '/' . implode('/', $parts);
$this->base_uri_abs = get_site_url(null, $this->base_uri_rel);
// set name / title
$this->name = 'location-field';
// variable name (no spaces / special characters / etc)
$this->title = __('Location', $this->l10n_domain);
// field label (Displayed in edit screens)
add_action('admin_print_scripts', array(&$this, 'admin_print_scripts'), 12, 0);
add_action('admin_print_styles', array(&$this, 'admin_print_styles'), 12, 0);
}
示例14: edd_email_preview_template_tags
/**
* Email Preview Template Tags
*
* @since 1.0
* @param string $message Email message with template tags
* @return string $message Fully formatted message
*/
function edd_email_preview_template_tags($message)
{
$download_list = '<ul>';
$download_list .= '<li>' . __('Sample Product Title', 'easy-digital-downloads') . '<br />';
$download_list .= '<div>';
$download_list .= '<a href="#">' . __('Sample Download File Name', 'easy-digital-downloads') . '</a> - <small>' . __('Optional notes about this download.', 'easy-digital-downloads') . '</small>';
$download_list .= '</div>';
$download_list .= '</li>';
$download_list .= '</ul>';
$file_urls = esc_html(trailingslashit(get_site_url()) . 'test.zip?test=key&key=123');
$price = edd_currency_filter(edd_format_amount(10.5));
$gateway = 'PayPal';
$receipt_id = strtolower(md5(uniqid()));
$notes = __('These are some sample notes added to a product.', 'easy-digital-downloads');
$tax = edd_currency_filter(edd_format_amount(1.0));
$sub_total = edd_currency_filter(edd_format_amount(9.5));
$payment_id = rand(1, 100);
$user = wp_get_current_user();
$message = str_replace('{download_list}', $download_list, $message);
$message = str_replace('{file_urls}', $file_urls, $message);
$message = str_replace('{name}', $user->display_name, $message);
$message = str_replace('{fullname}', $user->display_name, $message);
$message = str_replace('{username}', $user->user_login, $message);
$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
$message = str_replace('{subtotal}', $sub_total, $message);
$message = str_replace('{tax}', $tax, $message);
$message = str_replace('{price}', $price, $message);
$message = str_replace('{receipt_id}', $receipt_id, $message);
$message = str_replace('{payment_method}', $gateway, $message);
$message = str_replace('{sitename}', get_bloginfo('name'), $message);
$message = str_replace('{product_notes}', $notes, $message);
$message = str_replace('{payment_id}', $payment_id, $message);
$message = str_replace('{receipt_link}', sprintf(__('%1$sView it in your browser.%2$s', 'easy-digital-downloads'), '<a href="' . esc_url(add_query_arg(array('payment_key' => $receipt_id, 'edd_action' => 'view_receipt'), home_url())) . '">', '</a>'), $message);
return wpautop(apply_filters('edd_email_preview_template_tags', $message));
}
示例15: get_site_subfolder
function get_site_subfolder()
{
$url_root = get_site_url_root();
$site_address = get_site_url();
$subfolder = str_replace($url_root, '', $site_address);
return $subfolder;
}