Example #1
0
 /**
  * @param $meta_boxes
  *
  * @return array
  */
 public function register_metaboxes($meta_boxes)
 {
     $factory = new Factory();
     $preview = $factory->createPreview(self::get_post_id());
     $meta_boxes[] = array('id' => 'jm_tc_metabox', 'title' => __('Twitter Cards', 'jm-tc'), 'post_types' => Utilities::get_post_types(), 'context' => 'normal', 'priority' => 'high', 'autosave' => true, 'fields' => array(array('name' => __('Preview', 'jm-tc'), 'id' => 'twitterCardPreview', 'type' => 'custom_html', 'std' => $preview->generate_preview()), array('name' => __('Card Type', 'jm-tc'), 'id' => 'twitterCardType', 'type' => 'select', 'options' => array('summary' => __('Summary', 'jm-tc'), 'summary_large_image' => __('Summary below Large Image', 'jm-tc'), 'player' => __('Player', 'jm-tc')), 'std' => $this->opts['twitterCardType']), array('id' => 'cardImage', 'name' => __('Set another source as twitter image (enter URL)', 'jm-tc'), 'type' => 'file_input', 'max_file_uploads' => 1), array('id' => 'twitter_featured_size', 'type' => 'title', 'name' => __('File size')), array('id' => 'cardPlayer', 'name' => __('URL of iFrame player (MUST BE HTTPS)', 'jm-tc'), 'type' => 'url'), array('name' => __('Player width', 'jm-tc'), 'id' => 'cardPlayerWidth', 'type' => 'number', 'desc' => __('When setting this, make sure player dimension and image dimensions are exactly the same! Image MUST BE greater than 68,600 pixels (a 262x262 square image, or a 350x196 16:9 image)', 'jm-tc'), 'min' => 262, 'max' => 1000), array('name' => __('Player height', 'jm-tc'), 'id' => 'cardPlayerHeight', 'type' => 'number', 'min' => 196, 'max' => 1000), array('id' => 'cardPlayerStream', 'name' => __('URL of iFrame player (MUST BE HTTPS)', 'jm-tc') . '[STREAM]', 'type' => 'url', 'desc' => __('If you do not understand what is the following field then it is probably a bad idea to fulfill it!', 'jm-tc')), array('id' => 'cardPlayerCodec', 'name' => __('Codec', 'jm-tc'), 'type' => 'text', 'desc' => __('If you do not understand what is the following field then it is probably a bad idea to fulfill it!', 'jm-tc'))));
     return $meta_boxes;
 }
    /**
     * Displays author infos
     * @since  5.3.0
     * @return string
     *
     * @param $name
     * @param $desc
     * @param $gravatar_email
     * @param $url
     * @param $donation
     * @param $twitter
     * @param $googleplus
     * @param array $slugs
     */
    static function get_author_infos($name, $desc, $gravatar_email, $url, $donation, $twitter, $googleplus, $slugs = array())
    {
        $output = '<h3 class="hndle">' . __('The developer', JM_TC_TEXTDOMAIN) . '</h3>';
        $output .= '<img src="' . esc_url('http://www.gravatar.com/avatar/' . md5($gravatar_email)) . '" alt=""/>';
        $output .= esc_html($name);
        $output .= wpautop($desc);
        $output .= '<a class="social button button-secondary dashicons-before dashicons-admin-site" href="' . esc_url($url) . '" target="_blank" title="' . esc_attr__('My website', 'jm-tc') . '"><span class="visually-hidden">' . __('My website', JM_TC_TEXTDOMAIN) . '</span></a>';
        $output .= '<a class="social button button-secondary link-like dashicons-before dashicons-twitter" href="http://twitter.com/intent/user?screen_name=' . Utilities::remove_at($twitter) . '" title="' . esc_attr__('Follow me', JM_TC_TEXTDOMAIN) . '"> <span class="visually-hidden">' . __('Follow me', JM_TC_TEXTDOMAIN) . '</span></a>';
        $output .= '<a class="social button button-secondary dashicons-before dashicons-googleplus" href="' . esc_url($googleplus) . '" target="_blank" title="' . esc_attr__('Add me to your circles', JM_TC_TEXTDOMAIN) . '"> <span class="visually-hidden">' . __('Add me to your circles', JM_TC_TEXTDOMAIN) . '</span></a>';
        $output .= '<h3><span>' . __('Keep the plugin free', JM_TC_TEXTDOMAIN) . '</span></h3>';
        $output .= wpautop(__('Please help if you want to keep this plugin free.', JM_TC_TEXTDOMAIN));
        $output .= '
						<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
						<input type="hidden" name="cmd" value="_s-xclick">
						<input type="hidden" name="hosted_button_id" value="' . esc_attr($donation) . '">
						<input type="image" src="https://www.paypalobjects.com/en_US/FR/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
						<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
						</form>
						';
        $output .= '<h3><span>' . __('Plugin', JM_TC_TEXTDOMAIN) . '</span></h3>';
        $output .= wpautop(__('Maybe you will like this plugin too: ', JM_TC_TEXTDOMAIN) . self::get_plugins_list($slugs));
        echo $output;
    }
Example #3
0
 /**
  * @return array
  */
 public function description()
 {
     $cardDescription = $this->opts['twitterPostPageDesc'];
     if ($this->post_ID) {
         $cardDescription = Utilities::get_excerpt_by_id($this->post_ID);
         if (!empty($this->opts['twitterCardDesc'])) {
             $desc = get_post_meta($this->post_ID, $this->opts['twitterCardDesc'], true);
             $cardDescription = !empty($desc) ? htmlspecialchars(stripcslashes($desc)) : Utilities::get_excerpt_by_id($this->post_ID);
         } elseif (empty($this->opts['twitterCardDesc']) && (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack'))) {
             $cardDescription = $this->get_seo_plugin_datas('desc');
         }
     }
     $cardDescription = Utilities::remove_lb($cardDescription);
     return array('description' => apply_filters('jm_tc_get_excerpt', $cardDescription));
 }
Example #4
0
 /**
  * @param $post_id
  *
  * @return string|void
  */
 function jm_tc_get_excerpt_by_id($post_id)
 {
     return \TokenToMe\TwitterCards\Utilities::get_excerpt_by_id($post_id);
 }
<?php

namespace TokenToMe\TwitterCards\Admin;

use TokenToMe\TwitterCards\Utilities;
if (!defined('JM_TC_VERSION')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}
?>
<div class="wrap">
	<h1 class="page-title-action">JM Twitter Cards : <?php 
echo esc_html(get_admin_page_title());
?>
</h1>

	<?php 
echo Tabs::admin_tabs();
?>

	<?php 
$data = array(__('Start', JM_TC_TEXTDOMAIN) => '8l4k3zrD4Z0');
$tutorials = Utilities::display_footage($data);
echo $tutorials;
?>
</div><?php