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


PHP WPSEO_Utils::is_nginx方法代码示例

本文整理汇总了PHP中WPSEO_Utils::is_nginx方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils::is_nginx方法的具体用法?PHP WPSEO_Utils::is_nginx怎么用?PHP WPSEO_Utils::is_nginx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPSEO_Utils的用法示例。


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

示例1: test_wpseo_is_nginx

 /**
  * @covers test_wpseo_is_nginx()
  */
 public function test_wpseo_is_nginx()
 {
     $_SERVER['SERVER_SOFTWARE'] = 'nginx/1.5.11';
     $this->assertTrue(WPSEO_Utils::is_nginx());
     $_SERVER['SERVER_SOFTWARE'] = 'Apache/2.2.22';
     $this->assertFalse(WPSEO_Utils::is_nginx());
 }
开发者ID:centre-for-effective-altruism,项目名称:wordpress-seo,代码行数:10,代码来源:test-class-wpseo-utils.php

示例2: wpseo_is_nginx

/**
 * Check if the web service is running on Nginx
 *
 * @deprecated 1.6.1
 * @deprecated use WPSEO_Utils::is_nginx()
 * @see WPSEO_Utils::is_nginx()
 *
 * @return bool
 */
function wpseo_is_nginx()
{
    _deprecated_function(__FUNCTION__, 'WPSEO 1.6.1', 'WPSEO_Utils::is_nginx()');
    return WPSEO_Utils::is_nginx();
}
开发者ID:presteege,项目名称:presteege.fr,代码行数:14,代码来源:wpseo-functions.php

示例3: header

 * @todo - [JRF => whomever] check for existance of .xls rewrite rule in .htaccess from
 * google-sitemaps-plugin/generator and remove as it will cause errors for our sitemaps
 * (or inform the user and disallow enabling of sitemaps )
 * @todo - [JRF => whomever] check if anything along these lines is already being done
 */
if (!defined('WPSEO_VERSION')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}
global $wpseo_admin_pages;
$wpseo_admin_pages->admin_header(true, WPSEO_Options::get_group_name('wpseo_xml'), 'wpseo_xml');
$options = get_option('wpseo_xml');
$content = $wpseo_admin_pages->checkbox('enablexmlsitemap', __('Check this box to enable XML sitemap functionality.', 'wordpress-seo'), false);
$content .= '<div id="sitemapinfo">';
if (WPSEO_Utils::is_nginx()) {
    $content .= '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px;">';
    $content .= '<p>' . __('As you\'re on NGINX, you\'ll need the following rewrites:', 'wordpress-seo') . '</p>';
    $content .= '<pre>rewrite ^/sitemap_index\\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;</pre>';
    $content .= '</div>';
}
if ($options['enablexmlsitemap'] === true) {
    $content .= '<p>' . sprintf(esc_html__('You can find your XML Sitemap here: %sXML Sitemap%s', 'wordpress-seo'), '<a target="_blank" class="button-secondary" href="' . esc_url(wpseo_xml_sitemaps_base_url('sitemap_index.xml')) . '">', '</a>') . '<br/><br/>' . __('You do <strong>not</strong> need to generate the XML sitemap, nor will it take up time to generate after publishing a post.', 'wordpress-seo') . '</p>';
} else {
    $content .= '<p>' . __('Save your settings to activate XML Sitemaps.', 'wordpress-seo') . '</p>';
}
// When we write the help tab for this we should definitely reference this plugin :https://wordpress.org/plugins/edit-author-slug/
$content .= '<h2>' . __('User sitemap', 'wordpress-seo') . '</h2>';
$content .= $wpseo_admin_pages->checkbox('disable_author_sitemap', __('Disable author/user sitemap', 'wordpress-seo'), false);
$content .= '<div id="xml_user_block">';
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:31,代码来源:xml-sitemaps.php

示例4: display


