. */ /* Stop direct call */ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die("Sorry, you don't have direct access to this page."); } /* attach JavaScript file for textarea resizing */ function afpw_js_sheet() { wp_enqueue_script('ta-expander-script', plugins_url('ta-expander.js', __FILE__), array('jquery'), '2.0', true); } add_action('admin_print_scripts-widgets.php', 'afpw_js_sheet'); //Additional links on the plugin page add_filter('plugin_row_meta', 'afpw_register_links',10,2); function afpw_register_links($links, $file) { $base = plugin_basename(__FILE__); if ($file == $base) { $links[] = ''.__('FAQ',$afpw_language_file).''; $links[] = ''.__('Donate',$afpw_language_file).''; } return $links; } add_filter( 'plugin_action_links', 'afpw_plugin_action_links', 10, 2 ); function afpw_plugin_action_links( $links, $file ) { $base = plugin_basename(__FILE__); if ($file == $base) array_unshift($links, ''.__('Settings', $acc_language_file).''); return $links; } define( 'AFPW_PATH', plugin_dir_path(__FILE__) ); if (!class_exists('A5_Thumbnail')) require_once AFPW_PATH.'class-lib/A5_ImageClasses.php'; if (!class_exists('A5_Excerpt')) require_once AFPW_PATH.'class-lib/A5_ExcerptClass.php'; if (!class_exists('Advanced_Featured_Post_Widget')) require_once AFPW_PATH.'class-lib/AFPW_WidgetClass.php'; // import laguage files $afpw_language_file = 'advanced-fpw'; load_plugin_textdomain($afpw_language_file, false , basename(dirname(__FILE__)).'/languages'); // init add_action('admin_init', 'afpw_init'); function afpw_init() { global $afpw_language_file; register_setting( 'afpw_options', 'afpw_options', 'afpw_validate' ); add_settings_section('afpw_settings', __('Styling of the links', $afpw_language_file), 'afpw_display_section', 'afpw_styles'); add_settings_field('afpw_link_style', __('Link style:', $afpw_language_file), 'afpw_link_field', 'afpw_styles', 'afpw_settings'); add_settings_field('afpw_hover_style', __('Hover style:', $afpw_language_file), 'afpw_hover_field', 'afpw_styles', 'afpw_settings'); } function afpw_display_section() { global $afpw_language_file; echo '

'.__('Just put some css code here.', $afpw_language_file).'

'; } function afpw_link_field() { global $afpw_language_file; $afpw_options = get_option('afpw_options'); echo ''; } function afpw_hover_field() { global $afpw_language_file; $afpw_options = get_option('afpw_options'); echo ''; } // Cleaning on deactivation register_deactivation_hook( __FILE__, 'unset_afpw' ); function unset_afpw() { delete_option('afpw_options'); } // Installing options page add_action('admin_menu', 'afpw_admin_menu'); function afpw_admin_menu() { global $afpw_language_file; $pages=add_options_page(__('Advanced FP Settings', $afpw_language_file), 'Advanced Featured Post Widget', 'administrator', 'advanced-fpw-settings', 'advanced_fpw_options_page'); add_action('admin_print_scripts-'.$pages, 'afpw_js_sheet'); } // Calling the options page function advanced_fpw_options_page() { global $afpw_language_file; ?>

font-weight: bold;
color: #0000ff;
text-decoration: underline;

add_query_var('afpwfile'); } add_action('template_redirect','afpw_css_template'); function afpw_css_template() { if (get_query_var('afpwfile') == 'css') { header('Content-type: text/css'); echo afpw_write_css(); exit; } } add_action ('wp_print_styles', 'afpw_css'); function afpw_css () { $afpw_options = get_option('afpw_options'); if (count ($afpw_options)!=0 && !empty ($afpw_options)) { $afpw_css_file=get_bloginfo('url')."/?afpwfile=css"; wp_register_style($afpw_language_file, $afpw_css_file, false, '2.1', 'all'); wp_enqueue_style($afpw_language_file); } } // writing css file function afpw_write_css() { $afpw_styles=get_option('afpw_options'); $css_text="@charset \"UTF-8\";\r\n/* CSS Document */\r\n\r\n"; if (!empty($afpw_styles['link'])) { $afpw_link=str_replace(array("\r\n", "\n", "\r"), ' ', $afpw_styles['link']); $css_text.='.afpwlink {'.$afpw_link.'}\r\n'; } if (!empty($afpw_styles['hover'])) { $afpw_hover=str_replace(array("\r\n", "\n", "\r"), ' ', $afpw_styles['hover']); $css_text.='.afpwlink:hover {'.$afpw_hover.'}'; } return $css_text; } ?>