insert_blog

Definition:
function insert_blog($domain, $path, $site_id) {}

Store basic site info in the blogs table.
This function creates a row in the wp_blogs table and returns the new blog’s ID. It is the first step in creating a new blog.

Parameters

  • string $domain: The domain of the new site.
  • string $path: The path of the new site.
  • int $site_id: Unless you’re running a multi-network install, be sure to set this value to 1.

Return values

returns:The ID of the new row

Source code

function insert_blog($domain, $path, $site_id) {

	global $wpdb;



	$path = trailingslashit($path);

	$site_id = (int) $site_id;



	$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );

	if ( ! $result )

		return false;



	refresh_blog_details($wpdb->insert_id);

	return $wpdb->insert_id;

}

2019

inline_edit_term_row

Definition:
function inline_edit_term_row($type, $taxonomy) {}

Parameters

  • string $type: “edit-tags”, “categoried” or “edit-link-categories”
  • string $taxonomy: The taxonomy of the row.

Defined actions

  • quick_edit_custom_box
    do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy );

Source code

function inline_edit_term_row($type, $taxonomy) {



	$tax = get_taxonomy($taxonomy);

	if ( ! current_user_can( $tax->cap->edit_terms ) )

		return;



	$columns = get_column_headers($type);

	$hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );

	$col_count = count($columns) - count($hidden);

	?>



<form method="get" action=""><table style="display: none"><tbody id="inlineedit">

	<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">



		<fieldset><div class="inline-edit-col">

			<h4><?php _e( 'Quick Edit' ); ?></h4>



			<label>

				<span class="title"><?php _e( 'Name' ); ?></span>

				<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>

			</label>

<?php if ( !is_multisite() ) { ?>

			<label>

				<span class="title"><?php _e( 'Slug' ); ?></span>

				<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>

			</label>

<?php } ?>



		</div></fieldset>



<?php



	$core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );



	foreach ( $columns as $column_name => $column_display_name ) {

		if ( isset( $core_columns[$column_name] ) )

			continue;

		do_action( 'quick_edit_custom_box', $column_name, $type, $taxonomy );

	}



?>



	<p class="inline-edit-save submit">

		<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>

		<?php $update_text = $tax->labels->update_item; ?>

		<a accesskey="s" href="#inline-edit" title="<?php echo esc_attr( $update_text ); ?>" class="save button-primary alignright"><?php echo $update_text; ?></a>

		<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />

		<span class="error" style="display:none;"></span>

		<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>

		<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $tax->name ); ?>" />

		<br class="clear" />

	</p>

	</td></tr>

	</tbody></table></form>

<?php

}

2017

inline_edit_row

Definition:
function inline_edit_row( $screen ) {}

Outputs the quick edit and bulk edit table rows for posts and pages

Parameters

  • string $screen

Defined filters

  • quick_edit_dropdown_pages_args
    apply_filters('quick_edit_dropdown_pages_args', $dropdown_args)

Defined actions

  • $bulk?’bulk_edit_custom_box’:’quick_edit_custom_box
    do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );

Source code

function inline_edit_row( $screen ) {

	global $mode;



	if ( is_string($screen) ) {

		$screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );

		$screen = (object) $screen;

	}



	$post = get_default_post_to_edit( $screen->post_type );

	$post_type_object = get_post_type_object( $screen->post_type );



	$taxonomy_names = get_object_taxonomies( $screen->post_type );

	$hierarchical_taxonomies = array();

	$flat_taxonomies = array();

	foreach ( $taxonomy_names as $taxonomy_name ) {

		$taxonomy = get_taxonomy( $taxonomy_name);



		if ( !$taxonomy->show_ui )

			continue;



		if ( $taxonomy->hierarchical )

			$hierarchical_taxonomies[] = $taxonomy;

		else

			$flat_taxonomies[] = $taxonomy;

	}



	$columns = wp_manage_posts_columns($screen);

	$hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );

	$col_count = count($columns) - count($hidden);

	$m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';

	$can_publish = current_user_can($post_type_object->cap->publish_posts);

	$core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );



?>



