本文整理汇总了PHP中is_blog_installed函数的典型用法代码示例。如果您正苦于以下问题:PHP is_blog_installed函数的具体用法?PHP is_blog_installed怎么用?PHP is_blog_installed使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_blog_installed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rewriteUrls
public static function rewriteUrls()
{
if (!function_exists('is_blog_installed') || !is_blog_installed()) {
return false;
}
// Remove domain from uploads
update_option('upload_path', null);
$old_url = site_url();
$new_url = ($_SERVER['SERVER_PORT'] === '443' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
// Ensure internal WordPress functions map correctly to new url (but don't want to persist in the DB)
add_filter('option_home', function ($value) use($old_url, $new_url) {
return str_replace($old_url, $new_url, $value);
});
add_filter('option_siteurl', function ($value) use($old_url, $new_url) {
return str_replace($old_url, $new_url, $value);
});
add_filter('option_upload_path', function ($value) use($old_url, $new_url) {
return str_replace($old_url, $new_url, $value);
});
add_filter('option_upload_url_path', function ($value) use($old_url, $new_url) {
return str_replace($old_url, $new_url, $value);
});
add_filter('wp_get_attachment_url', function ($value) use($old_url, $new_url) {
return str_replace($old_url, $new_url, $value);
});
// Override URLs in output with local environment URL
ob_start(function ($output) use($old_url, $new_url) {
return str_replace($old_url, $new_url, $output);
});
register_shutdown_function(function () {
@ob_end_flush();
});
}
示例2: install
/**
* Run wp_install. Assumes that wp-config.php is already in place.
*/
public function install($args, $assoc_args)
{
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
if (is_blog_installed()) {
WP_CLI::error('WordPress is already installed.');
}
extract(wp_parse_args($assoc_args, array('site_url' => defined('WP_SITEURL') ? WP_SITEURL : '', 'site_title' => '', 'admin_name' => 'admin', 'admin_email' => '', 'admin_password' => '')), EXTR_SKIP);
$missing = false;
foreach (array('site_url', 'site_title', 'admin_email', 'admin_password') as $required_arg) {
if (empty(${$required_arg})) {
WP_CLI::warning("missing --{$required_arg} parameter");
$missing = true;
}
}
if ($site_url) {
WP_CLI::set_url($site_url);
}
if ($missing) {
exit(1);
}
$public = true;
$result = wp_install($site_title, $admin_name, $admin_email, $public, '', $admin_password);
if (is_wp_error($result)) {
WP_CLI::error('Installation failed (' . WP_CLI::errorToString($result) . ').');
} else {
WP_CLI::success('WordPress installed successfully.');
}
}
示例3: cf_fields_init
function cf_fields_init()
{
if (!is_blog_installed()) {
return;
}
$this->cf_field_manager->register_field('CF_Field_Input');
$this->cf_field_manager->register_field('CF_Field_Textarea');
$this->cf_field_manager->register_field('CF_Field_EditorLight');
$this->cf_field_manager->register_field('CF_Field_Select');
$this->cf_field_manager->register_field('CF_Field_SelectMultiple');
$this->cf_field_manager->register_field('CF_Field_Checkbox');
$this->cf_field_manager->register_field('CF_Field_Radio');
$this->cf_field_manager->register_field('CF_Field_DatePicker');
$this->cf_field_manager->register_field('CF_Field_Dropdown_Users');
$this->cf_field_manager->register_field('CF_Field_Media');
$this->cf_field_manager->register_field('CF_Field_Dropdown_Pages');
if (function_exists('rpt_set_object_relation')) {
$this->cf_field_manager->register_field('CF_Field_RelationPostType');
}
do_action_ref_array('fields_init-' . $this->post_type, array(&$this));
do_action_ref_array('fields-init', array(&$this->cf_field_manager));
$this->get_var('sidebars');
if (isset($this->sidebars) && is_array($this->sidebars)) {
foreach ($this->sidebars as $sidebar) {
$sidebar['before_widget'] = '<div class="form-field">';
$sidebar['after_widget'] = '</div>';
$sidebar['before_title'] = '<label class="title-field">';
$sidebar['after_title'] = ' :</label>';
$this->cf_sidebar->cf_register_sidebar($sidebar);
}
}
}
示例4: wp_ctc_init
/**
* @desc Initialize the plugin
*/
function wp_ctc_init()
{
if (!is_blog_installed()) {
return;
}
if (!is_admin()) {
} else {
add_filter('admin_head', 'wp_ctc_admin_head');
add_action('admin_menu', 'wp_ctc_admin_panel');
}
//Initialize Options
if (!($options = get_option('wp_ctc_options'))) {
$options['ctc_smallest'] = 8;
$options['ctc_largest'] = 22;
$options['ctc_title'] = '';
$options['ctc_unit'] = 'pt';
$options['ctc_number'] = 45;
$options['ctc_format'] = 'flat';
$options['ctc_orderby'] = 'name';
$options['ctc_order'] = 'ASC';
$options['ctc_show_tags_count'] = 0;
$options['ctc_power'] = 1.0;
$i = 8;
while ($i <= 22) {
//set up colors from the request
$options['ctc_color_for_size' . $i] = "#000";
//echo('ctc_color_for_size'.$i); echo(' '); echo($options['ctc_color_for_size'.$i]); echo('<br/>');
$i += 1;
}
update_option('wp_ctc_options', $options);
}
register_widget('WP_Widget_Colorful_Tag_Cloud');
}
示例5: uw_story_register_widgets
function uw_story_register_widgets()
{
if (!is_blog_installed()) {
return;
}
register_widget('UW_Story_Social_Widget');
}
示例6: baol_Page_Content_init
function baol_Page_Content_init()
{
if (!is_blog_installed()) {
return;
}
register_widget('Baol_Widget_Page_Content');
}
示例7: uw_register_widgets
function uw_register_widgets()
{
if (!is_blog_installed()) {
return;
}
unregister_widget('Widget_Akismet');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Recent_Posts');
unregister_widget('WP_Widget_RSS');
//register_widget('UW_Widget_Single_Image');
//register_widget('UW_RSS_Widget');
//register_widget('UW_Widget_Recent_Posts');
//register_widget('UW_Widget_CommunityPhotos');
register_widget('UW_Widget_Categories');
//register_widget('UW_Widget_Twitter');
//register_widget('UW_KEXP_KUOW_Widget');
//register_widget('UW_Showcase_Widget');
//register_widget('UW_Subpage_Menu');
register_widget('UW_Nav_Menu_Widget');
//register_widget('UW_Calendar');
//register_widget('UW_Campus_Map');
// Specific to Page Builder only
register_widget('UW_Headline_Separator_Widget');
register_widget('UW_Headline_Widget');
register_widget('UW_Intro_Widget');
//register_widget('UW_YouTube_Playlist_Widget');
if (is_multisite() && get_blog_details('marketing')) {
register_widget('UW_Pride_Points');
}
}
示例8: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$env = Validators::validateEnv($input->getOption('env'));
$_SERVER['DOCUMENT_ROOT'] = getcwd();
$_SERVER['SERVER_PROTOCOL'] = 'http';
$_SERVER['HTTP_HOST'] = $this->skeleton->get('deploy.%s.web.host', $env);
define('WP_ROOT', $this->skeleton->getWebRoot() . '/');
define('WP_INSTALLING', true);
require WP_ROOT . 'wp-load.php';
require WP_ROOT . 'wp-admin/includes/admin.php';
require WP_ROOT . 'wp-admin/includes/upgrade.php';
if (is_blog_installed()) {
$output->writeln('<error>Already installed.</error>');
return 1;
}
$output->write('Installing...');
$result = wp_install($this->skeleton->get('name'), $this->skeleton->get('wordpress.%s.admin.user', $env), $this->skeleton->get('wordpress.%s.admin.email', $env), true, '', $this->skeleton->get('wordpress.%s.admin.password', $env));
if (is_wp_error($result)) {
throw new \Exception($result);
}
update_option('db_version', $wp_db_version);
update_option('db_upgraded', true);
$output->writeln('<info>DONE</info>');
$output->writeln(sprintf("\nLogin as <info>%s</info> with the password <info>%s</info>", $this->skeleton->get('wordpress.%s.admin.user', $env), $this->skeleton->get('wordpress.%s.admin.password', $env)));
}
示例9: pootlepress_text_widgets_init
function pootlepress_text_widgets_init()
{
if (!is_blog_installed()) {
return;
}
register_widget('Pootle_Text_Widget');
}
示例10: cf_fields_init
function cf_fields_init()
{
if (!is_blog_installed()) {
return;
}
$this->cf_field_manager->register_field('CF_Field_Input');
$this->cf_field_manager->register_field('CF_Field_Textarea');
$this->cf_field_manager->register_field('CF_Field_EditorLight');
$this->cf_field_manager->register_field('CF_Field_Select');
$this->cf_field_manager->register_field('CF_Field_SelectMultiple');
$this->cf_field_manager->register_field('CF_Field_Checkbox');
$this->cf_field_manager->register_field('CF_Field_DatePicker');
$this->cf_field_manager->register_field('CF_Field_Dropdown_Users');
$this->cf_field_manager->register_field('CF_Field_Media');
$this->cf_field_manager->register_field('CF_Field_Separator');
do_action_ref_array('fields_init-' . $this->post_type, array(&$this));
$this->get_var('sidebars');
if (isset($this->sidebars) && is_array($this->sidebars)) {
foreach ($this->sidebars as $sidebar) {
$sidebar['before_widget'] = '<tr class="form-field">';
$sidebar['after_widget'] = '</td></tr>';
$sidebar['before_title'] = '<th valign="top" scope="row"><label>';
$sidebar['after_title'] = '</label></th><td>';
$this->cf_sidebar->cf_register_sidebar($sidebar);
}
}
}
示例11: init
public function init()
{
if (!is_blog_installed()) {
return;
}
load_plugin_textdomain('partners-banners-widgets', false, 'partners-banners/languages');
register_widget('Partners_Banners_Widget');
}
示例12: mlm_widgets_init
/**
* Unregister some the default WordPress widgets on startup and register our
* slightly modified versions
*
* @since 3.1.0
*/
function mlm_widgets_init()
{
if (!is_blog_installed()) {
return;
}
unregister_widget('WP_Nav_Menu_Widget');
register_widget('MLM_Nav_Menu_Widget');
}
示例13: google_privacy_policy_install
function google_privacy_policy_install()
{
global $wpdb;
if (!is_blog_installed()) {
return;
}
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
}
示例14: ubm_widget_init
function ubm_widget_init()
{
if (!is_blog_installed()) {
return;
}
register_widget('UBM_Widget');
register_widget('UBM_Rotation_Widget');
}
示例15: install
/**
* Install WC.
*/
public static function install()
{
global $wpdb;
if (!is_blog_installed()) {
return;
}
if (!defined('WC_INSTALLING')) {
define('WC_INSTALLING', true);
}
// Ensure needed classes are loaded
include_once dirname(__FILE__) . '/admin/class-wc-admin-notices.php';
self::create_options();
self::create_tables();
self::create_roles();
// Register post types
WC_Post_types::register_post_types();
WC_Post_types::register_taxonomies();
// Also register endpoints - this needs to be done prior to rewrite rule flush
WC()->query->init_query_vars();
WC()->query->add_endpoints();
WC_API::add_endpoint();
WC_Auth::add_endpoint();
self::create_terms();
self::create_cron_jobs();
self::create_files();
// Queue upgrades/setup wizard
$current_wc_version = get_option('woocommerce_version', null);
$current_db_version = get_option('woocommerce_db_version', null);
WC_Admin_Notices::remove_all_notices();
// No versions? This is a new install :)
if (is_null($current_wc_version) && is_null($current_db_version) && apply_filters('woocommerce_enable_setup_wizard', true)) {
WC_Admin_Notices::add_notice('install');
set_transient('_wc_activation_redirect', 1, 30);
// No page? Let user run wizard again..
} elseif (!get_option('woocommerce_cart_page_id')) {
WC_Admin_Notices::add_notice('install');
}
if (!is_null($current_db_version) && version_compare($current_db_version, max(array_keys(self::$db_updates)), '<')) {
WC_Admin_Notices::add_notice('update');
} else {
self::update_db_version();
}
self::update_wc_version();
// Flush rules after install
do_action('woocommerce_flush_rewrite_rules');
delete_transient('wc_attribute_taxonomies');
/*
* Deletes all expired transients. The multi-table delete syntax is used
* to delete the transient record from table a, and the corresponding
* transient_timeout record from table b.
*
* Based on code inside core's upgrade_network() function.
*/
$sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\t\tWHERE a.option_name LIKE %s\n\t\t\tAND a.option_name NOT LIKE %s\n\t\t\tAND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )\n\t\t\tAND b.option_value < %d";
$wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', time()));
// Trigger action
do_action('woocommerce_installed');
}