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


PHP get_base_url函数代码示例

本文整理汇总了PHP中get_base_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_base_url函数的具体用法?PHP get_base_url怎么用?PHP get_base_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_future_version_information

/**
 * Get information about new versions of ocPortal (or more accurately, what's wrong with this version).
 *
 * @return tempcode		Information about the installed ocPortal version
 */
function get_future_version_information()
{
    require_lang('version');
    $url = 'http://ocportal.com/version.php?version=' . rawurlencode(ocp_version_full()) . '&lang=' . rawurlencode(user_lang());
    $data = http_download_file($url, NULL, false);
    if (!is_null($data)) {
        $data = str_replace('"../upgrader.php"', '"' . get_base_url() . '/upgrader.php"', $data);
        if ($GLOBALS['XSS_DETECT']) {
            ocp_mark_as_escaped($data);
        }
        require_code('character_sets');
        $data = convert_to_internal_encoding($data);
        $table = new ocp_tempcode();
        $lines = explode(chr(10), $data);
        foreach ($lines as $line) {
            if (trim($line) != '') {
                $table->attach(paragraph($line));
            }
        }
        $table = make_string_tempcode(preg_replace('#<p>\\s*</p>#', '', $table->evaluate()));
    } else {
        $table = paragraph(do_lang_tempcode('CANNOT_CONNECT_HOME'), 'dfsdff32ffd');
    }
    require_code('xhtml');
    /*$table->attach('<script type="text/javascript">// <![CDATA[
    		window.open(\''.$url.'\');
    	//]]></script>');*/
    return make_string_tempcode(xhtmlise_html($table->evaluate()));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:version2.php

示例2: init__config

/**
 * Standard code module initialisation function.
 */
function init__config()
{
    global $VALUES, $IN_MINIKERNEL_VERSION;
    if ($IN_MINIKERNEL_VERSION == 0) {
        load_options();
        $VALUES = persistant_cache_get('VALUES');
        if (!is_array($VALUES)) {
            $VALUES = $GLOBALS['SITE_DB']->query_select('values', array('*'));
            $VALUES = list_to_map('the_name', $VALUES);
            persistant_cache_set('VALUES', $VALUES);
        }
    } else {
        $VALUES = array();
    }
    global $GET_OPTION_LOOP;
    $GET_OPTION_LOOP = 0;
    global $MULTI_LANG;
    $MULTI_LANG = NULL;
    // Enforce XML db synching
    if (get_db_type() == 'xml' && !running_script('xml_db_import') && is_file(get_file_base() . '/data_custom/xml_db_import.php') && is_dir(get_file_base() . '/.svn')) {
        $last_xml_import = get_value('last_xml_import');
        $mod_time = filemtime(get_file_base() . '/.svn');
        if (is_null($last_xml_import) || intval($last_xml_import) < $mod_time) {
            set_value('last_xml_import', strval(time()));
            header('Location: ' . get_base_url() . '/data_custom/xml_db_import.php');
            exit;
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:config.php

示例3: rules

 public function rules()
 {
     // TODO: fix $_GET w/ URL rewriting
     global $lang_common, $lang_login, $lang_register;
     // If we are logged in, we shouldn't be here
     if (!$this->user->is_guest) {
         header('Location: ' . get_base_url());
         exit;
     }
     // Display an error message if new registrations are disabled
     if ($this->config['o_regs_allow'] == '0') {
         message($lang_register['No new regs']);
     }
     // Load the register.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/register.php';
     // Load the register.php/profile.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php';
     if ($this->config['o_rules'] != '1') {
         redirect(get_link('register/agree/'));
     }
     $page_title = array(feather_escape($this->config['o_board_title']), $lang_register['Register'], $lang_register['Forum rules']);
     define('FEATHER_ACTIVE_PAGE', 'register');
     $this->header->setTitle($page_title)->display();
     $this->feather->render('register/rules.php', array('lang_register' => $lang_register, 'feather_config' => $this->config));
     $this->footer->display();
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:26,代码来源:register.php

示例4: sitemaps_build

/**
 * Top level function to (re)generate a Sitemap (xml file, Google-style).
 */
function sitemaps_build()
{
    $GLOBALS['NO_QUERY_LIMIT'] = true;
    $path = get_custom_file_base() . '/ocp_sitemap.xml';
    if (!file_exists($path)) {
        if (!is_writable_wrap(dirname($path))) {
            warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', escape_html('/')));
        }
    } else {
        if (!is_writable_wrap($path)) {
            warn_exit(do_lang_tempcode('WRITE_ERROR', escape_html('ocp_sitemap.xml')));
        }
    }
    // Runs via a callback mechanism, so we don't need to load an arbitrary complex structure into memory.
    sitemaps_xml_initialise($path);
    spawn_page_crawl('pagelink_to_sitemapsxml', $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, DEPTH__ENTRIES);
    sitemaps_xml_finished();
    // Ping search engines
    if (get_option('auto_submit_sitemap') == '1') {
        $ping = true;
        $base_url = get_base_url();
        $not_local = substr($base_url, 0, 16) != 'http://localhost' && substr($base_url, 0, 16) != 'http://127.0.0.1' && substr($base_url, 0, 15) != 'http://192.168.' && substr($base_url, 0, 10) != 'http://10.';
        if ($ping && get_option('site_closed') == '0' && $not_local) {
            // Submit to search engines
            $services = array('http://www.google.com/webmasters/tools/ping?sitemap=', 'http://submissions.ask.com/ping?sitemap=', 'http://www.bing.com/webmaster/ping.aspx?siteMap=', 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=');
            foreach ($services as $service) {
                http_download_file($service . urlencode(get_custom_base_url() . '/ocp_sitemap.xml'), NULL, false);
            }
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:sitemap.php

示例5: send_email

 /**
  * send email confirmation.
  * invoked by: Model.Player.register()
  * @param $email
  * @param $name
  * @param $key
  * @return bool
  */
 public function send_email($email, $name, $key)
 {
     include_once __SITE_PATH . '/library/PHPMailer/PHPMailerAutoload.php';
     // get separated .ini configuration from stealing my email and password which used to sent email
     $setting = parse_ini_file(get_base_url() . '/setting.ini', true);
     $email_address = $setting['email']['email_address'];
     $email_password = $setting['email']['email_password'];
     // instantiate PHPMailer and setup for configuration
     $mail = new PHPMailer();
     $mail->isSMTP();
     $mail->Host = 'ssl://smtp.gmail.com';
     $mail->SMTPAuth = true;
     $mail->Username = $email_address;
     $mail->Password = $email_password;
     $mail->SMTPSecure = 'ssl';
     $mail->Port = 465;
     $mail->From = 'no-reply@seriousgame.com';
     $mail->FromName = 'SeriousGame.Inc';
     $mail->addAddress($email, $name);
     $mail->addReplyTo('no-reply@seriousgame.com', 'SeriousGame.Inc');
     $mail->isHTML(true);
     $mail->Subject = 'Business Career The Game Registration';
     $body = $this->format_email('html', $email, $name, $key);
     $mail->msgHTML($body, __SITE_PATH . 'assets/etc/');
     //send the message, check for errors
     if (!$mail->send()) {
         echo "Mailer Error: " . $mail->ErrorInfo;
         return false;
     } else {
         echo "Message sent!";
         return true;
     }
 }
开发者ID:anggadarkprince,项目名称:web-businesscareer,代码行数:41,代码来源:Player.class.php

示例6: run

 /**
  * Standard modular run function for award hooks. Renders a content box for an award/randomisation.
  *
  * @param  array		The database row for the content
  * @param  ID_TEXT	The zone to display in
  * @return tempcode	Results
  */
 function run($row, $zone)
 {
     $url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), $zone);
     $title = get_translated_tempcode($row['title']);
     $title_plain = get_translated_text($row['title']);
     $news_cat_rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $row['news_category']), '', 1);
     if (!array_key_exists(0, $news_cat_rows)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $news_cat_row = $news_cat_rows[0];
     $category = get_translated_text($news_cat_row['nc_title']);
     $img = find_theme_image($news_cat_row['nc_img']);
     if ($row['news_image'] != '') {
         $img = $row['news_image'];
         if (url_is_local($img)) {
             $img = get_base_url() . '/' . $img;
         }
     }
     $news = get_translated_tempcode($row['news']);
     if ($news->is_empty()) {
         $news = get_translated_tempcode($row['news_article']);
         $truncate = true;
     } else {
         $truncate = false;
     }
     $author_url = addon_installed('authors') ? build_url(array('page' => 'authors', 'type' => 'misc', 'id' => $row['author']), get_module_zone('authors')) : new ocp_tempcode();
     $author = $row['author'];
     require_css('news');
     $seo_bits = seo_meta_get_for('news', strval($row['id']));
     $map = array('_GUID' => 'jd89f893jlkj9832gr3uyg2u', 'TAGS' => get_loaded_tags('news', explode(',', $seo_bits[0])), 'TRUNCATE' => $truncate, 'AUTHOR' => $author, 'BLOG' => false, 'AUTHOR_URL' => $author_url, 'CATEGORY' => $category, 'IMG' => $img, 'NEWS' => $news, 'ID' => strval($row['id']), 'SUBMITTER' => strval($row['submitter']), 'DATE' => get_timezoned_date($row['date_and_time']), 'DATE_RAW' => strval($row['date_and_time']), 'FULL_URL' => $url, 'NEWS_TITLE' => $title, 'NEWS_TITLE_PLAIN' => $title_plain);
     if (get_option('is_on_comments') == '1' && !has_no_forum() && $row['allow_comments'] >= 1) {
         $map['COMMENT_COUNT'] = '1';
     }
     return put_in_standard_box(do_template('NEWS_PIECE_SUMMARY', $map));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:news.php

示例7: run

 /**
  * Standard modular run function for CRON hooks. Searches for tasks to perform.
  */
 function run()
 {
     if (get_forum_type() != 'ocf') {
         return;
     }
     $time = time();
     $last_time = intval(get_value('last_confirm_reminder_time'));
     if ($last_time > time() - 24 * 60 * 60 * 2) {
         return;
     }
     set_value('last_confirm_reminder_time', strval($time));
     require_code('mail');
     require_lang('ocf');
     $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members WHERE ' . db_string_not_equal_to('m_validated_email_confirm_code', '') . ' AND m_join_time>' . strval($last_time));
     $GLOBALS['NO_DB_SCOPE_CHECK'] = false;
     foreach ($rows as $row) {
         $coppa = get_option('is_on_coppa') == '1' && utctime_to_usertime(time() - mktime(0, 0, 0, $row['m_dob_month'], $row['m_dob_day'], $row['m_dob_year'])) / 31536000.0 < 13.0;
         if (!$coppa) {
             $zone = get_module_zone('join');
             if ($zone != '') {
                 $zone .= '/';
             }
             $url = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4&email=' . rawurlencode($row['m_email_address']) . '&code=' . $row['m_validated_email_confirm_code'];
             $url_simple = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4';
             $message = do_lang('OCF_SIGNUP_TEXT', comcode_escape(get_site_name()), comcode_escape($url), array($url_simple, $row['m_email_address'], strval($row['m_validated_email_confirm_code'])), $row['m_language']);
             mail_wrap(do_lang('CONFIRM_EMAIL_SUBJECT', get_site_name(), NULL, NULL, $row['m_language']), $message, array($row['m_email_address']), $row['m_username']);
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:ocf_confirm_reminder.php

示例8: url

/**
 * Returns absolute URL to the specified file or folder.
 *
 * @param string $file The path to the file, ex: '/about/thunderbird'
 * @param bool $addon_locale Whether the current locale should be included
 *                          in the URL. For example, images and CSS should
 *                          not have the locale. If left empty, add_locale
 *                          will attempt to be detected based on the file
 *                          extension.
 * @returns string
 */
function url($file, $add_locale = null) {
    // Add beginning slash if left out
    if ($file[0] != '/')
        $file = '/'.$file;
    
    // Get base URL
    $url = get_base_url();
    
    // If add_locale is empty, try to detect whether it should be used
    if (!isset($add_locale)) {
        $static_extensions = array('jpg', 'png', 'gif', 'css', 'js');
        
        if ($last_position = strrpos($file, '.')) {
            $extension = substr($file, $last_position + 1);
            
            $add_locale = !in_array($extension, $static_extensions);
        }
        else
            $add_locale = true;
    }
    
    // Add the locale if necessary
    if ($add_locale)
        $url .= '/'.LANG;
    
    $url .= $file;
    
    return $url;
}
开发者ID:noscripter,项目名称:mozilla.org,代码行数:40,代码来源:functions.inc.php

示例9: install

 /**
  * Standard modular install function.
  *
  * @param  ?integer	What version we're upgrading from (NULL: new install)
  * @param  ?integer	What hack version we're upgrading from (NULL: new-install/not-upgrading-from-a-hacked-version)
  */
 function install($upgrade_from = NULL, $upgrade_from_hack = NULL)
 {
     if (is_null($upgrade_from) || $upgrade_from < 2) {
         $GLOBALS['SITE_DB']->create_table('sitewatchlist', array('id' => '*AUTO', 'siteurl' => 'URLPATH', 'site_name' => 'SHORT_TEXT'));
         $GLOBALS['SITE_DB']->query_insert('sitewatchlist', array('siteurl' => get_base_url(), 'site_name' => get_site_name()));
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:13,代码来源:main_staff_website_monitoring.php

示例10: beginSitemap

 protected function beginSitemap()
 {
     global $pun_config;
     $output = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     $output .= '<?xml-stylesheet type="text/xsl" href="' . get_base_url() . '/sitemap.xsl"?>' . "\n";
     $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     $this->addToSitemap($output);
 }
开发者ID:raphaelh,项目名称:ardechelibre.org,代码行数:8,代码来源:sitemap.php

示例11: write_php_file

function write_php_file($rewrite_ar, $filename = PHP_OUT_FILE, $http_status = REDIRECT_STATUS)
{
    $default_url = get_base_url();
    $template = <<<EOT
<?php
/*
    Auto-generated!  Time:  __TIME__  (Via: rewritemap.php)
*/

\$http_status = '{$http_status}';
\$default_url = '{$default_url}';
\$map_count = __COUNT__;
\$map = __MAP__;


    \$is_test = filter_input( INPUT_GET, 'test' );
    \$host = server_var( 'HTTP_HOST' );
    \$path = server_var( 'REDIRECT_URL' ); //REQUEST_URI
    \$script = server_var( 'SCRIPT_NAME' );
    \$root = str_replace( '/index.php', '', \$script );
    \$source = rtrim( str_replace( \$root, '', \$path ), '/' );


    if (isset( \$map[ \$source ]) || ! \$path) {
        if (! \$path) {
            \$dest = \$default_url;
            \$source = '/';
        } else {
            \$dest = \$map[ \$source ];
        }
        \$dest .= '?from=' . urlencode( 'http://' . \$host . \$path );

        if (\$is_test) {
            echo "<pre>REDIRECT (test):\\n  \$source\\n>>\\n  \$dest\\n\\n(\$http_status)" . PHP_EOL;

        } else {
            header( \$http_status );
            header( 'Location: '. \$dest );
        }
        exit;
    }

    header( 'HTTP/1.1 503 Service Unavailable' );
    var_dump( 'ERROR', \$path, \$root, \$source );


    function server_var( \$key ) {
        //Was: filter_input( INPUT_SERVER, \$key )
        return isset(\$_SERVER[ \$key ]) ? \$_SERVER[ \$key ] : null;
    }

#End.

EOT;
    $php = strtr($template, array('__MAP__' => var_export($rewrite_ar, true), '__COUNT__' => count($rewrite_ar), '__TIME__' => date('c')));
    $bytes = file_put_contents($filename, $php);
    return $bytes;
}
开发者ID:nfreear,项目名称:nfreear.github.io,代码行数:58,代码来源:rewritemap.php

示例12: __construct

 /**
  * Construct and initialize the object.
  *
  * @param string $file        	
  */
 public function __construct($file)
 {
     $this->routes = new \SimpleXMLElement($file, NULL, true);
     // TODO: Move this function from helpers to a static method in this
     // class
     $base_uri = \get_base_url();
     $requested_uri = $this->getRequestedUri($base_uri);
     $GLOBALS['resource'] = $this->getResourceFromUri($requested_uri);
 }
开发者ID:rwngallego,项目名称:lat,代码行数:14,代码来源:Router.php

示例13: testAdminZone

 function testAdminZone()
 {
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     $result = http_download_file(get_base_url() . '/_tests/codechecker/phpdoc_parser.php', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
     foreach (explode('<br />', $result) as $line) {
         $this->assertTrue(trim($line) == '' || substr($line, 0, 4) == 'Done' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc__function_sigs.php

示例14: testDatabase

 function testDatabase()
 {
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     $result = http_download_file(get_base_url() . '/_tests/codechecker/code_quality.php?subdir=sources/database&api=1', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
     foreach (explode('<br />', $result) as $line) {
         $this->assertTrue(trim($line) == '' || substr($line, 0, 5) == 'SKIP:' || substr($line, 0, 5) == 'DONE ' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc_database.php

示例15: get_html

function get_html($url)
{
    while (true) {
        try {
            $html = file_get_html($url);
            break;
        } catch (Exception $e) {
            echo "\n**Failed to get html.  Trying again**\n";
        }
    }
    return replace_links_with_base_url(get_base_url($url), $html);
}
开发者ID:brthiess,项目名称:rockstat_final,代码行数:12,代码来源:web-crawler.php


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