Changeset 1901559
- Timestamp:
- 06/30/2018 05:14:20 AM (8 years ago)
- Location:
- complete-open-graph
- Files:
-
- 34 added
- 5 edited
-
tags/3.3.0 (added)
-
tags/3.3.0/complete-open-graph.php (added)
-
tags/3.3.0/composer.json (added)
-
tags/3.3.0/index.php (added)
-
tags/3.3.0/readme.txt (added)
-
tags/3.3.0/src (added)
-
tags/3.3.0/src/Filters.php (added)
-
tags/3.3.0/src/Generator.php (added)
-
tags/3.3.0/src/Metabox.php (added)
-
tags/3.3.0/src/PostDecorator.php (added)
-
tags/3.3.0/src/Settings.php (added)
-
tags/3.3.0/src/Support.php (added)
-
tags/3.3.0/src/Utilities.php (added)
-
tags/3.3.0/src/assets (added)
-
tags/3.3.0/src/assets/css (added)
-
tags/3.3.0/src/assets/css/style.css (added)
-
tags/3.3.0/src/assets/img (added)
-
tags/3.3.0/src/assets/img/github.svg.php (added)
-
tags/3.3.0/src/assets/img/twitter.svg.php (added)
-
tags/3.3.0/src/assets/img/wordpress.svg.php (added)
-
tags/3.3.0/src/assets/js (added)
-
tags/3.3.0/src/assets/js/scripts.js (added)
-
tags/3.3.0/src/assets/scss (added)
-
tags/3.3.0/src/assets/scss/_variables.scss (added)
-
tags/3.3.0/src/assets/scss/components (added)
-
tags/3.3.0/src/assets/scss/components/_SK_Box.scss (added)
-
tags/3.3.0/src/assets/scss/components/_SK_FeedbackList.scss (added)
-
tags/3.3.0/src/assets/scss/components/_SK_ImageHolder.scss (added)
-
tags/3.3.0/src/assets/scss/components/_SK_SidebarBlock.scss (added)
-
tags/3.3.0/src/assets/scss/layouts (added)
-
tags/3.3.0/src/assets/scss/layouts/_metabox.scss (added)
-
tags/3.3.0/src/assets/scss/layouts/_settings.scss (added)
-
tags/3.3.0/src/assets/scss/style.scss (added)
-
tags/3.3.0/src/index.php (added)
-
trunk/complete-open-graph.php (modified) (1 diff)
-
trunk/composer.json (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/Filters.php (modified) (3 diffs)
-
trunk/src/Generator.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
complete-open-graph/trunk/complete-open-graph.php
r1896779 r1901559 3 3 * Plugin Name: Complete Open Graph 4 4 * Description: Simple, comprehensive, highly customizable Open Graph management. 5 * Version: 3. 2.75 * Version: 3.3.0 6 6 * Author: Alex MacArthur 7 7 * Author URI: https://macarthur.me -
complete-open-graph/trunk/composer.json
r1896779 r1901559 5 5 "minimum-stability": "stable", 6 6 "license": "GPL-2.0", 7 "version": "3. 2.7",7 "version": "3.3.0", 8 8 "authors": [ 9 9 { … … 16 16 "support" : { 17 17 "issues": "https://wordpress.org/support/plugin/complete-open-graph", 18 "source": "https://downloads.wordpress.org/plugin/complete-open-graph.3. 2.7.zip"18 "source": "https://downloads.wordpress.org/plugin/complete-open-graph.3.3.0.zip" 19 19 }, 20 20 "autoload-dev": { -
complete-open-graph/trunk/readme.txt
r1896779 r1901559 6 6 Requires at least: 3.9 7 7 Tested up to: 4.9.6 8 Stable tag: 3. 2.78 Stable tag: 3.3.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 127 127 ` 128 128 129 The `complete_open_graph_maybe_enable` filter allows you to disable tag generation altogether by returning a boolean. 130 131 Example for disabling generation altogether: 132 ` 133 add_filter('complete_open_graph_maybe_enable', '__return_false'); 134 ` 135 136 Example for disabling generation on a specific page: 137 ` 138 add_filter('complete_open_graph_maybe_enable', function ($maybeEnable) { 139 global $post; 140 141 if($post->post_name === 'my-page') { 142 return false; 143 } 144 145 return $maybeEnable; 146 }); 147 ` 148 129 149 == Advanced Filtering == 130 150 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. … … 263 283 * Improve handling of default values and how they're handled if left empty. 264 284 285 = 3.3.0 = 286 * Fix errors being thrown in PHP versions under 5.6. 287 * Add filter to disable Open Graph tags per page. 288 265 289 == Feedback == 266 290 -
complete-open-graph/trunk/src/Filters.php
r1893749 r1901559 13 13 add_filter(self::$options_prefix . '_twitter:site', array($this, 'append_at_symbol'), 10, 2); 14 14 add_filter(self::$options_prefix . '_twitter:creator', array($this, 'append_at_symbol'), 10, 2); 15 add_filter(self::$options_prefix . '_og:image', array($this, ' process_image'), 10, 2);16 add_filter(self::$options_prefix . '_twitter:image', array($this, ' process_image'), 10, 2);15 add_filter(self::$options_prefix . '_og:image', array($this, 'attach_image_dimensions'), 10, 2); 16 add_filter(self::$options_prefix . '_twitter:image', array($this, 'attach_image_dimensions'), 10, 2); 17 17 } 18 18 … … 24 24 * @return string 25 25 */ 26 public function process_image($value, $field_name) {26 public function attach_image_dimensions($value, $field_name) { 27 27 28 28 $width = ''; … … 30 30 31 31 if(!is_numeric($value)) return $value; 32 33 //-- Ensure this is actually an integer. 34 $value = intval($value); 32 35 33 36 //-- If this attachment doesn't actually exist or isn't an image, just get out of here. -
complete-open-graph/trunk/src/Generator.php
r1896779 r1901559 7 7 public function __construct() { 8 8 add_action('wp_head', array($this, 'generate_open_graph_markup')); 9 add_filter('language_attributes', array($this, 'add_open_graph_prefix'), 10, 2 );9 add_filter('language_attributes', array($this, 'add_open_graph_prefix'), 10, 2); 10 10 } 11 11 … … 17 17 */ 18 18 public function add_open_graph_prefix( $output, $doctype ) { 19 if(!apply_filters(self::$options_prefix . '_maybe_enable', true)) return $output; 20 19 21 return $output . ' prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#"'; 20 }22 } 21 23 22 24 /** … … 26 28 */ 27 29 public function generate_open_graph_markup() { 30 if(!apply_filters(self::$options_prefix . '_maybe_enable', true)) return; 28 31 29 32 echo "\n\n<!-- Open Graph data is managed by Alex MacArthur's Complete Open Graph plugin. (v" . self::$plugin_data['Version'] . ") -->\n"; … … 80 83 //-- Remove non-protected items before we tack on our global value. 81 84 //-- This way, we can have a fallback system in place in case a global value is empty. 82 $progression = array_filter($progression, function ($key) use($protectedKeys) { 83 return in_array($key, $protectedKeys); 84 }, ARRAY_FILTER_USE_KEY); 85 86 //-- Place our global value at the top of progression. 85 $progression = $this->get_only_protected_values($progression, $protectedKeys); 86 87 87 array_unshift($progression, $value); 88 88 … … 99 99 ); 100 100 101 } 102 103 /** 104 * Ideally, this would be array_filter(), but was causing PHP fallback issues. 105 * 106 * @param array $progression 107 * @param array $protectedKeys 108 * @return array 109 */ 110 public function get_only_protected_values($progression, $protectedKeys) { 111 $protectedValues = array(); 112 113 foreach($protectedKeys as $key) { 114 if(!isset($progression[$key])) continue; 115 $protectedValues[] = $progression[$key]; 116 } 117 118 return $protectedValues; 101 119 } 102 120
Note: See TracChangeset
for help on using the changeset viewer.