<form method="get" action=""><table style="display: none"><tbody id="inlineedit">

	<?php

	$hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';

	$bulk = 0;

	while ( $bulk < 2 ) { ?>



	<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type ";

		echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";

	?>" style="display: none"><td colspan="<?php echo $col_count; ?>">



	<fieldset class="inline-edit-col-left"><div class="inline-edit-col">

		<h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>





<?php



if ( post_type_supports( $screen->post_type, 'title' ) ) :

	if ( $bulk ) : ?>

		<div id="bulk-title-div">

			<div id="bulk-titles"></div>

		</div>



<?php else : // $bulk ?>



		<label>

			<span class="title"><?php _e( 'Title' ); ?></span>

			<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>

		</label>



		<label>

			<span class="title"><?php _e( 'Slug' ); ?></span>

			<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>

		</label>



<?php endif; // $bulk

endif; // post_type_supports title ?>



<?php if ( !$bulk ) : ?>

		<label><span class="title"><?php _e( 'Date' ); ?></span></label>

		<div class="inline-edit-date">

			<?php touch_time(1, 1, 4, 1); ?>

		</div>

		<br class="clear" />



<?php endif; // $bulk



	if ( post_type_supports( $screen->post_type, 'author' ) ) :

		$authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM

		$authors_dropdown = '';

		if ( $authors && count( $authors ) > 1 ) :

			$users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);

			if ( $bulk )

				$users_opt['show_option_none'] = __('&mdash; No Change &mdash;');

			$authors_dropdown  = '<label>';

			$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';

			$authors_dropdown .= wp_dropdown_users( $users_opt );

			$authors_dropdown .= '</label>';



		endif; // authors

?>



<?php if ( !$bulk ) echo $authors_dropdown;

endif; // post_type_supports author



if ( !$bulk ) :

?>



		<div class="inline-edit-group">

			<label class="alignleft">

				<span class="title"><?php _e( 'Password' ); ?></span>

				<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>

			</label>



			<em style="margin:5px 10px 0 0" class="alignleft">

				<?php

				/* translators: Between password field and private checkbox on post quick edit interface */

				echo __( '&ndash;OR&ndash;' );

				?>

			</em>

			<label class="alignleft inline-edit-private">

				<input type="checkbox" name="keep_private" value="private" />

				<span class="checkbox-title"><?php echo __('Private'); ?></span>

			</label>

		</div>



<?php endif; ?>



	</div></fieldset>



<?php if ( count($hierarchical_taxonomies) && !$bulk ) : ?>



	<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">



<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>



		<span class="title inline-edit-categories-label"><?php echo esc_html($taxonomy->labels->name) ?>

			<span class="catshow"><?php _e('[more]'); ?></span>

			<span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>

		</span>

		<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr($taxonomy->name) . '][]'; ?>" value="0" />

		<ul class="cat-checklist <?php echo esc_attr($taxonomy->name)?>-checklist">

			<?php wp_terms_checklist(null, array('taxonomy' => $taxonomy->name)) ?>

		</ul>



<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>



	</div></fieldset>



<?php endif; // count($hierarchical_taxonomies) && !$bulk ?>



	<fieldset class="inline-edit-col-right"><div class="inline-edit-col">



<?php

	if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )

		echo $authors_dropdown;

?>



<?php if ( $post_type_object->hierarchical ) : ?>



		<label>

			<span class="title"><?php _e( 'Parent' ); ?></span>

<?php

	$dropdown_args = array('post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');

	if ( $bulk )

		$dropdown_args['show_option_no_change'] =  __('&mdash; No Change &mdash;');

	$dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);

	wp_dropdown_pages($dropdown_args);

?>

		</label>



<?php if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :

		if ( !$bulk ) : ?>



		<label>

			<span class="title"><?php _e( 'Order' ); ?></span>

			<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>

		</label>



<?php	endif; // !$bulk ?>



		<label>

			<span class="title"><?php _e( 'Template' ); ?></span>

			<select name="page_template">

<?php	if ( $bulk ) : ?>

				<option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>

<?php	endif; // $bulk ?>

				<option value="default"><?php _e( 'Default Template' ); ?></option>

				<?php page_template_dropdown() ?>

			</select>

		</label>



<?php

	endif; // post_type_supports page-attributes

endif; // $post_type_object->hierarchical ?>



<?php if ( count($flat_taxonomies) && !$bulk ) : ?>



<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>



		<label class="inline-edit-tags">

			<span class="title"><?php echo esc_html($taxonomy->labels->name) ?></span>

			<textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr($taxonomy->name)?>]" class="tax_input_<?php echo esc_attr($taxonomy->name)?>"></textarea>

		</label>



<?php endforeach; //$flat_taxonomies as $taxonomy ?>



<?php endif; // count($flat_taxonomies) && !$bulk  ?>



<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :

	if ( $bulk ) : ?>



		<div class="inline-edit-group">

	<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>

		<label class="alignleft">

			<span class="title"><?php _e( 'Comments' ); ?></span>

			<select name="comment_status">

				<option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>

				<option value="open"><?php _e('Allow'); ?></option>

				<option value="closed"><?php _e('Do not allow'); ?></option>

			</select>

		</label>

	<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>

		<label class="alignright">

			<span class="title"><?php _e( 'Pings' ); ?></span>

			<select name="ping_status">

				<option value=""><?php _e('&mdash; No Change &mdash;'); ?></option>

				<option value="open"><?php _e('Allow'); ?></option>

				<option value="closed"><?php _e('Do not allow'); ?></option>

			</select>

		</label>

	<?php endif; ?>

		</div>



