hook) return plugin_dir_url( __FILE__ ).$this->ozhicon; return $hook; } function config_page_styles() { if (isset($_GET['page']) && $_GET['page'] == $this->hook) { wp_enqueue_style('dashboard'); wp_enqueue_style('thickbox'); wp_enqueue_style('global'); wp_enqueue_style('wp-admin'); wp_enqueue_style('gawp-css', plugin_dir_url( __FILE__ ). 'yst_plugin_tools.css'); } } function register_settings_page() { add_options_page($this->longname, $this->shortname, $this->accesslvl, $this->hook, array(&$this,'config_page')); } function plugin_options_url() { return admin_url( 'options-general.php?page='.$this->hook ); } /** * Add a link to the settings page to the plugins list */ function add_action_link( $links, $file ) { static $this_plugin; if( empty($this_plugin) ) $this_plugin = $this->filename; if ( $file == $this_plugin ) { $settings_link = '' . __('Settings', 'gawp_yoast') . ''; array_unshift( $links, $settings_link ); } return $links; } function config_page() { } function config_page_scripts() { if (isset($_GET['page']) && $_GET['page'] == $this->hook) { wp_enqueue_script('postbox'); wp_enqueue_script('dashboard'); wp_enqueue_script('thickbox'); wp_enqueue_script('media-upload'); } } /** * Create a Checkbox input field */ function checkbox($id) { $options = get_option( $this->optionname ); $checked = false; if ( isset($options[$id]) && $options[$id] == 1 ) $checked = true; return ''; } /** * Create a Text input field */ function textinput($id) { $options = get_option( $this->optionname ); $val = ''; if ( isset( $options[$id] ) ) $val = $options[$id]; return ''; } /** * Create a dropdown field */ function select($id, $options, $multiple = false) { $opt = get_option($this->optionname); $output = ''; return $output; } /** * Create a potbox widget */ function postbox($id, $title, $content) { ?>

'; $i = 1; foreach ($rows as $row) { $class = ''; if ($i > 1) { $class .= 'yst_row'; } if ($i % 2 == 0) { $class .= ' even'; } $content .= ''; if (isset($row['id']) && $row['id'] != '') $content .= ''; else $content .= $row['label']; $content .= ''; $content .= $row['content']; $content .= ''; if ( isset($row['desc']) && !empty($row['desc']) ) { $content .= ''.$row['desc'].''; } $i++; } $content .= ''; return $content; } /** * Create a "plugin like" box. */ function plugin_like($hook = '') { if (empty($hook)) { $hook = $this->hook; } $content = '

'.__('Why not do any or all of the following:', 'gawp_yoast' ).'

'; $content .= ''; $this->postbox($hook.'like', __( 'Like this plugin?', 'gawp_yoast' ), $content); } /** * Info box with link to the bug tracker. */ function plugin_support($hook = '') { if (empty($hook)) { $hook = $this->hook; } $content = '

'.sprintf( __( 'If you\'ve found a bug in this plugin, please submit it in the Yoast Bug Tracker with a clear description.', 'gawp_yoast' ), 'http://yoast.com/bugs/google-analytics/').'

'; $this->postbox($this->hook.'support', __('Found a bug?', 'gawp_yoast' ), $content); } /** * Box with latest news from Yoast.com */ function news() { include_once(ABSPATH . WPINC . '/feed.php'); $rss = fetch_feed('http://feeds.feedburner.com/joostdevalk'); $rss_items = $rss->get_items( 0, $rss->get_item_quantity(5) ); $content = ''; $this->postbox('yoastlatest', __( 'Latest news from Yoast', 'gawp_yoast' ), $content); } function text_limit( $text, $limit, $finish = ' […]') { if( strlen( $text ) > $limit ) { $text = substr( $text, 0, $limit ); $text = substr( $text, 0, - ( strlen( strrchr( $text,' ') ) ) ); $text .= $finish; } return $text; } } }