//.........这里部分代码省略.........
        }
        echo '</select>' . PHP_EOL;
        echo '<br />';
        echo '<br />';
        echo '<p class="label desc description">' . sprintf(__('The redirect type is the HTTP response code sent to the browser telling the browser what type of redirect is served.<br/><br/>Read <a href=\'%s\' target=\'_blank\'>this page</a> for more info.', 'wordpress-seo-premium'), 'http://kb.yoast.com/article/121-redirect-types/#utm_source=wordpress-seo-premium-redirects&amp;utm_medium=inline-help&amp;utm_campaign=redirect-types') . ' </p>';
        echo "<br class='clear'/>\n";
        echo "<a href='javascript:;' class='button-primary'>" . __('Add Redirect', 'wordpress-seo-premium') . "</a>\n";
        echo "</div>\n";
        echo "</form>\n";
        echo "<p class='desc'>&nbsp;</p>\n";
        // Open <form>.
        echo "<form id='regex' class='wpseo-redirects-table-form' method='post' action=''>\n";
        // AJAX nonce.
        echo "<input type='hidden' class='wpseo_redirects_ajax_nonce' value='" . wp_create_nonce('wpseo-redirects-ajax-security') . "' />\n";
        // The list table.
        $list_table = new WPSEO_Redirect_Table('REGEX');
        $list_table->prepare_items();
        $list_table->search_box(__('Search', 'wordpress-seo-premium'), 'wpseo-redirect-search');
        $list_table->display();
        // Close <form>.
        echo "</form>\n";
        ?>
			</div>
			<div id="settings" class="wpseotab">
				<?php 
        // Get redirect options.
        $redirect_options = WPSEO_Redirect_Manager::get_options();
        // Do file checks.
        if ('on' == $redirect_options['disable_php_redirect']) {
            $file_write_error = false;
            if (WPSEO_Utils::is_apache()) {
                if ('on' == $redirect_options['separate_file']) {
                    if (file_exists(WPSEO_Redirect_File_Manager::get_file_path())) {
                        echo '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px">';
                        echo '<p>' . __("As you're on Apache, you should add the following include to the website httpd config file:", 'wordpress-seo-premium') . '</p>';
                        echo '<pre>Include ' . WPSEO_Redirect_File_Manager::get_file_path() . '</pre>';
                        echo '</div>';
                    } else {
                        $file_write_error = true;
                    }
                } else {
                    if (!is_writable(WPSEO_Redirect_File_Manager::get_htaccess_file_path())) {
                        /* translators: %s: '.htaccess' file name */
                        echo "<div class='error'><p><b>" . sprintf(__('We\'re unable to save the redirects to your %s file. Please make the file writable.', 'wordpress-seo-premium'), '<code>.htaccess</code>') . "</b></p></div>\n";
                    }
                }
            } else {
                if (WPSEO_Utils::is_nginx()) {
                    if (file_exists(WPSEO_Redirect_File_Manager::get_file_path())) {
                        echo '<div style="margin: 5px 0; padding: 3px 10px; background-color: #ffffe0; border: 1px solid #E6DB55; border-radius: 3px">';
                        echo '<p>' . __('As you\'re on Nginx, you should add the following include to the NGINX config file:', 'wordpress-seo-premium') . '</p>';
                        echo '<pre>include ' . WPSEO_Redirect_File_Manager::get_file_path() . ';</pre>';
                        echo '</div>';
                    } else {
                        $file_write_error = true;
                    }
                }
            }
            if ($file_write_error) {
                echo "<div class='error'><p><b>" . __(sprintf("We're unable to save the redirect file to %s", WPSEO_Redirect_File_Manager::get_file_path()), 'wordpress-seo-premium') . "</b></p></div>\n";
            }
        }
        ?>
				<h2>Redirect Settings</h2>

				<form action="<?php 
        echo admin_url('options.php');
        ?>
" method="post">
					<?php 
        settings_fields('yoast_wpseo_redirect_options');
        Yoast_Form::get_instance()->set_option('wpseo_redirect');
        if (WPSEO_Utils::is_apache()) {
            echo Yoast_Form::get_instance()->checkbox('disable_php_redirect', __('Disable PHP redirects', 'wordpress-seo-premium'));
            /* translators: 1: '.htaccess' file name */
            echo '<p class="desc">' . sprintf(__('Write redirects to the %1$s file. Make sure the %1$s file is writable.', 'wordpress-seo-premium'), '<code>.htacces</code>') . '</p>';
            echo Yoast_Form::get_instance()->checkbox('separate_file', __('Generate a separate redirect file', 'wordpress-seo-premium'));
            /* translators: %s: '.htaccess' file name */
            echo '<p class="desc">' . sprintf(__('By default we write the redirects to your %s file, check this if you want the redirects written to a separate file. Only check this option if you know what you are doing!', 'wordpress-seo-premium'), '<code>.htaccess</code>') . '</p>';
        } else {
            echo Yoast_Form::get_instance()->checkbox('disable_php_redirect', __('Disable PHP redirects', 'wordpress-seo-premium'));
            /* translators: %s: 'Yoast SEO Premium' */
            echo '<p class="desc">' . sprintf(__('%s will generate redirect files that can be included in your website configuration. You can disable PHP redirect if this is done correctly. Only check this option if you know what you are doing!', 'wordpress-seo-premium'), 'Yoast SEO Premium') . '</p>';
        }
        ?>
					<p class="submit">
						<input type="submit" name="submit" id="submit" class="button button-primary"
						       value="<?php 
        _e('Save Changes', 'wordpress-seo-premium');
        ?>
