Plugin Directory

Changeset 710833


Ignore:
Timestamp:
05/10/2013 10:36:32 AM (13 years ago)
Author:
yathosho
Message:

New release: OGraphr 0.8.9

Location:
meta-ographr
Files:
16 added
3 edited

Legend:

Unmodified
Added
Removed
  • meta-ographr/trunk/meta-ographr_admin.php

    r706963 r710833  
    15341534
    15351535}; // end of class
    1536 
  • meta-ographr/trunk/meta-ographr_index.php

    r706963 r710833  
    44Plugin URI: http://ographr.whyeye.org
    55Description: This plugin scans posts for embedded video and music players and adds their thumbnails URL as an OpenGraph meta-tag. While at it, the plugin also adds OpenGraph tags for the title, description (excerpt) and permalink. Facebook and other social networks can use these to style shared or "liked" articles.
    6 Version: 0.8.8
     6Version: 0.8.9
    77Author: Jan T. Sott
    88Author URI: http://whyeye.org
     
    2929
    3030// OGRAPHR OPTIONS
    31     define("OGRAPHR_VERSION", "0.8.8");
     31    define("OGRAPHR_VERSION", "0.8.9");
    3232    // enables developer settings on Wordpress interface, can be overwritten from plug-in settings once activated
    3333    define("OGRAPHR_DEVMODE", FALSE);
     
    373373       
    374374            if (($web_thumb) && (!$options['not_always']))
    375                 $thumbnails[] = $web_thumb;     
     375                $thumbnails[]['img'] = $web_thumb;     
    376376           
    377377            // Get date et al
     
    520520                    }
    521521                }
    522                
    523522            }
    524523           
     
    538537                            if (isset($thumbnail['img'])) {
    539538                                if (filter_var($thumbnail['img'], FILTER_VALIDATE_URL)) {
    540                                     print "\t Post meta: " . $thumbnail['img'];
     539                                    if ($thumbnail['img'] != $web_thumb)
     540                                        print "\t Post meta: " . $thumbnail['img'];
    541541                                if( (isset($thumbnail['w'])) && (isset($thumbnail['h'])) )
    542542                                    print " (" . $thumbnail['w'] . "×" . $thumbnail['h'] . ")";
     
    547547                            }
    548548                        }
    549                         print "\n";
     549                        //print "\n";
    550550                    }
    551551                } else if ( (isset($meta_values)) && (is_array($meta_values)) && (!isset($thumbnails)) && ($expiry >= $interval) ) {
     
    569569                } else {
    570570                    if( ( ($options['debug_level'] > 0) && (current_user_can('edit_plugins')) ) && ($options['exec_mode'] == 1) && ($expiry >= $interval) ){
    571                         print "\t Empty post-meta, retrieving images\n\n";
     571                        print "\n\t Empty post-meta, retrieving images\n\n";
    572572                    } else if( ( ($options['debug_level'] > 0) && (current_user_can('edit_plugins')) ) && ($options['exec_mode'] == 1) && ($expiry < $interval) ) {
    573                         print "\t Data expired, indexing\n\n";
     573                        print "\n\t Data expired, indexing\n\n";
    574574                    }
    575575                   
     
    839839                // Add permalink
    840840                if (($options['add_permalink']) && (is_front_page()) && ($link = get_option('home'))) {
    841                     print "<meta property=\"og:url\" content=\"$link\" />\n";
     841                    $opengraph_meta['og:url'] = $link;
    842842                    if (isset($options['add_twitter_meta']))
    843843                        $twitter_meta['twitter:url'] = $link;
     
    911911                }
    912912                   
    913                 if ( (isset($total_img)) && ($total_img == 0) && ($web_thumb)) {
     913                if ( ((!isset($total_img)) || ($total_img == 0)) && (!empty($web_thumb))) {
    914914                    //print "<meta property=\"og:image\" content=\"$web_thumb\" />\n";
    915915                    $opengraph_meta['og:image'][] = $web_thumb;
     
    10351035                // Add Link elements
    10361036                if (isset($options['add_link_rel'])) {
    1037                     if (($total_img == 0) && ($web_thumb)) {
     1037                    if (($total_img == 0) && (isset($web_thumb))) {
    10381038                        $ext = pathinfo($web_thumb, PATHINFO_EXTENSION);
    10391039                        if (($ext == "jpg") || ($ext == "jpe"))
     
    11021102                    if(is_array($twitter_meta['og:image']))
    11031103                        $twitter_meta['og:image'] = array_unique($twitter_meta['og:image']); // unlikely, but hey!
    1104                     foreach($twitter_meta as $key => $value) {
    1105                         if ($key == "twitter:image") {
    1106                             foreach($twitter_meta['twitter:image'] as $val_image)
    1107                                 print "<meta property=\"$key\" content=\"$val_image\" />\n";
    1108                         } else {
    1109                                 print "<meta property=\"$key\" content=\"$value\" />\n";
     1104                    if(is_array($twitter_meta['twitter:image'])) {
     1105                        foreach($twitter_meta as $key => $value) {
     1106                            if ($key == "twitter:image") {
     1107                                foreach($twitter_meta['twitter:image'] as $val_image)
     1108                                    print "<meta property=\"$key\" content=\"$val_image\" />\n";
     1109                            } else {
     1110                                    print "<meta property=\"$key\" content=\"$value\" />\n";
     1111                            }
    11101112                        }
    11111113                    }
     
    11481150                preg_match('/\/wp-includes\/images\/smilies\/icon_.+/i', $match, $filter);
    11491151                if ((!isset($options['filter_smilies'])) || (!$filter[0])) {
    1150                     //$thumbnails[] = $match;
    11511152                    $no_smilies = TRUE;
    11521153                }
     
    11551156                preg_match('/\/wp-content\/themes\//i', $match, $filter);
    11561157                if ((!isset($options['filter_themes'])) || (!$filter[0])) {
    1157                     //$thumbnails[] = $match;
    11581158                    $no_themes = TRUE;
    11591159                }
     
    11631163                preg_match($pattern, $match, $filter);
    11641164                if ((!isset($options['filter_gravatar'])) || (!$filter[0])) {
    1165                     //$thumbnails[] = $match;
    11661165                    $no_gravatar = TRUE;
    11671166                }
     
    11691168                // filter custom URLs
    11701169                foreach(preg_split("/((\r?\n)|(\n?\r))/", preg_quote($options['filter_custom_urls'], '/')) as $line) {
    1171                     //print "<!-- \$line=$line -->\n";
    11721170                    preg_match("/$line/", $match, $filter);
    11731171                    foreach($filter as $key => $value) {
     
    12361234
    12371235        // Get attachment images
    1238         if  (isset($options['add_attached_image'])) {
     1236        if (isset($options['add_attached_image'])) {
    12391237            $attached_thumbnails = $this->get_attached_img();
    12401238
     
    17581756            if (!$options['soundcloud_api']) { $options['soundcloud_api'] = SOUNDCLOUD_API_KEY; $soundcloud_api = $options['soundcloud_api']; }
    17591757            if (!$options['ustream_api']) { $options['ustream_api'] = USTREAM_API_KEY; $ustream_api = $options['ustream_api']; }
     1758           
     1759            //upgrades
     1760            if(isset($options['last_update'])) {
     1761                if (version_compare($options['last_update'], "0.8", '<')) {
     1762                    if (isset($options['enable_eight_tracks'])) {
     1763                        $options['enable_etracks'] = $options['enable_eight_tracks'];
     1764                        unset($options['enable_eight_tracks']);
     1765                    }
     1766                }
    17601767               
    1761             if (version_compare($options['last_update'], "0.8", '<')) {
    1762                 if (isset($options['enable_eight_tracks'])) {
    1763                     $options['enable_etracks'] = $options['enable_eight_tracks'];
    1764                     unset($options['enable_eight_tracks']);
    1765                 }
    1766             }
    1767            
    1768             if (version_compare($options['last_update'], "0.8.6", '<')) {
    1769                 $published = wp_count_posts();
    1770                 $published = $published->publish;
    1771                 $args = array( 'numberposts' => $published, 'meta_key' => 'ographr_twitter_image' );
    1772                 $ographr_urls = get_posts( $args );
    1773                 foreach($ographr_urls as $ographr_url) {
    1774                     $ographr_id = $ographr_url->ID;
    1775                     $tmp = get_post_meta($ographr_id, 'ographr_twitter_image', true);
    1776                     update_post_meta($ographr_id, 'ographr_primary_image', $tmp);
    1777                     delete_post_meta($ographr_id, 'ographr_twitter_image');
    1778                 }
    1779             }
     1768                if (version_compare($options['last_update'], "0.8.6", '<')) {
     1769                    $published = wp_count_posts();
     1770                    $published = $published->publish;
     1771                    $args = array( 'numberposts' => $published, 'meta_key' => 'ographr_twitter_image' );
     1772                    $ographr_urls = get_posts( $args );
     1773                    foreach($ographr_urls as $ographr_url) {
     1774                        $ographr_id = $ographr_url->ID;
     1775                        $tmp = get_post_meta($ographr_id, 'ographr_twitter_image', true);
     1776                        update_post_meta($ographr_id, 'ographr_primary_image', $tmp);
     1777                        delete_post_meta($ographr_id, 'ographr_twitter_image');
     1778                    }
     1779                }
     1780
     1781                if (version_compare($options['last_update'], "0.8.9", '<')) {
     1782                    //delete old, incompatible index data
     1783                    $published = wp_count_posts();
     1784                    $published = $published->publish;
     1785                    $args = array( 'numberposts' => $published, 'meta_key' => 'ographr_urls' );
     1786                    $ographr_urls = get_posts( $args );
     1787                    foreach($ographr_urls as $ographr_url) {
     1788                        $ographr_id = $ographr_url->ID;
     1789                        delete_post_meta($ographr_id, 'ographr_urls');
     1790                        delete_post_meta($ographr_id, 'ographr_indexed');
     1791                    }
     1792                }
     1793            }
     1794
     1795           
    17801796
    17811797            //save current version to db
     
    18421858    public function ographr_save_postmeta($post_id) {
    18431859        global $core;
    1844         //global $options;
     1860
    18451861        $options = get_option('ographr_options');
    18461862
     
    19631979
    19641980}; // end of class
    1965 
    1966 ?>=meta-ographr/meta-ographr_admin.php')
    1967                     ),
    1968                     array(
    1969                         'id' => 'ographr-home',
    1970                         'parent' => 'ographr',
    1971                         'title' => 'Website',
    1972                         'href' => 'http://wordpress.org/extend/plugins/meta-ographr/'
    1973                     )
    1974                 );
    1975 
    1976             foreach ($menu_items as $menu_item) {
    1977                 $wp_admin_bar->add_menu($menu_item);
    1978             }
    1979         }   
    1980     }
    1981 
    1982 }; // end of class
    1983 
    19841981?>
  • meta-ographr/trunk/readme.txt

    r706963 r710833  
    55Requires at least: 3.0
    66Tested up to: 3.5.1
    7 Stable tag: 0.8.8
     7Stable tag: 0.8.9
    88License: GPLv2
    99
     
    104104== Changelog ==
    105105
     106= 0.8.9 =
     107* fixed bug with default thumbnails
     108* fixed bug in update routine
     109* fixed minor bug when adding og:url tag
     110* removed some old commented code
     111* improved some conditionals
     112
    106113= 0.8.8 =
    107114* removed some old update functions
Note: See TracChangeset for help on using the changeset viewer.