<?php else : // $bulk ?>



		<div class="inline-edit-group">

		<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>

			<label class="alignleft">

				<input type="checkbox" name="comment_status" value="open" />

				<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>

			</label>

		<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>

			<label class="alignleft">

				<input type="checkbox" name="ping_status" value="open" />

				<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>

			</label>

		<?php endif; ?>

		</div>



<?php endif; // $bulk

endif; // post_type_supports comments or pings ?>



		<div class="inline-edit-group">

			<label class="inline-edit-status alignleft">

				<span class="title"><?php _e( 'Status' ); ?></span>

				<select name="_status">

<?php if ( $bulk ) : ?>

					<option value="-1"><?php _e('&mdash; No Change &mdash;'); ?></option>

<?php endif; // $bulk ?>

				<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>

					<option value="publish"><?php _e( 'Published' ); ?></option>

					<option value="future"><?php _e( 'Scheduled' ); ?></option>

<?php if ( $bulk ) : ?>

					<option value="private"><?php _e('Private') ?></option>

<?php endif; // $bulk ?>

				<?php endif; ?>

					<option value="pending"><?php _e( 'Pending Review' ); ?></option>

					<option value="draft"><?php _e( 'Draft' ); ?></option>

				</select>

			</label>



<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>



<?php	if ( $bulk ) : ?>



			<label class="alignright">

				<span class="title"><?php _e( 'Sticky' ); ?></span>

				<select name="sticky">

					<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>

					<option value="sticky"><?php _e( 'Sticky' ); ?></option>

					<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>

				</select>

			</label>



<?php	else : // $bulk ?>



			<label class="alignleft">

				<input type="checkbox" name="sticky" value="sticky" />

				<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>

			</label>



<?php	endif; // $bulk ?>



<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_cap' ) ?>



		</div>



	</div></fieldset>



<?php

	foreach ( $columns as $column_name => $column_display_name ) {

		if ( isset( $core_columns[$column_name] ) )

			continue;

		do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );

	}

?>

	<p class="submit inline-edit-save">

		<a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>

		<?php if ( ! $bulk ) {

			wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );

			$update_text = __( 'Update' );

			?>

			<a accesskey="s" href="#inline-edit" title="<?php _e('Update'); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>

			<img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />

		<?php } else {

			$update_text = __( 'Update' );

		?>

			<input accesskey="s" class="button-primary alignright" type="submit" name="bulk_edit" value="<?php echo esc_attr( $update_text ); ?>" />

		<?php } ?>

		<input type="hidden" name="post_view" value="<?php echo esc_attr($m); ?>" />

		<input type="hidden" name="screen" value="<?php echo esc_attr($screen->id); ?>" />

		<br class="clear" />

	</p>

	</td></tr>

<?php

	$bulk++;

	} ?>

	</tbody></table></form>

<?php

}

2015

init

Definition:
function init () {}

Set up constants with default values, unless user overrides.

Source code

function init () {

	if ( defined('MAGPIE_INITALIZED') ) {

		return;

	}

	else {

		define('MAGPIE_INITALIZED', 1);

	}



	if ( !defined('MAGPIE_CACHE_ON') ) {

		define('MAGPIE_CACHE_ON', 1);

	}



	if ( !defined('MAGPIE_CACHE_DIR') ) {

		define('MAGPIE_CACHE_DIR', './cache');

	}



	if ( !defined('MAGPIE_CACHE_AGE') ) {

		define('MAGPIE_CACHE_AGE', 60*60); // one hour

	}



	if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {

		define('MAGPIE_CACHE_FRESH_ONLY', 0);

	}



		if ( !defined('MAGPIE_DEBUG') ) {

		define('MAGPIE_DEBUG', 0);

	}



	if ( !defined('MAGPIE_USER_AGENT') ) {

		$ua = 'WordPress/' . $GLOBALS['wp_version'];



		if ( MAGPIE_CACHE_ON ) {

			$ua = $ua . ')';

		}

		else {

			$ua = $ua . '; No cache)';

		}



		define('MAGPIE_USER_AGENT', $ua);

	}



	if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {

		define('MAGPIE_FETCH_TIME_OUT', 2);	// 2 second timeout

	}



	// use gzip encoding to fetch rss files if supported?

	if ( !defined('MAGPIE_USE_GZIP') ) {

		define('MAGPIE_USE_GZIP', true);

	}

}

2013

info

Parameters

  • $msg

Source code

function info($msg) {

	$args = func_get_args();



	$log = getLogger();

	$log->info(implode(', ', $args));

}

2011