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


PHP get_home_path函数代码示例

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


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

示例1: update_htaccess

 /**
  * Modify .htaccess file wit new values
  *
  * @since    1.0
  */
 private static function update_htaccess($remove = false)
 {
     if (!function_exists('get_home_path')) {
         require_once WP_Block_Referrer_Spam::$plugin_path . '../../../wp-admin/includes/file.php';
     }
     $htaccess_path = trailingslashit(get_home_path()) . '.htaccess';
     self::remove_marker($htaccess_path, self::HTACCESS_MARKER);
     // remove current WP Block Referrer Spam rules to update them
     if ($remove) {
         return true;
     }
     $rules = self::build_rules();
     if (!empty($rules)) {
         if (!function_exists('insert_with_markers')) {
             require_once WP_Block_Referrer_Spam::$plugin_path . '../../../wp-admin/includes/misc.php';
         }
         if (!insert_with_markers($htaccess_path, self::HTACCESS_MARKER, $rules)) {
             self::htacess_error_admin_notice();
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:rrodrigonuez,项目名称:WP-Block-Referrer-Spam,代码行数:30,代码来源:wpbrs-controller-blocker.php

示例2: plugin_activate_example_activate

function plugin_activate_example_activate()
{
    // Activation code here...
    // let's create some categories upon activation
    //http://codex.wordpress.org/Function_Reference/wp_insert_category
    for ($i = 0; $i < 5; $i++) {
        $catarr = array('cat_name' => 'My Category' . $i, 'category_description' => 'A Cool Category' . $i, 'category_nicename' => 'category-slug' . $i, 'category_parent' => '');
        wp_insert_category($catarr);
    }
    // should be root path of the wp install
    $wordpress_path = get_home_path();
    require_once $wordpress_path . '/wp-load.php';
    //not sure if this line is needed
    //activate_plugin() is here:
    require_once $wordpress_path . '/wp-admin/includes/plugin.php';
    // we're going to activate our plugins that are dependencies
    $plugins = array("filters-example", "js-example", "shortcode-example");
    // see
    //http://wordpress.stackexchange.com/questions/62967/why-activate-plugin-is-not-working-in-register-activation-hook
    foreach ($plugins as $plugin) {
        $plugin_path = $wordpress_path . 'wp-content/plugins/' . $plugin . '/' . $plugin . '.php';
        if (file_exists($plugin_path) && is_plugin_inactive($plugin . '/' . $plugin . '.php')) {
            // just double check that the plugin exists and unactivated
            add_action('update_option_active_plugins', 'plugin_activation_dependencies');
        }
    }
}
开发者ID:aamirs332,项目名称:wordpress-demos,代码行数:27,代码来源:plugin-activation-example.php

示例3: get_htaccess_file_path

 function get_htaccess_file_path()
 {
     //global $wp_rewrite;
     $home_path = get_home_path();
     $htaccess_file = $home_path . '.htaccess';
     return $htaccess_file;
 }
开发者ID:rexyzhoang,项目名称:wpp,代码行数:7,代码来源:function.php

示例4: thincc_manage

function thincc_manage()
{
    if (!current_user_can('export')) {
        wp_die(__('You do not have sufficient permissions to export the content of this site.'));
    }
    global $wpdb;
    ?>

<div class="thincc" xmlns="http://www.w3.org/1999/html">
  <div class="wrap">

    <h2>Export to Thin Common Cartridge</h2>

    <div id="main">

      <form id="thincc-form" action="" method="post">

          <div class="options">
            <div><input name="export_flagged_only" id="export_only" type="checkbox" checked/><label for="export_only">Only pages marked as export</label></div>
            <div><input name="use_custom_vars" id="use_custom_vars" type="checkbox" /><label for="use_custom_vars">Sakai compatibility (use custom_param instead of query param)</label></div>
            <div><input name="include_fm" id="include_fm" type="checkbox" /><label for="include_fm">Include Front Matter</label></div>
            <div><input name="include_bm" id="include_bm" type="checkbox" /><label for="include_bm">Include Back Matter</label></div>
            <div><input name="include_parts" id="include_parts" type="checkbox" /><label for="include_parts">Include links to Parts (Include study plans)</label></div>
            <div><input name="include_guids" id="include_guids" type="checkbox" /><label for="include_guids">Include GUIDs</label></div>

<!--            <div><input name="include_fm" id="include_fm" type="checkbox"/><label for="include_fm">Include Front Matter</label> </div>-->
<!--            <div><input name="include_bm" id="include_bm" type="checkbox"/><label for="include_bm">Include Back Matter</label> </div>-->
<!--            <div><label for="cc_version_selector">CC Version:</label>-->
<!--              <select id="cc_version_selector" name="version">-->
<!--                <option value="1.1">1.1 (All LMSs)</option>-->
<!--                <option value="1.2">1.2 (Bb/Sakai/Canvas)</option>-->
<!--                <option value="1.3">1.3 (Canvas/Sakai)</option>-->
<!--                <option value="thin">Thin-CC (1.3) (Canvas)</option>-->
<!--              </select>-->
<!--            </div>-->
          </div>

          <div class="submit">
            <input type="hidden" name="download" value="<?php 
    echo get_home_path();
    ?>
"/>

            <a href="#" class="button-secondary">Preview Thin-CC</a>
            <input class="button button-primary" type="submit" value="Download CC 1.1 .imscc" name="submit">
          </div>
      </form>

      <div id="thincc_modal">
        <div id="thincc-results-close-holder"><a href="#" id="thincc-results-close">Close</a></div>
        <div id="thincc-results">Results</div>
      </div>

    </div>
  </div>
</div>


<?php 
}
开发者ID:BCcampus,项目名称:candela,代码行数:60,代码来源:thincc_manage.php

示例5: wpFileSearch_directoryProtection

function wpFileSearch_directoryProtection($file)
{
    $admin = 'wp-admin';
    $content = 'wp-content';
    $includes = 'wp-includes';
    if (wpFileSearch_extension($file, 2) || wpFileSearch_extension($file, 3) || wpFileSearch_extension($file, 4)) {
        //eg: .js .txt .html
        if (wpFileSearch_position($file, $admin) !== false) {
            return wpFileSearch_formed($file, $admin);
        } else {
            if (wpFileSearch_position($file, $content) !== false) {
                return wpFileSearch_formed($file, $content);
            } else {
                if (wpFileSearch_position($file, $includes) !== false) {
                    return wpFileSearch_formed($file, $includes);
                } else {
                    if (wpFileSearch_position($file, '/') !== false || wpFileSearch_position($file, '\\') !== false) {
                        wp_die(esc_html__('Sneaky, sorry but i cant allow this. Are you sure this is a wordpress file?', 'wpFileSearch'));
                    } else {
                        return substr(get_home_path(), 0, strlen(get_home_path())) . $file;
                    }
                }
            }
        }
    }
    wp_die(esc_html__('Invalid or no file wpFileSearch_extension.', 'wpFileSearch'));
}
开发者ID:markcoker,项目名称:wpFileSearch,代码行数:27,代码来源:wpFileSearch.php

示例6: activate

 /**
  * Short Description. (use period)
  *
  * Long Description.
  *
  * @since    1.1
  */
 public function activate()
 {
     // Create our directory if it is not exist
     $dir_path = get_home_path() . '/' . $this->attempts_dir;
     $dir_path = (is_dir($dir_path) || mkdir($dir_path, 0777, TRUE)) && is_writable($dir_path) ? $dir_path : FALSE;
     //Try to open the protected files
     foreach ($this->protected_files as $sfile) {
         $include_file = 'wp-content/plugins/hackattempts/include.php';
         $insert_text = 'require_once("' . $include_file . '");';
         $file = file(get_home_path() . '/' . $sfile, FILE_IGNORE_NEW_LINES);
         $first_line = array_shift($file);
         array_unshift($file, $insert_text);
         // push second line
         array_unshift($file, $first_line);
         // Save back the first line
         $fp = fopen(get_home_path() . '/' . $sfile, 'w');
         // Reopen the file
         fwrite($fp, implode("\n", $file));
         fclose($fp);
     }
     // Update database if db version has increased
     $current_db_version = get_option('hackattempts-db-version');
     if (!$current_db_version) {
         $current_db_version = 0;
     }
     if (intval($current_db_version) < Hackattempts_Activator::$db_version) {
         if ($this->create_or_upgrade_db()) {
             update_option('hackattempts-db-version', Hackattempts_Activator::$db_version);
         }
     }
     wp_schedule_event(time(), 'hourly', 'hackattempts_cleanup');
     wp_schedule_event(time(), 'hourly', 'hackattempts_email');
     wp_schedule_event(time(), 'hourly', 'hackattempts_check_file_mod');
 }
开发者ID:Wathfea,项目名称:hackattempts,代码行数:41,代码来源:class-hackattempts-activator.php

示例7: update_mu_htaccess

 function update_mu_htaccess($include_rs_rules = true)
 {
     //rs_errlog( "update_mu_htaccess: arg = $include_rs_rules" );
     if (defined('SCOPER_NO_HTACCESS')) {
         return;
     }
     $include_rs_rules = $include_rs_rules && get_site_option('scoper_file_filtering');
     // scoper_get_option is not reliable for initial execution following plugin activation
     if (!$include_rs_rules) {
         delete_site_option('scoper_file_filtered_sites');
     }
     //rs_errlog( "update_mu_htaccess: $include_rs_rules" );
     if (file_exists(ABSPATH . '/wp-admin/includes/file.php')) {
         include_once ABSPATH . '/wp-admin/includes/file.php';
     }
     $home_path = get_home_path();
     $htaccess_path = $home_path . '.htaccess';
     if (!file_exists($htaccess_path)) {
         return;
     }
     $contents = file_get_contents($htaccess_path);
     if ($pos_def = ScoperRewriteMU::default_file_rule_pos($contents)) {
         $fp = fopen($htaccess_path, 'w');
         if ($pos_rs_start = strpos($contents, "\n# BEGIN Role Scoper")) {
             fwrite($fp, substr($contents, 0, $pos_rs_start));
         } else {
             fwrite($fp, substr($contents, 0, $pos_def));
         }
         if ($include_rs_rules) {
             fwrite($fp, ScoperRewrite::build_site_rules(false));
         }
         fwrite($fp, substr($contents, $pos_def));
         fclose($fp);
     }
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:35,代码来源:rewrite-mu_rs.php

示例8: job_board_rewrite

 /**
  * job_board_rewrite function.
  *
  * @access public
  * @return void
  */
 public function job_board_rewrite()
 {
     if (!function_exists('get_home_path')) {
         require_once ABSPATH . 'wp-admin/includes/file.php';
     }
     $root_path = get_home_path();
     $file_existing_permission = '';
     /* Getting Rules */
     $rules = 'yes' === get_option('job_board_anti_hotlinking') ? $this->job_board_rewrite_rules() : '';
     /* Rules Force Files to be Downloaded  */
     $forcedownload_rule = "AddType application/octet-stream .pdf .txt\n";
     /* Changing File to Writable Mode  */
     if (file_exists($root_path . '.htaccess') && !is_writable($root_path . '.htaccess')) {
         $file_existing_permission = substr(decoct(fileperms($root_path . '.htaccess')), -4);
         chmod($root_path . '.htaccess', 0777);
     }
     /* Appending .htaccess  */
     if (file_exists($root_path . '.htaccess') && is_writable($root_path . '.htaccess')) {
         $rules = explode("\n", $rules);
         $forcedownload_rule = explode("\n", $forcedownload_rule);
         // Anti-Hotlinking Rules Writing in .htaccess file
         if (!function_exists('insert_with_markers')) {
             require_once ABSPATH . 'wp-admin/includes/misc.php';
         }
         insert_with_markers($root_path . '.htaccess', 'Hotlinking', $rules);
         // Force Download Rules Writing in .htaccess file
         insert_with_markers($root_path . '.htaccess', 'Force Download', $forcedownload_rule);
         /* Revert File Permission  */
         if (!empty($file_existing_permission)) {
             chmod($root_path . '.htaccess', $file_existing_permission);
         }
     }
 }
开发者ID:jep-heroes,项目名称:wp,代码行数:39,代码来源:class-simple-job-board-rewrite.php

示例9: ewww_image_optimizer_webp_scan

function ewww_image_optimizer_webp_scan()
{
    global $ewww_debug;
    $ewww_debug .= "<b>ewww_image_optimizer_webp_scan()</b><br>";
    $list = array();
    $dir = get_home_path();
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
    $start = microtime(true);
    $file_counter = 0;
    foreach ($iterator as $path) {
        set_time_limit(0);
        $skip_optimized = false;
        if ($path->isDir()) {
            continue;
        } else {
            $file_counter++;
            $path = $path->getPathname();
            $newwebpformat = preg_replace('/\\.webp/', '', $path);
            if (file_exists($newwebpformat)) {
                continue;
            }
            if (preg_match('/\\.webp$/', $path)) {
                $ewww_debug .= "queued {$path}<br>";
                $list[] = $path;
            }
        }
    }
    $end = microtime(true) - $start;
    $ewww_debug .= "query time for {$file_counter} files (seconds): {$end} <br>";
    return $list;
}
开发者ID:hkarriche,项目名称:wordpress,代码行数:31,代码来源:mwebp.php

示例10: acp_page

 public static function acp_page()
 {
     wp_enqueue_script('jquery');
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('jquery-ui-tabs');
     wp_enqueue_style("jquery-ui-css", "//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css");
     $saved = true;
     if (!is_writable(__DIR__)) {
         self::show_message(__('Unable to save configuration changes. The plugin folder is not writable.', 'nnorg-wp-affiliatr'));
     }
     if (isset($_POST['Update'])) {
         $nnorg_afltr_path = esc_html(trim($_POST['nnorg_afltr_path']));
         if (file_exists(get_home_path() . $nnorg_afltr_path)) {
             file_put_contents(NNORG_AFLTR_SETTINGS_CFG, $nnorg_afltr_path);
         } else {
             self::show_message(__('The new path has not been found and was not saved!', 'nnorg-wp-affiliatr'), true);
             $saved = false;
         }
     }
     if (file_exists(NNORG_AFLTR_SETTINGS_CFG)) {
         $nnorg_afltr_path = file_get_contents(NNORG_AFLTR_SETTINGS_CFG);
     }
     if ($saved) {
         if (file_exists(get_home_path() . $nnorg_afltr_path) && file_exists(get_home_path() . $nnorg_afltr_path . '/inc/config/config.php')) {
             self::show_message(__('Path has been found!', 'nnorg-wp-affiliatr'));
         } else {
             self::show_message(__('The given path was not found!', 'nnorg-wp-affiliatr'), true);
         }
     }
     include 'nnorg-wp-affiliatr-view.php';
 }
开发者ID:sea75300,项目名称:affiliat_r,代码行数:31,代码来源:nnorg-wp-affiliatr-functions.php

示例11: uncode_add_h5bp_htaccess

/**
 * Add HTML5 Boilerplate's .htaccess via WordPress
 */
function uncode_add_h5bp_htaccess()
{
    $options = get_option(ot_options_id());
    $theme_opt = $options['_uncode_htaccess'];
    $saved_opt = get_option("_uncode_htaccess_performace");
    if ($theme_opt === 'on' && $saved_opt !== 'on' || $theme_opt === 'off' && $saved_opt === 'on') {
        global $wp_rewrite;
        $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
        $htaccess_file = $home_path . '.htaccess';
        $mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
        if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
            if ($mod_rewrite_enabled) {
                $h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');
                if ($h5bp_rules === array()) {
                    $filename = dirname(__FILE__) . '/h5bp-htaccess';
                    update_option("_uncode_htaccess_performace", $theme_opt);
                    return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', extract_from_markers($filename, 'HTML5 Boilerplate'));
                } else {
                    if ($theme_opt === 'off') {
                        update_option("_uncode_htaccess_performace", $theme_opt);
                        return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', '');
                    }
                }
            }
        }
    }
}
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:30,代码来源:performance.php

示例12: adaptive_images_actions_get_htaccess_block

/**
 * Creates the .htaccess rewrite block which ensures that images in watched directories are filtered by the 
 * adaptive images plugin.
 * 
 * @author Nevma (info@nevma.gr)
 * 
 * @param array $data The adaptive images options. If not given then the existing ones from the database will be 
 *                    used.
 * 
 * @return string The adaptive images plugin .htaccess rewrite block.
 */
function adaptive_images_actions_get_htaccess_block($data)
{
    // If no options data given then take what is in the database.
    if (!$data) {
        $data = get_option('adaptive-images');
    }
    // Get the directory part of the request, if we are not in the virtual host root directory.
    $request_uri = $_SERVER['REQUEST_URI'];
    $request_uri_base = substr($request_uri, 0, strpos($request_uri, '/wp-admin', 1));
    // Isolate the relative path of the adaptive images PHP script inside the WordPress installation directory.
    $wp_home_path = get_home_path();
    $wp_home_path = preg_replace('/\\//i', '\\/', $wp_home_path);
    $wp_home_path = preg_replace('/\\./i', '\\.', $wp_home_path);
    $adaptive_images_dir_path = dirname(__FILE__);
    $adaptive_images_dir_path_relative = preg_replace('/' . $wp_home_path . '/i', '', $adaptive_images_dir_path);
    $adaptive_images_php_script = $request_uri_base . '/' . $adaptive_images_dir_path_relative . '/adaptive-images-script.php';
    // If no starting slash then add it.
    if (strpos($adaptive_images_php_script, '/') !== 0) {
        $adaptive_images_php_script = '/' . $adaptive_images_php_script;
    }
    // Create the watched directories .htaccess block part.
    $htaccess_rewrite_block = "# BEGIN Adaptive Images\n" . "#=======================\n" . "\n" . "<IfModule mod_rewrite.c>\n" . "\n" . "    RewriteEngine On\n" . "\n" . "    # Watched directories\n";
    for ($k = 0, $length = count($data['watched-directories']); $k < $length; $k++) {
        $watched_directory = $data['watched-directories'][$k];
        $htaccess_rewrite_block .= "    RewriteCond %{REQUEST_URI} " . $request_uri_base . '/' . $watched_directory . ($k < $length - 1 ? ' [OR]' : "\n") . "\n";
    }
    // Create the rewrite .htaccess block part.
    $htaccess_rewrite_block .= "    # Redirect images through the adaptive images script\n" . "    RewriteRule \\.(?:jpe?g|gif|png)\$ " . $adaptive_images_php_script . " [L]\n" . "\n" . "</IfModule>\n" . "\n" . "# END Adaptive Images";
    return $htaccess_rewrite_block;
}
开发者ID:bchamberlain88,项目名称:pavati,代码行数:41,代码来源:adaptive-images-actions.php

示例13: ewww_image_optimizer_webp_scan

function ewww_image_optimizer_webp_scan() {
	ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
	$list = array();
	$dir = get_home_path();
	$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir ), RecursiveIteratorIterator::CHILD_FIRST );
	$start = microtime( true );
	$file_counter = 0;
	foreach ( $iterator as $path ) {
		set_time_limit ( 0 );
		$skip_optimized = false;
		if ( $path->isDir() ) {
			continue;
		} else {
			$file_counter++;
			$path = $path->getPathname();
			$newwebpformat = preg_replace( '/\.webp/', '', $path );
			if ( file_exists( $newwebpformat ) ) {
				continue;
			}
			if ( preg_match( '/\.webp$/', $path ) ) {
				ewwwio_debug_message( "queued $path" );
				$list[] = $path;
			}
		}
	}
	$end = microtime( true ) - $start;
        ewwwio_debug_message( "query time for $file_counter files (seconds): $end" );
	return $list;
}
开发者ID:recetasdemama,项目名称:wordpress,代码行数:29,代码来源:mwebp.php

示例14: easy_ads_manager_admin_eq

function easy_ads_manager_admin_eq()
{
    if (is_rtl()) {
        wp_enqueue_style('mian-css-admin_ads', plugin_dir_url(__FILE__) . 'css/easy-ads-manager.css');
        wp_enqueue_style('mian-css-admin_rtl_ads', plugin_dir_url(__FILE__) . 'css/rtl.css');
    } else {
        wp_enqueue_style('mian-css-admin_ads', plugin_dir_url(__FILE__) . 'css/easy-ads-manager.css');
    }
    wp_enqueue_style('jquery-ui-datepicker-style', plugin_dir_url(__FILE__) . 'css/jquery-ui.css');
    wp_enqueue_style('font_awesom-admin_ads', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
    ?>
	<script type="text/javascript">
		var pluginurl_ads = '<?php 
    echo plugin_dir_url(__FILE__);
    ?>
',
			path_ads = '<?php 
    echo get_home_path();
    ?>
';
	</script>
	<?php 
    wp_enqueue_media();
    wp_enqueue_script('jquery-ui-datepicker');
    wp_enqueue_script('ajax-script_ads', plugin_dir_url(__FILE__) . 'js/easy-ads-manager.js', array('jquery'));
    wp_localize_script('ajax-script_ads', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
}
开发者ID:shokry055,项目名称:easy-ads-manager,代码行数:27,代码来源:easy-ads-manager.php

示例15: custom_admin_url

 function custom_admin_url()
 {
     if (isset($_POST['custom_wpadmin_slug'])) {
         // sanitize input
         $wpadmin_slug = trim(sanitize_key(wp_strip_all_tags($_POST['custom_wpadmin_slug'])));
         $home_path = get_home_path();
         // check if permalinks are turned off, if so force push rules to .htaccess
         if (isset($_POST['selection']) && $_POST['selection'] == '' && $wpadmin_slug != '') {
             // check if .htaccess is writable
             if (!file_exists($home_path . '.htaccess') && is_writable($home_path) || is_writable($home_path . '.htaccess')) {
                 // taken from wp-includes/rewrite.php
                 $home_root = parse_url(home_url());
                 if (isset($home_root['path'])) {
                     $home_root = trailingslashit($home_root['path']);
                 } else {
                     $home_root = '/';
                 }
                 // create rules
                 $rules = "<IfModule mod_rewrite.c>\n";
                 $rules .= "RewriteEngine On\n";
                 $rules .= "RewriteRule ^{$wpadmin_slug}/?\$ " . $home_root . "wp-login.php [QSA,L]\n";
                 $rules .= "</IfModule>";
                 // write to .htaccess
                 insert_with_markers($home_path . '.htaccess', 'WPAdminURL', explode("\n", $rules));
             }
         } else {
             if (isset($_POST['selection']) || isset($_POST['selection']) && $_POST['selection'] == '' && $wpadmin_slug == '') {
                 // remove rules if permalinks were enabled
                 $markerdata = explode("\n", implode('', file($home_path . '.htaccess')));
                 $found = false;
                 $newdata = '';
                 foreach ($markerdata as $line) {
                     if ($line == '# BEGIN WPAdminURL') {
                         $found = true;
                     }
                     if (!$found) {
                         $newdata .= "{$line}\n";
                     }
                     if ($line == '# END WPAdminURL') {
                         $found = false;
                     }
                 }
                 // write back
                 $f = @fopen($home_path . '.htaccess', 'w');
                 fwrite($f, $newdata);
             }
         }
         // save to db
         update_option('custom_wpadmin_slug', $wpadmin_slug);
         // write rewrite rules right away
         if ($wpadmin_slug != '') {
             add_rewrite_rule($wpadmin_slug . '/?$', 'wp-login.php', 'top');
         } else {
             flush_rewrite_rules();
         }
     }
     add_settings_field('custom_wpadmin_slug', 'WP-Admin slug', array($this, 'options_page'), 'permalink', 'optional', array('label_for' => 'custom_wpadmin_slug'));
     register_setting('permalink', 'custom_wpadmin_slug', 'strval');
 }
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:59,代码来源:hc-custom-wp-admin-url.php


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