";*/ wp_enqueue_script('cufon-yui', $plugin . '/js/cufon/cufon-yui.js' ); wp_print_scripts('cufon-yui'); $count = 0; foreach (glob(WP_PLUGIN_DIR . "/cufon-fonts/*") as $path_to_files) { $count++; $file = basename($path_to_files); if(is_admin()) { ?> \n"; $count = 0; foreach (glob(WP_PLUGIN_DIR . "/cufon-fonts/*") as $path_to_files) { $count++; $file_name = basename($path_to_files); $file_content = file_get_contents($path_to_files); $delimeterLeft = 'font-family":"'; $delimeterRight = '"'; $font_name = font_name($file_content, $delimeterLeft, $delimeterRight, $debug = false); echo stripslashes("Cufon('#font-$count', { fontFamily: '$font_name' });\n"); } echo "\n"; ?> "; echo stripslashes(get_option("wpcuf_code")); echo ""; } } if (is_admin()) { add_action('admin_head', 'wpcuf_insert_code'); } else { add_action('wp_head', 'wpcuf_insert_code'); } /** * extract name of the font * * @since 1.0 */ function font_name($inputStr, $delimeterLeft, $delimeterRight, $debug = false) { $posLeft = strpos($inputStr, $delimeterLeft); if ($posLeft === false) { if ($debug) { echo "Warning: left delimiter '{$delimeterLeft}' not found"; } return false; } $posLeft += strlen($delimeterLeft); $posRight = strpos($inputStr, $delimeterRight, $posLeft); if ($posRight === false) { if ($debug) { echo "Warning: right delimiter '{$delimeterRight}' not found"; } return false; } return substr($inputStr, $posLeft, $posRight - $posLeft); } //*************** Admin function *************** /** * Let's call admin panel * * @since 1.0 */ function wpcuf_admin() { include ('wordpress_cufon_adminpanel.php'); } /** * Name of the panel etc. * * @since 1.0 */ function wpcuf_admin_actions() { add_options_page("All-In-One Cufon", "All-In-One Cufon", 1, "All-In-OneCufon", "wpcuf_admin"); } add_action('admin_menu', 'wpcuf_admin_actions'); ?>