">
					</p>
				</form>
			</div>
		</div>
		<br class="clear">
		<?php 
        // Admin footer.
        Yoast_Form::get_instance()->admin_footer(false);
    }
开发者ID:Infernosaint,项目名称:WPSetupTest2,代码行数:101,代码来源:class-page-redirect.php

示例5: save_redirect_file

 /**
  * Create the redirect file
  */
 public function save_redirect_file()
 {
     // Options.
     $options = self::get_options();
     if ('on' == $options['disable_php_redirect']) {
         // Create the correct file object.
         $file = null;
         if (WPSEO_Utils::is_apache()) {
             if ('on' == $options['separate_file']) {
                 $file = new WPSEO_Apache_Redirect_File();
             } else {
                 $file = new WPSEO_Htaccess_Redirect_File();
             }
         } elseif (WPSEO_Utils::is_nginx()) {
             $file = new WPSEO_Nginx_Redirect_File();
         }
         // Save the file.
         if (null !== $file) {
             $file->save_file();
         }
     }
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:25,代码来源:class-redirect-manager.php

示例6: wpseo_tracking_additions

/**
 * Adds tracking parameters for WP SEO settings. Outside of the main class as the class could also be in use in other plugins.
 *
 * @param array $options
 *
 * @return array
 */
function wpseo_tracking_additions($options)
{
    if (function_exists('curl_version')) {
        $curl = curl_version();
    } else {
        $curl = null;
    }
    $opt = WPSEO_Options::get_all();
    $options['wpseo'] = array('xml_sitemaps' => $opt['enablexmlsitemap'] === true ? 1 : 0, 'force_rewrite' => $opt['forcerewritetitle'] === true ? 1 : 0, 'opengraph' => $opt['opengraph'] === true ? 1 : 0, 'twitter' => $opt['twitter'] === true ? 1 : 0, 'strip_category_base' => $opt['stripcategorybase'] === true ? 1 : 0, 'on_front' => get_option('show_on_front'), 'wmt_alexa' => !empty($opt['alexaverify']) ? 1 : 0, 'wmt_bing' => !empty($opt['msverify']) ? 1 : 0, 'wmt_google' => !empty($opt['googleverify']) ? 1 : 0, 'wmt_pinterest' => !empty($opt['pinterestverify']) ? 1 : 0, 'wmt_yandex' => !empty($opt['yandexverify']) ? 1 : 0, 'permalinks_clean' => $opt['cleanpermalinks'] == 1 ? 1 : 0, 'site_db_charset' => DB_CHARSET, 'webserver_apache' => WPSEO_Utils::is_apache() ? 1 : 0, 'webserver_apache_version' => function_exists('apache_get_version') ? apache_get_version() : 0, 'webserver_nginx' => WPSEO_Utils::is_nginx() ? 1 : 0, 'webserver_server_software' => $_SERVER['SERVER_SOFTWARE'], 'webserver_gateway_interface' => $_SERVER['GATEWAY_INTERFACE'], 'webserver_server_protocol' => $_SERVER['SERVER_PROTOCOL'], 'php_version' => phpversion(), 'php_max_execution_time' => ini_get('max_execution_time'), 'php_memory_limit' => ini_get('memory_limit'), 'php_open_basedir' => ini_get('open_basedir'), 'php_bcmath_enabled' => extension_loaded('bcmath') ? 1 : 0, 'php_ctype_enabled' => extension_loaded('ctype') ? 1 : 0, 'php_curl_enabled' => extension_loaded('curl') ? 1 : 0, 'php_curl_version_a' => phpversion('curl'), 'php_curl' => !is_null($curl) ? $curl['version'] : 0, 'php_dom_enabled' => extension_loaded('dom') ? 1 : 0, 'php_dom_version' => phpversion('dom'), 'php_filter_enabled' => extension_loaded('filter') ? 1 : 0, 'php_mbstring_enabled' => extension_loaded('mbstring') ? 1 : 0, 'php_mbstring_version' => phpversion('mbstring'), 'php_pcre_enabled' => extension_loaded('pcre') ? 1 : 0, 'php_pcre_version' => phpversion('pcre'), 'php_pcre_with_utf8_a' => @preg_match('/^.{1}$/u', 'ñ', $UTF8_ar), 'php_pcre_with_utf8_b' => defined('PREG_BAD_UTF8_ERROR'), 'php_spl_enabled' => extension_loaded('spl') ? 1 : 0);
    return $options;
}
开发者ID:BennyHudson,项目名称:foundations,代码行数:18,代码来源:class-tracking.php


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