'',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
//following code from http://bavotasan.com - many thanks
function getImage($num) {
global $more;
$more = 1;
$link = get_permalink();
$content = get_the_content();
$count = substr_count($content, '
');
$postOutput = substr($post, 0, $imgEnd+1);
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
$image[$i] = $postOutput;
$start=$imgEnd+1;
}
if(stristr($image[$num],'
'.$image[$num].""; }
$more = 0;
}
/**
* Snippets Function File
*
* LICENSE: The GNU General Public License (GPL)
*
* @copyright 2009 Business Xpand
* @license GPL v2.0
* @version 1.0
* @link http://www.businessxpand.com
* @since File available since Release 1.0
*/
/**
* Update your snippet fields here
*
* INSTRUCTIONS:
* - Array key (value before the => is only for the purposes of the admin system.
* - Array value (value after the => is the field name.
*
* - To use the value of the snippet in your theme call the following function:
*
* where the 'field_name' is the array value you entered below.
*
*/
$snippetFields = array('Twitter username' => 'username',
'Number of tweets to show' => 'tweets',
'Theme Logo' => 'theme_logo');
$default_logo = 'theme-logo.png'; // Change this to edit the default logo for the site (just change the file extension if you can)
/** DO NOT CHANGE ANYTHING BELOW THIS LINE */
/**
* Output snippet field value
*
* @param string $fieldName
* @return stdout
*/
function snippet($fieldName) {
if (isset($fieldName)) {
$snippetOptions = get_option('snippets');
if (isset($snippetOptions[$fieldName])) echo $snippetOptions[$fieldName];
}
}
/**
* Processing for the snippet theme admin page
*
* @param null
* @return void
*/
function snippetsAddThemePage() {
global $snippetFields;
wp_enqueue_script('ajax_upload',
get_bloginfo('stylesheet_directory') . '/ajaxupload.3.5.js',
array( 'jquery' ) );
wp_enqueue_script( 'thickbox' );
wp_enqueue_style( 'thickbox' );
if (isset($_GET['page']) && ($_GET['page']==basename(__FILE__))) {
if (isset($_REQUEST['action']) && ('save'==$_REQUEST['action'])) {
check_admin_referer('snippets-nonce');
if (isset($_REQUEST['snippetsform'])) {
delete_option('snippets');
foreach ($snippetFields as $dummy => $snippetField) {
if (isset($_REQUEST[$snippetField])) $snippetOptions[$snippetField] = $_REQUEST[$snippetField];
}
add_option('snippets', $snippetOptions);
}
wp_redirect("themes.php?page=functions.php&saved=true");
die;
}
}
add_theme_page('Snippets', 'Snippets', 'edit_themes', basename(__FILE__), 'snippetsThemePage');
}
add_action('admin_menu', 'snippetsAddThemePage');
/**
* Output the snippet theme admin page
*
* @param null
* @return void
*/
function snippetsThemePage() {
global $snippetFields, $default_logo;
$snippetOptions = get_option('snippets');
$upload_abs_path = get_option('upload_path');
$upload_path = get_bloginfo( 'siteurl' ) . '/' . str_replace(ABSPATH, '', get_option('upload_path'));
if (isset($_REQUEST['saved'])) echo ''.__('Snippet values saved.').'
';
?>