Exemple #1
0
/**
 * Render the user profile settings
 * 
 * @param array $user
 * @return string html
 */
function mashsb_render_user_profiles($user)
{
    $html = '<h3>' . __('MashShare Social Media Integration', 'mashsb') . '</h3>' . '<table class="form-table">' . '<tr>' . '<th><label for="twitter">' . __('Twitter Username', 'mashsb') . '</label></th>' . '<td>' . '<input type="text" name="mashsb_twitter_handle" id="mashsb_twitter_handle" value="' . esc_attr(get_the_author_meta('mashsb_twitter_handle', $user->ID)) . '" class="regular-text" />' . '<br /><span class="description">' . __('Your Twitter username (without the @ symbol)', 'mashsb') . '</span>' . '</tr>' . '<th><label for="mashsb_fb_author_url">' . __('Facebook Author URL', 'mashsb') . '</label></th>' . '<td>' . '<input type="text" name="mashsb_fb_author_url" id="mashsb_fb_author_url" value="' . esc_attr(get_the_author_meta('mashsb_fb_author_url', $user->ID)) . '" class="regular-text" />' . '<br /><span class="description">' . __('URL to your Facebok profile.', 'mashsb') . '</span>' . '</td>' . '</tr>' . '</table>';
    if (mashsb_show_meta_box()) {
        echo $html;
    }
}
function mashsb_meta_boxes($meta_boxes)
{
    global $mashsb_options, $post;
    $prefix = 'mashsb_';
    $post_types = isset($mashsb_options['post_types']) ? $mashsb_options['post_types'] : array();
    foreach ($post_types as $key => $value) {
        $post_type[] = $key;
    }
    $post_type[] = 'post';
    $post_type[] = 'page';
    //echo "<pre>";
    //    echo(var_dump($post_type));
    //        echo "</pre>";
    $twitter_handle = isset($mashsb_options['mashsharer_hashtag']) ? $mashsb_options['mashsharer_hashtag'] : '';
    // Do not show meta boxes
    if (!mashsb_show_meta_box()) {
        return apply_filters('mashsb_meta_box_settings', $meta_boxes, 10, 0);
    }
    // Setup our meta box using an array
    $meta_boxes[0] = array('id' => 'mashsb_meta', 'title' => 'MashShare Social Sharing Options', 'pages' => $post_type, 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => '<span class="mashicon mashicon-share"></span> ' . __('Social Media Image', 'mashsb'), 'desc' => __('Optimal size for post shared images on Facebook, Google+ and LinkedIn is 1200px x 630px. Aspect ratio 1.9:1', 'mashsb'), 'id' => $prefix . 'og_image', 'type' => 'image_advanced', 'clone' => false, 'max_file_uploads' => 1, 'class' => 'mashsb-og-image'), array('name' => '<span class="mashicon mashicon-share"> </span> ' . __('Social Media Title', 'mashsb'), 'desc' => __('This title is used by the open graph meta tag og:title and will be used when users share your content on Facebook, LinkedIn, or Google+. Leave this blank to use ', 'mashsb') . (mashsb_yoast_active() ? __('Yoast Facebook / SEO title', 'mashsb') : 'the post title'), 'id' => $prefix . 'og_title', 'type' => 'textarea', 'clone' => false, 'class' => 'mashsb-og-title'), array('name' => '<span class="mashicon mashicon-share"></span> ' . __('Social Media Description', 'mashsb'), 'desc' => __('This description is used by the open graph meta tag og:description and will be used when users share your content on Facebook, LinkedIn, and Google Plus. Leave this blank to use ', 'mashsb') . (mashsb_yoast_active() ? __('Yoast Facebook open graph description or the post excerpt.', 'mashsb') : ' the post excerpt.'), 'id' => $prefix . 'og_description', 'type' => 'textarea', 'clone' => false, 'class' => 'mashsb-og-desc'), array('name' => 'divider', 'id' => 'divider', 'type' => 'divider'), array('name' => '<span class="mashicon mashicon-pinterest"></span> ' . __('Pinterest Image', 'mashsb') . '<a class="mashsb-helper" href="#"></a><div class="mashsb-message" style="display: none;">' . sprintf(__('Get the <a href="%s" target="_blank">Network Add-On</a> to make use of the Pinterest Features', 'mashsb'), 'https://www.mashshare.net/pricing/?utm_source=meta_box&utm_medium=core_plugin&utm_campaign=pinterest_helper') . '</div>', 'desc' => __('Pinned images need to be more vertical than horizontal in orientation. Use an aspect ratio of 2:3 to 1:3.5 and a minimum width of 600 pixels. So an image that is 600 pixels wide should be between 900 and 2100 pixels tall.', 'mashsb'), 'id' => $prefix . 'pinterest_image', 'type' => 'image_advanced', 'clone' => false, 'max_file_uploads' => 1, 'class' => 'mashsb-pinterest-image'), array('name' => '<span class="mashicon mashicon-pinterest"></span> ' . __('Pinterest Description', 'mashsb') . '<a class="mashsb-helper" href="#"></a><div class="mashsb-message" style="display: none;">' . sprintf(__('Get the <a href="%s" target="_blank">Network Add-On</a> to make use of the Pinterest Features', 'mashsb'), 'https://www.mashshare.net/pricing/?utm_source=meta_box&utm_medium=core_plugin&utm_campaign=pinterest_helper') . '</div>', 'desc' => __('Place a customized message that will be used when this post is shared on Pinterest. Leave this blank to use the ', 'mashsb') . (mashsb_yoast_active() ? __('Yoast SEO title', 'mashsb') : __('the post title', 'mashsb')), 'id' => $prefix . 'pinterest_description', 'type' => 'textarea', 'clone' => false, 'class' => 'mashsb-pinterest-desc'), array('name' => '<span class="mashicon mashicon-twitter"></span> ' . __('Custom Tweet', 'mashsb'), 'desc' => mashsb_twitter_desc(), 'id' => $prefix . 'custom_tweet', 'type' => 'textarea', 'clone' => false, 'class' => 'mashsb-custom-tweet'), array('id' => $prefix . 'position', 'name' => __('Share Button Position', 'mashsb'), 'type' => 'select', 'placeholder' => __('Use Global Setting', 'mashsb'), 'before' => '<div style="max-width:250px;float:left;">', 'after' => '</div>', 'options' => array('disable' => __('Disable Automatic Buttons', 'mashsb'), 'before' => __('Above Content', 'mashsb'), 'after' => __('Below Content', 'mashsb'), 'both' => __('Above & Below Content', 'mashsb'))), array('helper' => '<a class="mashsb-helper" href="#" style="margin-left:-4px;"></a><div class="mashsb-message" style="display: none;">' . __('Validate open graph meta tags on your site. Incorrect data can result in wrong share description, title or images and should be fixed! In the facebook debugger click the link "Fetch new scrape information" to purge the facebook cache.', 'mashsb') . '</div>', 'id' => $prefix . 'validate_og', 'before' => '<div style="max-width:250px;float:left;margin-top:45px;">', 'after' => '</div>', 'type' => 'validate_og'), array('name' => 'divider', 'id' => 'divider', 'type' => 'divider'), array('id' => $prefix . 'twitter_handle', 'type' => 'hidden_data', 'std' => $twitter_handle)));
    return apply_filters('mashsb_meta_box_settings', $meta_boxes, 10, 0);
}