trackback

Definition:
function trackback($trackback_url, $title, $excerpt, $ID) {}

Send a Trackback.
Updates database when sending trackback to prevent duplicates.

Parameters

  • string $trackback_url: URL to send trackbacks.
  • string $title: Title of post.
  • string $excerpt: Excerpt of post.
  • int $ID: Post ID.

Return values

returns:Database query from update.

Source code

function trackback($trackback_url, $title, $excerpt, $ID) {

	global $wpdb;



	if ( empty($trackback_url) )

		return;



	$options = array();

	$options['timeout'] = 4;

	$options['body'] = array(

		'title' => $title,

		'url' => get_permalink($ID),

		'blog_name' => get_option('blogname'),

		'excerpt' => $excerpt

	);



	$response = wp_remote_post($trackback_url, $options);



	if ( is_wp_error( $response ) )

		return;



	$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID) );

	return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID) );

}

3069

touch_time

Definition:
function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {}

Parameters

  • unknown_type $edit
  • unknown_type $for_post
  • unknown_type $tab_index
  • unknown_type $multi

Source code

function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {

	global $wp_locale, $post, $comment;



	if ( $for_post )

		$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );



	$tab_index_attribute = '';

	if ( (int) $tab_index > 0 )

		$tab_index_attribute = " tabindex=\"$tab_index\"";



	// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';



	$time_adj = current_time('timestamp');

	$post_date = ($for_post) ? $post->post_date : $comment->comment_date;

	$jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );

	$mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );

	$aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );

	$hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );

	$mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );

	$ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );



	$cur_jj = gmdate( 'd', $time_adj );

	$cur_mm = gmdate( 'm', $time_adj );

	$cur_aa = gmdate( 'Y', $time_adj );

	$cur_hh = gmdate( 'H', $time_adj );

	$cur_mn = gmdate( 'i', $time_adj );



	$month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n";

	for ( $i = 1; $i < 13; $i = $i +1 ) {

		$month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';

		if ( $i == $mm )

			$month .= ' selected="selected"';

		$month .= '>' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";

	}

	$month .= '</select>';



	$day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';

	$year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';

	$hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';

	$minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';



	echo '<div class="timestamp-wrap">';

	/* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */

	printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute);



	echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';



	if ( $multi ) return;



	echo "\n\n";

	foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {

		echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";

		$cur_timeunit = 'cur_' . $timeunit;

		echo '<input type="hidden" id="'. $cur_timeunit . '" name="'. $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";

	}

?>



<p>

<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>

<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>

</p>

<?php

}

3067

tinymce_include

Definition:
function tinymce_include() {}

Source code

function tinymce_include() {

	_deprecated_function( __FUNCTION__, '2.1', 'wp_tiny_mce()' );



	wp_tiny_mce();

}

3065

timer_stop

Definition:
function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal

Return and/or display the time from the page start to when function is called.
You can get the results and print them by doing:

Parameters

  • int $display: Use ‘0’ or null to not echo anything and 1 to echo the total time
  • int $precision: The amount of digits from the right of the decimal to display. Default is 3.

Return values

returns:The "second.microsecond" finished time calculation

Source code

function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal

	global $timestart, $timeend;

	$mtime = microtime();

	$mtime = explode( ' ', $mtime );

	$timeend = $mtime[1] + $mtime[0];

	$timetotal = $timeend - $timestart;

	$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );

	if ( $display )

		echo $r;

	return $r;

}

3063

the_widget

Definition:
function the_widget($widget, $instance = array() {}

Output an arbitrary widget as a template tag

Parameters

  • string $widget: the widget’s PHP class name (see default-widgets.php)
  • array $instance: the widget’s instance settings
  • array $args: the widget’s sidebar args

Defined actions

  • the_widget
    do_action( 'the_widget', $widget, $instance, $args );

Source code

function the_widget($widget, $instance = array(), $args = array()) {

	global $wp_widget_factory;



	$widget_obj = $wp_widget_factory->widgets[$widget];

	if ( !is_a($widget_obj, 'WP_Widget') )

		return;



	$before_widget = sprintf('<div class="widget %s">', $widget_obj->widget_options['classname'] );

	$default_args = array( 'before_widget' => $before_widget, 'after_widget' => "</div>", 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' );



	$args = wp_parse_args($args, $default_args);

	$instance = wp_parse_args($instance);



	do_action( 'the_widget', $widget, $instance, $args );



	$widget_obj->_set(-1);

	$widget_obj->widget($args, $instance);

}

3061