make_url_footnote

Definition:
function make_url_footnote( $content ) {}

Strip HTML and put links at the bottom of stripped content.
Searches for all of the links, strips them out of the content, and places them at the bottom of the content with numbers.

Parameters

  • string $content: Content to get links

Return values

returns:HTML stripped out of content with links at the bottom.

Source code

function make_url_footnote( $content ) {

	_deprecated_function( __FUNCTION__, '2.9', '' );

	preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );

	$links_summary = "\n";

	for ( $i=0; $i<count($matches[0]); $i++ ) {

		$link_match = $matches[0][$i];

		$link_number = '['.($i+1).']';

		$link_url = $matches[2][$i];

		$link_text = $matches[4][$i];

		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );

		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;

		$links_summary .= "\n" . $link_number . ' ' . $link_url;

	}

	$content  = strip_tags( $content );

	$content .= $links_summary;

	return $content;

}

2319

make_site_theme_from_oldschool

Definition:
function make_site_theme_from_oldschool($theme_name, $template) {}

Parameters

  • unknown_type $theme_name
  • unknown_type $template

Source code

function make_site_theme_from_oldschool($theme_name, $template) {

	$home_path = get_home_path();

	$site_dir = WP_CONTENT_DIR . "/themes/$template";



	if (! file_exists("$home_path/index.php"))

		return false;



	// Copy files from the old locations to the site theme.

	// TODO: This does not copy arbitarary include dependencies.  Only the

	// standard WP files are copied.

	$files = array('index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php');



	foreach ($files as $oldfile => $newfile) {

		if ($oldfile == 'index.php')

			$oldpath = $home_path;

		else

			$oldpath = ABSPATH;



		if ($oldfile == 'index.php') { // Check to make sure it's not a new index

			$index = implode('', file("$oldpath/$oldfile"));

			if (strpos($index, 'WP_USE_THEMES') !== false) {

				if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile"))

					return false;

				continue; // Don't copy anything

				}

		}



		if (! @copy("$oldpath/$oldfile", "$site_dir/$newfile"))

			return false;



		chmod("$site_dir/$newfile", 0777);



		// Update the blog header include in each file.

		$lines = explode("\n", implode('', file("$site_dir/$newfile")));

		if ($lines) {

			$f = fopen("$site_dir/$newfile", 'w');



			foreach ($lines as $line) {

				if (preg_match('/require.*wp-blog-header/', $line))

					$line = '//' . $line;



				// Update stylesheet references.

				$line = str_replace("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);



				// Update comments template inclusion.

				$line = str_replace("<?php include(ABSPATH . 'wp-comments.php'); ?>", "<?php comments_template(); ?>", $line);



				fwrite($f, "{$line}\n");

			}

			fclose($f);

		}

	}

2317

make_site_theme_from_default

Definition:
function make_site_theme_from_default($theme_name, $template) {}

Parameters

  • unknown_type $theme_name
  • unknown_type $template

Source code

function make_site_theme_from_default($theme_name, $template) {

	$site_dir = WP_CONTENT_DIR . "/themes/$template";

	$default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME;



	// Copy files from the default theme to the site theme.

	//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');



	$theme_dir = @ opendir($default_dir);

	if ($theme_dir) {

		while(($theme_file = readdir( $theme_dir )) !== false) {

			if (is_dir("$default_dir/$theme_file"))

				continue;

			if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))

				return;

			chmod("$site_dir/$theme_file", 0777);

		}

	}

	@closedir($theme_dir);



	// Rewrite the theme header.

	$stylelines = explode("\n", implode('', file("$site_dir/style.css")));

	if ($stylelines) {

		$f = fopen("$site_dir/style.css", 'w');



		foreach ($stylelines as $line) {

			if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;

			elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');

			elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';

			elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';

			elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';

			fwrite($f, $line . "\n");

		}

		fclose($f);

	}



	// Copy the images.

	umask(0);

	if (! mkdir("$site_dir/images", 0777)) {

		return false;

	}



	$images_dir = @ opendir("$default_dir/images");

	if ($images_dir) {

		while(($image = readdir($images_dir)) !== false) {

			if (is_dir("$default_dir/images/$image"))

				continue;

			if (! @copy("$default_dir/images/$image", "$site_dir/images/$image"))

				return;

			chmod("$site_dir/images/$image", 0777);

		}

	}

	@closedir($images_dir);

}

2315

make_site_theme

Definition:
function make_site_theme() {}

Source code

function make_site_theme() {

	// Name the theme after the blog.

	$theme_name = __get_option('blogname');

	$template = sanitize_title($theme_name);

	$site_dir = WP_CONTENT_DIR . "/themes/$template";



	// If the theme already exists, nothing to do.

	if ( is_dir($site_dir)) {

		return false;

	}



	// We must be able to write to the themes dir.

	if (! is_writable(WP_CONTENT_DIR . "/themes")) {

		return false;

	}



	umask(0);

	if (! mkdir($site_dir, 0777)) {

		return false;

	}



	if (file_exists(ABSPATH . 'wp-layout.css')) {

		if (! make_site_theme_from_oldschool($theme_name, $template)) {

			// TODO:  rm -rf the site theme directory.

			return false;

		}

	} else {

		if (! make_site_theme_from_default($theme_name, $template))

			// TODO:  rm -rf the site theme directory.

			return false;

	}



	// Make the new site theme active.

	$current_template = __get_option('template');

	if ($current_template == WP_DEFAULT_THEME) {

		update_option('template', $template);

		update_option('stylesheet', $template);

	}

	return $template;

}

2313

make_db_current_silent

Definition:
function make_db_current_silent() {}

Parameters

  • $tables

Source code

function make_db_current_silent() {

	global $wp_queries;



	$alterations = dbDelta($wp_queries);

}

2311