Plugin Directory

Changeset 2021606


Ignore:
Timestamp:
01/30/2019 04:14:05 AM (7 years ago)
Author:
alexmacarthur
Message:

Update to version 3.4.4.

Location:
complete-open-graph
Files:
38 added
10 edited

Legend:

Unmodified
Added
Removed
  • complete-open-graph/trunk/complete-open-graph.php

    r2020886 r2021606  
    33 * Plugin Name: Complete Open Graph
    44 * Description: Simple, comprehensive, highly customizable Open Graph management.
    5  * Version: 3.4.3
     5 * Version: 3.4.4
    66 * Author: Alex MacArthur
    77 * Author URI: https://macarthur.me
     
    2424define('COMPLETE_OPEN_GRAPH_ADMIN_SETTINGS_PAGE_SLUG', 'complete_open_graph');
    2525define('COMPLETE_OPEN_GRAPH_REAL_PATH', trailingslashit(realpath(dirname(__FILE__))));
     26define('COMPLETE_OPEN_GRAPH_IMAGE_WIDTH', 1200);
     27define('COMPLETE_OPEN_GRAPH_IMAGE_HEIGHT', 1200);
    2628
    2729require_once COMPLETE_OPEN_GRAPH_REAL_PATH . 'src/Generator.php';
  • complete-open-graph/trunk/readme.txt

    r2020886 r2021606  
    77Requires PHP: 5.6
    88Tested up to: 5.0.3
    9 Stable tag: 3.4.3
     9Stable tag: 3.4.4
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    150150`
    151151
    152 == Advanced Filtering ==
    153 If, for whatever reason, you need to access any of the hooks registered by this plugin, you may do so by referencing the `CompleteOpenGraph\App` key in the `$GLOBALS` array. Each controller is saved to this central instance, so you can remove actions (or whatever) by using it. For example, the following snippet will completely remove the `Open Graph` settings page from the sidebar menu.
    154 
    155 `
    156 remove_action('admin_menu', array($GLOBALS['CompleteOpenGraph\App']->controllers['Settings'], 'open_graph_settings_page'));
    157 `
    158 
    159152== Order of Priority ==
    160153
     
    307300* On author archive pages, if author has an avatar image, use that as OG image.
    308301
     302= 3.4.4 =
     303* Fix sizing issue with uploaded images less than 1200px wide.
     304* Require that selected OG images be, at minimum, 200px x 200px.
     305* Ensure that OG URLs are never relative.
     306
    309307== Feedback ==
    310308
  • complete-open-graph/trunk/src/Field.php

    r2017039 r2021606  
    88class Field
    99{
    10 
    1110    public function __construct($key)
    1211    {
     
    1817    public function __get($property)
    1918    {
    20 
    2119        if ($property === 'name') {
    2220            return 'complete_open_graph_' . $this->key;
     
    4846    public static function getConfigurable($fields = null)
    4947    {
    50 
    5148        $fields = is_null($fields) ? Utilities::getFields() : $fields;
    5249
  • complete-open-graph/trunk/src/Utilities.php

    r2017039 r2021606  
    77class Utilities
    88{
    9 
    109    public static function getFields()
    1110    {
     
    189188                self::get_option('force_all') === 'on' ||
    190189                self::get_option($field_name . '_force') === 'on' ||
    191                 ( is_home() || is_archive() )
     190                (is_home() || is_archive())
    192191            );
    193192
  • complete-open-graph/trunk/src/assets/js/scripts.js

    r2017039 r2021606  
    2222
    2323    customUploader.on('select', function (e) {
    24         attachment = customUploader.state().get('selection').first().toJSON();
    25         thumbURL = attachment.sizes['medium'] == undefined ? attachment.url : attachment.sizes['medium'].url;
     24        attachment = customUploader.state().get('selection').first().toJSON();
     25        thumbURL = attachment.sizes['medium'] == undefined ? attachment.url : attachment.sizes['medium'].url;
     26
     27        //-- Require that images be minimum dimensions.
     28        if(attachment.width < 200 || attachment.height < 200) {
     29            alert("Sorry! Your Open Graph image must be at least 200px wide and 200px high.")
     30            return;
     31        }
    2632
    2733        if ($COGMetaBox) {
  • complete-open-graph/trunk/src/hooks/content-filters.php

    r2020886 r2021606  
    1212add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_twitter:site', 'CompleteOpenGraph\append_at_symbol', 10, 2);
    1313add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_twitter:creator', 'CompleteOpenGraph\append_at_symbol', 10, 2);
    14 add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_og:image', 'CompleteOpenGraph\attach_image_dimensions', 10, 2);
    15 add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_twitter:image', 'CompleteOpenGraph\attach_image_dimensions', 10, 2);
     14add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_og:image', 'CompleteOpenGraph\get_image_url_from_attachment_id', 10, 2);
     15add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_twitter:image', 'CompleteOpenGraph\get_image_url_from_attachment_id', 10, 2);
    1616add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_og:image', 'CompleteOpenGraph\maybe_use_author_avatar', 10, 2);
    1717add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_twitter:image', 'CompleteOpenGraph\maybe_use_author_avatar', 10, 2);
     18add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_og:image', 'CompleteOpenGraph\ensure_full_url', 10, 2);
     19add_filter(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_twitter:image', 'CompleteOpenGraph\ensure_full_url', 10, 2);
     20
     21/**
     22 * If, for some weird reason, we have an image URL that starts with a slash,
     23 * append the site URL so a full URL is actually generated.
     24 *
     25 * @param string $value
     26 * @param string $field_name
     27 * @return void
     28 */
     29function ensure_full_url($value, $field_name = '')
     30{
     31    if (substr($value, 0, 1) === '/') {
     32        return untrailingslashit(get_site_url()) . $value;
     33    }
     34
     35    return $value;
     36}
    1837
    1938/**
     
    2544 * @return void
    2645 */
    27 function maybe_use_author_avatar($value, $field_name)
     46function maybe_use_author_avatar($value, $field_name = '')
    2847{
    2948    if (!is_author()) {
     
    4766 * @return string
    4867 */
    49 function attach_image_dimensions($value, $field_name)
     68function get_image_url_from_attachment_id($value, $field_name = '')
    5069{
    51 
    52     // -- This is probably a URL from an older version of the plugin. Just return it.
    53     if (! is_numeric($value)) {
     70    // -- This is a URL. Just leave it be.
     71    // -- @todo: Require that it is an absolute URL.
     72    if (!is_numeric($value)) {
    5473        return $value;
    5574    }
    5675
    57     $image_sizes = array(
    58         'complete_open_graph',
    59         'large',
    60         'medium_large',
    61         'medium',
    62         'full',
    63     );
    64 
    65     $data            = false;
    66     $attachment_meta = wp_get_attachment_metadata($value);
    67     $sizes           = isset($attachment_meta['sizes']) ? $attachment_meta['sizes'] : array();
    68 
    69     // -- The 'full' size isn't included by default.
    70     $sizes['full'] = true;
    71 
    72     // -- Loop over each image size. Serves as a fallback mechanism if it doesn't exist at the ideal size.
    73     foreach ($image_sizes as $size) {
    74         // -- We have an image!
    75         if (array_key_exists($size, $sizes)) {
    76             $data = wp_get_attachment_image_src($value, $size);
    77             break;
    78         }
    79     }
     76    $data = wp_get_attachment_image_src($value, 'complete_open_graph');
    8077
    8178    // -- If, for some reason, no image is returned, exit. Should NEVER actually happen, but you know... #WordPress.
  • complete-open-graph/trunk/src/hooks/generate-open-graph-markup.php

    r2017039 r2021606  
    1818function generate_open_graph_markup()
    1919{
    20 
    2120    if (! apply_filters(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_maybe_enable', true)) {
    2221        return;
     
    4847    }
    4948
    50     echo '<!-- End Complete Open Graph. | ' . ( microtime(true) - $start_time ) . "s -->\n\n";
     49    echo '<!-- End Complete Open Graph. | ' . (microtime(true) - $start_time) . "s -->\n\n";
    5150}
    5251
  • complete-open-graph/trunk/src/hooks/metabox.php

    r2017092 r2021606  
    3939    wp_nonce_field(COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_nonce_verification', COMPLETE_OPEN_GRAPH_OPTIONS_PREFIX . '_nonce');
    4040
    41     $imageURL = wp_get_attachment_image_src(Utilities::get_post_option('og:image'), 'medium')[0];
    42 
    43     ?>
     41    $imageURL = wp_get_attachment_image_src(Utilities::get_post_option('og:image'), 'medium')[0]; ?>
    4442        <p class="main-description">These fields will allow you to customize the open graph data for the page or post.</p>
    4543
     
    8078                            <?php
    8179                            break;
    82                     }
    83                     ?>
     80                    } ?>
    8481                </fieldset>
    8582
     
    114111function save($post_id)
    115112{
    116 
    117113    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    118114        return;
  • complete-open-graph/trunk/src/hooks/settings.php

    r2017039 r2021606  
    5757function open_graph_settings_page_cb()
    5858{
    59 
    6059    $github_url    = 'https://github.com/alexmacarthur/wp-complete-open-graph';
    6160    $wordpress_url = 'https://wordpress.org/support/plugin/complete-open-graph/reviews/?rate=5#new-post';
    62     $twitter_url   = 'https://twitter.com/intent/tweet?text=I%20highly%20recommend%20the%20Complete%20Open%20Graph%20%23WordPress%20plugin%20from%20%40amacarthur!%20https%3A//wordpress.org/plugins/complete-open-graph/';
    63 
    64     ?>
     61    $twitter_url   = 'https://twitter.com/intent/tweet?text=I%20highly%20recommend%20the%20Complete%20Open%20Graph%20%23WordPress%20plugin%20from%20%40amacarthur!%20https%3A//wordpress.org/plugins/complete-open-graph/'; ?>
    6562    <div
    6663        id="cogSettingsPage"
     
    7976                        <?php
    8077                            settings_fields('complete_open_graph_settings');
    81                             do_settings_sections(COMPLETE_OPEN_GRAPH_ADMIN_SETTINGS_PAGE_SLUG);
    82                             submit_button();
    83                         ?>
     78    do_settings_sections(COMPLETE_OPEN_GRAPH_ADMIN_SETTINGS_PAGE_SLUG);
     79    submit_button(); ?>
    8480                    </form>
    8581                </div>
     
    401397        $imageAttachment = wp_get_attachment_image_src($imageID, 'medium');
    402398        $imageURL        = isset($imageAttachment[0]) ? $imageAttachment[0] : '';
    403     }
    404 
    405     ?>
     399    } ?>
    406400    <fieldset class="SK_Box SK_Box--standOut">
    407401        <p>If left blank, the featured image on the home page will be used.</p>
  • complete-open-graph/trunk/src/hooks/support.php

    r2017039 r2021606  
    1414{
    1515    add_theme_support('post-thumbnails');
    16     add_image_size('complete_open_graph', 1200, 1200, false);
     16    add_image_size('complete_open_graph', COMPLETE_OPEN_GRAPH_IMAGE_WIDTH, COMPLETE_OPEN_GRAPH_IMAGE_HEIGHT, false);
    1717}
    1818
Note: See TracChangeset for help on using the changeset viewer.