diff --git a/assets/admin.js b/assets/admin.js index 7e58acb..3a90b87 100644 --- a/assets/admin.js +++ b/assets/admin.js @@ -33,40 +33,4 @@ jQuery( function($){ $input.filter('[value=""]').prop('checked', true); } } ); - - var $news_template = $('.news__entry.template').remove().removeClass('template'); - - $.ajax( '/wp-json/dable/v1/news' ).done( function(data) { - // TODO : show error messages - - if ( ! data || ! data.list ) return; - - var $news = $('ul.news').empty(); - - data.list.forEach( function(entry) { - var $entry = $news_template.clone(); - - // title - $entry.find('.news__title > a').text( entry.title ); - - // thumbnail - if ( entry.thumbnail_link ) { - $entry.find('.news__thumbnail').css('background-image', 'url(' + entry.thumbnail_link + ')'); - - } else { - $entry.find('.news__thumbnail').remove(); - } - - // description - var $paragraph = $entry.find('.news__content > a').text( entry.description ); - - // links - $entry.find('a').attr( 'href', function(){ return entry.link } ); - - $entry.appendTo( $news ); - - // clamp - $clamp($paragraph.parent().get(0), {clamp: 'auto'}); - } ); - } ); } ); diff --git a/assets/clamp.min.js b/assets/clamp.min.js deleted file mode 100644 index 2d8783a..0000000 --- a/assets/clamp.min.js +++ /dev/null @@ -1,12 +0,0 @@ -/*! -* Clamp.js 0.5.1 -* -* Copyright 2011-2013, Joseph Schmitt http://joe.sh -* Released under the WTFPL license -* http://sam.zoy.org/wtfpl/ -*/ -(function(){window.$clamp=function(c,d){function s(a,b){n.getComputedStyle||(n.getComputedStyle=function(a,b){this.el=a;this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;"float"==b&&(b="styleFloat");c.test(b)&&(b=b.replace(c,function(a,b,c){return c.toUpperCase()}));return a.currentStyle&&a.currentStyle[b]?a.currentStyle[b]:null};return this});return n.getComputedStyle(a,null).getPropertyValue(b)}function t(a){a=a||c.clientHeight;var b=u(c);return Math.max(Math.floor(a/b),0)}function x(a){return u(c)* -a}function u(a){var b=s(a,"line-height");"normal"==b&&(b=1.2*parseInt(s(a,"font-size")));return parseInt(b)}function l(a){if(a.lastChild.children&&0 'GET', - 'callback' => array( $this, 'get_dable_news' ), - 'args' => array( - 'count' => array( - 'type' => 'integer', - 'default' => 3, - 'sanitize_callback' => 'absint' - ) - ), - // public api는 __return_true 처리하도록 안내하고 있음 - // 가이드: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-endpoints/ - 'permission_callback' => '__return_true' - ) ); - } - - public function get_dable_news( $request ) { - $api_endpoint = 'https://light-open-api.dable.io/api/v1/wordpress-plugin/news'; - $site_url = get_bloginfo('url'); - $lang = get_bloginfo('language'); - $count = $request['count']; - - $res = wp_remote_get( - sprintf( '%s?blog=%s&lang=%s&count=%d', $api_endpoint, urlencode( $site_url ), $lang, $count ), - array( - 'httpversion' => '1.1', - ) - ); - - - if ( is_wp_error( $res ) ) { - return $res; - } - - $data = json_decode( $res['body'] ); - - return new WP_REST_Response( $data, 200 ); - } -} diff --git a/class.dable.php b/class.dable.php index 8b0fd0c..b3258a0 100644 --- a/class.dable.php +++ b/class.dable.php @@ -51,13 +51,13 @@ public function print_header() { return; } - the_post(); - $post = get_post(); + $post_id = get_queried_object_id(); + $post = get_post( $post_id ); $meta = array( 'dable:item_id' => $post->ID, 'dable:published_time' => get_post_time( 'c', false, $post, false ), - 'dable:author' => get_the_author_meta( 'display_name', $post->post_author ), + 'dable:author' => get_the_author(), ); $thumbnail = $this->get_thumbnail( $post ); @@ -180,7 +180,7 @@ protected function get_widget_code( $key ) { } public function add_content_wrapper( $content ) { - if ( is_feed() ) { + if (! is_singular() || ! is_main_query() || ! in_the_loop()) { return $content; } diff --git a/dable-for-wordpress.php b/dable-for-wordpress.php index bc8df14..191b359 100644 --- a/dable-for-wordpress.php +++ b/dable-for-wordpress.php @@ -4,13 +4,13 @@ Description: Add Dable widgets and meta tags. Author: Dable Text Domain: dable -Version: 3.2.6 +Version: 3.3.0 Author URI: http://dable.io Domain Path: /languages */ /** * @package dable - * @version 3.2.6 + * @version 3.3.0 */ define( 'DABLE_PLUGIN_VERSION', '3.2.6' ); @@ -20,11 +20,9 @@ require_once DABLE_PLUGIN_DIR . 'lib/functions.php'; require_once DABLE_PLUGIN_DIR . 'class.dable.php'; -require_once DABLE_PLUGIN_DIR . 'class.dable-api.php'; require_once DABLE_PLUGIN_DIR . 'class.dable-widget.php'; new Dable(); -new DableAPI(); if ( is_admin() ) { require_once DABLE_PLUGIN_DIR . 'class.dable-admin.php'; diff --git a/readme.txt b/readme.txt index 217e595..4b86f83 100755 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: dabledev, Taegon Kim Donate link: http://dable.io/ Tags: dable Requires at least: 4.6 -Tested up to: 5.4 -Stable tag: 3.2.6 +Tested up to: 6.2 +Stable tag: 3.3.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -110,4 +110,9 @@ No notice = 3.2.6 = * Fix bug of thumbnail update -* Refactor API Route \ No newline at end of file +* Refactor API Route + += 3.3.0 = +* Tested compatibility with WordPress 6.2 +* Removed the news section. +* Fixed bugs related to the Open Graph Meta Tags feature. diff --git a/views/settings.php b/views/settings.php index e0fb643..a50ce8f 100644 --- a/views/settings.php +++ b/views/settings.php @@ -293,13 +293,5 @@ class="large-text" - -