/** * Configuration tab for general seo settings * * @package SeoPress * @author Sven Wagener * @copyright Copyright (C) Themekraft **/ function sp_admin_settings_tab() { global $seopress_plugin_url; $html .= sp_admin_tab_header(__('Global Seo options', 'seopress'), __('Setup the global settings of the Seo part of the plugin.', 'seopress'), $seopress_plugin_url . 'includes/images/logo-wordpress.png'); $html .= '<table class="widefat">'; $html .= '<tbody>'; $html .= '<tr>'; $html .= '<td colspan="2"><div class="components_extend" colspan="2"><strong>' . __('Title', 'seopress') . '</strong></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><div class="components_extend">' . __('Show pagination', 'seopress') . '</div></td>'; $html .= '<td><div class="components_extend">' . tk_wp_form_checkbox('show_pagination', 'seopress_options', 'show_pagination') . '</div></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><div class="components_extend">' . __('Standard length of title', 'seopress') . '</div></td>'; // $html.= '<td><div class="components_extend"><input type="text" name="bp_seo_metadesc_length" length="4" size="3" value="' . get_option('bp_seo_metadesc_length') . '" /> (' . __('number of chars', 'seopress' ) . ')</div></td>'; $html .= '<td><div class="components_extend">' . tk_wp_form_textfield('std_title_legth', 'seopress_options', 'std_title_legth') . ' (' . __('number of chars', 'seopress') . ')</div></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><div class="components_extend">' . __('Standard length of meta description', 'seopress') . '</div></td>'; // $html.= '<td><div class="components_extend"><input type="text" name="bp_seo_metadesc_length" length="4" size="3" value="' . get_option('bp_seo_metadesc_length') . '" /> (' . __('number of chars', 'seopress' ) . ')</div></td>'; $html .= '<td><div class="components_extend">' . tk_wp_form_textfield('std_metadesc_legth', 'seopress_options', 'std_metadesc_legth') . ' (' . __('number of chars', 'seopress') . ')</div></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td colspan="2"><div class="components_extend" colspan="2"><strong>' . __('Meta boxes in posts and pages', 'seopress') . '</strong></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><div class="components_extend">' . __('Hide meta boxes in posts:', 'seopress') . '</div></td>'; // $html.= '<td><div class="components_extend"><input type="checkbox" name="bp_seo_meta_box_post" ' . $meta_box_post_checked . ' value="1" /></div></td>'; $html .= '<td><div class="components_extend">' . tk_wp_form_checkbox('metabox_post', 'seopress_options', 'metabox_post') . '</div></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td><div class="components_extend">' . __('Hide meta boxes in pages:', 'seopress') . '</div></td>'; // $html.= '<td><div class="components_extend"><input type="checkbox" name="bp_seo_meta_box_page" ' . $meta_box_page_checked . ' value="1" /></div></td>'; $html .= '<td><div class="components_extend">' . tk_wp_form_checkbox('metabox_page', 'seopress_options', 'metabox_page') . '</div></td>'; $html .= '</tr>'; do_action('seopress_seo_options'); $html .= '</tbody>'; $html .= '</table>'; $button = '<p class="submit"><input class="button-primary" type="submit" name="save" value="' . __('Save', 'seopress') . '" /></p>'; $html .= $button; return $html; }
function sp_fb_post_meta_box($tabs) { global $post; $html = '<p class="sp_metabox_description">' . __('Leave fields blank if you want to use standard values.', 'seopress') . '</p>'; $select_fb_image = new TK_WP_FORM_SELECT('fb_image', 'sp_post_metabox', 'seopress_fb_image'); $select_fb_image->add_option(__('featured image', 'seopress'), 'featured_image'); $select_fb_image->add_option(__('post text', 'seopress'), 'post_text'); $select_fb_type = new TK_WP_FORM_SELECT('fb_type', 'sp_post_metabox', 'seopress_fb_type'); // $select_fb_type->add_option( __('Test1', 'seopress' ), 'test' ); // $select_fb_type->add_option( __('Test2', 'seopress' ), 'test2' ); // Preview data $post_meta = get_post_meta($post->ID, 'sp_post_metabox', true); $preview_image = $post_meta['fb_image']; if ($preview_image == 'featured_image') { if (!function_exists('get_post_thumbnail_id')) { include '../wp-includes/post-thumbnail-template.php'; } $ptn_id = get_post_thumbnail_id($post->ID); $preview_image = wp_get_attachment_url($ptn_id); } else { if ($preview_image == 'post_text') { $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $preview_image = $matches[1][0]; } } if ($preview_image != '') { $text_width = '300'; } else { $text_width = '400'; } if ($post_meta['fb_title'] != '') { $preview_title = $post_meta['fb_title']; } else { $preview_title = $post->post_title; } if ($post_meta['fb_description'] != '') { $preview_desc = $post_meta['fb_description']; } else { $preview_desc = substr(strip_tags($post->post_content), 0, 300) . ' ... '; } $preview_url = get_permalink($post->ID); $preview_url = str_replace('http://', '', $preview_url); $html .= '<table class="form-table"> <tbody> <tr> <td width="200" valign="top"><label for="seopress_fb_title">' . __('Title', 'seopress') . ':</label></td> <td>' . tk_wp_form_textfield('fb_title', 'sp_post_metabox', 'seopress_fb_title', ' style="width:99%"') . $title_field . '</td> </tr> <tr> <td valign="top"><label for="seopress_fb_description">' . __('Description', 'seopress') . ':</label></td> <td>' . tk_wp_form_textfield('fb_description', 'sp_post_metabox', 'seopress_fb_description', ' style="width:99%"') . $description_field . '</td> </tr> <tr> <td valign="top"><label for="seopress_fb_image">' . __('Take image from', 'seopress') . ':</label></td> <td>' . $select_fb_image->get_html() . '</td> </tr> <tr> <td valign="top">' . __('Preview:', 'seopress') . '</td> <td> <div style="border: 1px #000 solid; bgcolor: #FFF; width:96%; height; 100%; padding:1em;"> <div style="width: 400px;"> <img style="max-width:90px; float:left; margin-right: 10px; " src="' . $preview_image . '" /> <div style="float:right; width: ' . $text_width . 'px;"> <strong><div style="color: #3B5998; text-decoration: none; font-size: 11px; font-family: lucida grande,tahoma,verdana,arial,sans-serif; margin-top: -5px;">' . $preview_title . '</div></strong> <div style="color: #808080; text-decoration: none; font-size: 11px; font-family: lucida grande,tahoma,verdana,arial,sans-serif; line-height: 12px;">' . $preview_desc . '</div> <div style="clear:both;"></div> </div> <div style="clear:both;"></div> </div> </div> </td> </tr> <!-- <tr> <td valign="top"><label for="seopress_fb_type">' . __('Type', 'seopress') . ':</label></td> <td>' . $select_fb_type->get_html() . '</td> </tr>//--> ' . $post_metabox_table . ' </tbody> </table>'; $tabs->add_tab('cap_post_facebook', __('Facebook', 'seopress'), $html); }
function sp_page_metabox() { $mb = new TK_WP_METABOX('sp_post_metabox', __('SeoPress Settings', 'seopress'), 'page'); $title_field = apply_filters('sp_page_metabox_title', $title_field); $description_field = apply_filters('sp_page_metabox_description', $description_field); $keywords_field = apply_filters('sp_page_metabox_keywords', $keywords_field); $noindex_field = apply_filters('sp_page_metabox_noindex', $noindex_field); $post_metabox_table = apply_filters('sp_page_metabox_table', $post_metabox_table); $tabs = new TK_WP_JQUERYUI_TABS(); $html = '<p class="sp_metabox_description">' . __('Leave fields blank if you want to use standard values.', 'seopress') . '</p>'; $html .= '<table class="form-table"> <tbody> <tr> <td width="200" valign="top"><label for="seopress_title">' . __('Title', 'seopress') . ':</label></td> <td>' . tk_wp_form_textfield('title', 'sp_post_metabox', 'title', ' style="width:99%"') . $title_field . '</td> </tr> <tr> <td valign="top"><label for="seopress_description">' . __('Description', 'seopress') . ':</label></td> <td>' . tk_wp_form_textfield('description', 'sp_post_metabox', 'description', ' style="width:99%"') . $description_field . '</td> </tr> <tr> <td valign="top"><label for="seopress_keywords">' . __('Keywords', 'seopress') . ':</label></td> <td>' . tk_wp_form_textfield('keywords', 'sp_post_metabox', 'keywords', ' style="width:99%"') . $keywords_field . '</td> </tr> <tr> <td valign="top"><label for="seopress_noindex">' . __('Ban searchengines', 'seopress') . ':</label></td> <td>' . tk_wp_form_checkbox('noindex', 'sp_post_metabox', 'noindex') . $noindex_field . '</td> </tr> ' . $page_metabox_table . ' </tbody> </table>'; $html = apply_filters('sp_page_metabox_html', $html); $tabs->add_tab('cap_post_seo', __('SEO', 'seopress'), $html); do_action('sp_page_metabox_tabs', $tabs); $html = $tabs->get_html(); $mb->add_element($html); $mb->create(); }