Open Graph for Facebook, Google+ and Twitter Card Tags - Version 0.1.6

Version Description

  • Settings link now shows up on the plugins list
  • Small fix to ensure admin functions only are running when on the admin interface
  • Some admin options now only show up when the tag is set to be included
Download this release

Release Info

Developer wonderm00n
Plugin Icon Open Graph for Facebook, Google+ and Twitter Card Tags
Version 0.1.6
Comparing to
See all releases

Code changes from version 0.1.5 to 0.1.6

includes/settings-page.php CHANGED
@@ -52,10 +52,10 @@
52
  <tr>
53
  <th scope="row" nowrap="nowrap">Include Facebook Platform App ID (og:app_id) tag?</th>
54
  <td>
55
- <input type="checkbox" name="fb_app_id_show" id="fb_app_id_show" value="1" <?php echo (intval($fb_app_id_show)==1 ? ' checked="checked"' : ''); ?>/>
56
  </td>
57
  </tr>
58
- <tr>
59
  <th scope="row" nowrap="nowrap">Facebook Platform App ID:</th>
60
  <td>
61
  <input type="text" name="fb_app_id" id="fb_app_id" size="30" value="<?php echo $fb_app_id; ?>"/>
@@ -249,6 +249,7 @@
249
  jQuery("input"+"#fb_image").val(imgurl);
250
  tb_remove();
251
  }
 
252
  showAdminOptions();
253
  jQuery('.fb_description_options').hide();
254
  showDescriptionOptions();
@@ -256,6 +257,13 @@
256
  showDescriptionCustomText();
257
  showImageOptions();
258
  });
 
 
 
 
 
 
 
259
  function showAdminOptions() {
260
  if (jQuery('#fb_admin_id_show').is(':checked')) {
261
  jQuery('.fb_admin_id_options').show();
52
  <tr>
53
  <th scope="row" nowrap="nowrap">Include Facebook Platform App ID (og:app_id) tag?</th>
54
  <td>
55
+ <input type="checkbox" name="fb_app_id_show" id="fb_app_id_show" value="1" <?php echo (intval($fb_app_id_show)==1 ? ' checked="checked"' : ''); ?> onclick="showAppidOptions();"/>
56
  </td>
57
  </tr>
58
+ <tr class="fb_app_id_options">
59
  <th scope="row" nowrap="nowrap">Facebook Platform App ID:</th>
60
  <td>
61
  <input type="text" name="fb_app_id" id="fb_app_id" size="30" value="<?php echo $fb_app_id; ?>"/>
249
  jQuery("input"+"#fb_image").val(imgurl);
250
  tb_remove();
251
  }
252
+ showAppidOptions();
253
  showAdminOptions();
254
  jQuery('.fb_description_options').hide();
255
  showDescriptionOptions();
257
  showDescriptionCustomText();
258
  showImageOptions();
259
  });
260
+ function showAppidOptions() {
261
+ if (jQuery('#fb_app_id_show').is(':checked')) {
262
+ jQuery('.fb_app_id_options').show();
263
+ } else {
264
+ jQuery('.fb_app_id_options').hide();
265
+ }
266
+ }
267
  function showAdminOptions() {
268
  if (jQuery('#fb_admin_id_show').is(':checked')) {
269
  jQuery('.fb_admin_id_options').show();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-faceb
4
  Tags: facebook, open graph, seo, share, social, meta
5
  Requires at least: 3
6
  Tested up to: 3.2.1
7
- Stable tag: 0.1.5
8
 
9
  This plugin inserts Facebook Open Graph Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
 
@@ -33,6 +33,12 @@ The tags that this plugin inserts are:
33
 
34
  == Changelog ==
35
 
 
 
 
 
 
 
36
  = 0.1.5 =
37
 
38
  * Fixed the way Categories and Tags pages links were being retrieved that would cause an error on WP 3.0
4
  Tags: facebook, open graph, seo, share, social, meta
5
  Requires at least: 3
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.1.6
8
 
9
  This plugin inserts Facebook Open Graph Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
 
33
 
34
  == Changelog ==
35
 
36
+ = 0.1.6 =
37
+
38
+ * Settings link now shows up on the plugins list
39
+ * Small fix to ensure admin functions only are running when on the admin interface
40
+ * Some admin options now only show up when the tag is set to be included
41
+
42
  = 0.1.5 =
43
 
44
  * Fixed the way Categories and Tags pages links were being retrieved that would cause an error on WP 3.0
wonderm00n-open-graph.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
3
  * @package Wonderm00n's Simple Facebook Open Graph Meta Tags
4
- * @version 0.1.5
5
  */
6
  /*
7
  Plugin Name: Wonderm00n's Simple Facebook Open Graph Meta Tags
8
  Plugin URI: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/
9
  Description: This plugin inserts Facebook Open Graph Tags into your Wordpress Blog/Website for better Facebook sharing
10
  Author: Marco Almeida (Wonderm00n)
11
- Version: 0.1.5
12
  Author URI: http://wonderm00n.com
13
  */
14
 
@@ -179,71 +179,72 @@ function wonderm00n_open_graph_add_opengraph_namespace( $output ) {
179
  add_filter('language_attributes', 'wonderm00n_open_graph_add_opengraph_namespace',9999);
180
 
181
  //Admin
182
- if ( is_admin() ){
183
  add_action('admin_menu', 'wonderm00n_open_graph_add_options');
184
- }
185
- add_action('activate_wonderm00n-open-graph/wonderm00n-open-graph.php', 'wonderm00n_open_graph_activate');
186
-
187
- function wonderm00n_open_graph_add_options() {
188
- if(function_exists('add_options_page')){
189
- add_options_page('Wonderm00n\'s Open Graph', 'Wonderm00n\'s Open Graph', 9, basename(__FILE__), 'wonderm00n_open_graph_admin');
190
- }
191
- }
192
-
193
- function wonderm00n_open_graph_activate() {
194
- update_option("wonderm00n_open_graph_activated", 1);
195
- update_option("wonderm00n_open_graph_fb_admin_id_show", 0);
196
- update_option("wonderm00n_open_graph_fb_app_id_show", 0);
197
- update_option("wonderm00n_open_graph_fb_sitename_show", 1);
198
- update_option("wonderm00n_open_graph_fb_title_show", 1);
199
- update_option("wonderm00n_open_graph_fb_url_show", 1);
200
- update_option("wonderm00n_open_graph_fb_type_show", 1);
201
- update_option("wonderm00n_open_graph_fb_desc_show", 1);
202
- update_option("wonderm00n_open_graph_fb_desc_chars", 300);
203
- update_option("wonderm00n_open_graph_fb_image_show", 1);
204
- }
205
-
206
- function wonderm00n_open_graph_settings_link( $links, $file ) {
207
- if( $file == 'wonderm00n-open-graph/wonderm00n-open-graph.php' && function_exists( "admin_url" ) ) {
208
- $settings_link = '<a href="' . admin_url( 'options-general.php?page=wonderm00n-open-graph.php' ) . '">' . __('Settings') . '</a>';
209
- array_push( $links, $settings_link ); // after other links
210
  }
211
- return $links;
212
- }
213
- add_filter( 'plugin_action_links', 'wonderm00n_open_graph_settings_link', 9, 2 );
214
-
215
-
216
- function wonderm00n_open_graph_admin() {
217
- include_once 'includes/settings-page.php';
218
- }
219
-
220
- function wonderm00n_open_graph_scripts() {
221
- wp_enqueue_script('media-upload');
222
- wp_enqueue_script('thickbox');
223
- wp_enqueue_script('jquery');
224
- }
225
- function wonderm00n_open_graph_styles() {
226
- wp_enqueue_style('thickbox');
227
- }
228
- add_action('admin_print_scripts', 'wonderm00n_open_graph_scripts');
229
- add_action('admin_print_styles', 'wonderm00n_open_graph_styles');
230
-
231
- if ( isset($_POST['action']) ) {
232
- if (trim($_POST['action'])=='save') {
233
- update_option('wonderm00n_open_graph_fb_app_id_show', intval($_POST['fb_app_id_show']));
234
- update_option('wonderm00n_open_graph_fb_app_id', trim($_POST['fb_app_id']));
235
- update_option('wonderm00n_open_graph_fb_admin_id_show', intval($_POST['fb_admin_id_show']));
236
- update_option('wonderm00n_open_graph_fb_admin_id', trim($_POST['fb_admin_id']));
237
- update_option('wonderm00n_open_graph_fb_sitename_show', intval($_POST['fb_sitename_show']));
238
- update_option('wonderm00n_open_graph_fb_title_show', intval($_POST['fb_title_show']));
239
- update_option('wonderm00n_open_graph_fb_url_show', intval($_POST['fb_url_show']));
240
- update_option('wonderm00n_open_graph_fb_type_show', intval($_POST['fb_type_show']));
241
- update_option('wonderm00n_open_graph_fb_desc_show', intval($_POST['fb_desc_show']));
242
- update_option('wonderm00n_open_graph_fb_desc_chars', intval($_POST['fb_desc_chars']));
243
- update_option('wonderm00n_open_graph_fb_desc_homepage', trim($_POST['fb_desc_homepage']));
244
- update_option('wonderm00n_open_graph_fb_desc_homepage_customtext', trim($_POST['fb_desc_homepage_customtext']));
245
- update_option('wonderm00n_open_graph_fb_image_show', intval($_POST['fb_image_show']));
246
- update_option('wonderm00n_open_graph_fb_image', trim($_POST['fb_image']));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  }
248
  }
249
  ?>
1
  <?php
2
  /**
3
  * @package Wonderm00n's Simple Facebook Open Graph Meta Tags
4
+ * @version 0.1.6
5
  */
6
  /*
7
  Plugin Name: Wonderm00n's Simple Facebook Open Graph Meta Tags
8
  Plugin URI: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/
9
  Description: This plugin inserts Facebook Open Graph Tags into your Wordpress Blog/Website for better Facebook sharing
10
  Author: Marco Almeida (Wonderm00n)
11
+ Version: 0.1.6
12
  Author URI: http://wonderm00n.com
13
  */
14
 
179
  add_filter('language_attributes', 'wonderm00n_open_graph_add_opengraph_namespace',9999);
180
 
181
  //Admin
182
+ if ( is_admin() ) {
183
  add_action('admin_menu', 'wonderm00n_open_graph_add_options');
184
+
185
+ add_action('activate_wonderm00n-open-graph/wonderm00n-open-graph.php', 'wonderm00n_open_graph_activate');
186
+
187
+ function wonderm00n_open_graph_add_options() {
188
+ if(function_exists('add_options_page')){
189
+ add_options_page('Wonderm00n\'s Open Graph', 'Wonderm00n\'s Open Graph', 9, basename(__FILE__), 'wonderm00n_open_graph_admin');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  }
191
+ }
192
+
193
+ function wonderm00n_open_graph_activate() {
194
+ update_option("wonderm00n_open_graph_activated", 1);
195
+ update_option("wonderm00n_open_graph_fb_admin_id_show", 0);
196
+ update_option("wonderm00n_open_graph_fb_app_id_show", 0);
197
+ update_option("wonderm00n_open_graph_fb_sitename_show", 1);
198
+ update_option("wonderm00n_open_graph_fb_title_show", 1);
199
+ update_option("wonderm00n_open_graph_fb_url_show", 1);
200
+ update_option("wonderm00n_open_graph_fb_type_show", 1);
201
+ update_option("wonderm00n_open_graph_fb_desc_show", 1);
202
+ update_option("wonderm00n_open_graph_fb_desc_chars", 300);
203
+ update_option("wonderm00n_open_graph_fb_image_show", 1);
204
+ }
205
+
206
+ function wonderm00n_open_graph_settings_link( $links, $file ) {
207
+ if( $file == 'wonderm00ns-simple-facebook-open-graph-tags/wonderm00n-open-graph.php' && function_exists( "admin_url" ) ) {
208
+ $settings_link = '<a href="' . admin_url( 'options-general.php?page=wonderm00n-open-graph.php' ) . '">' . __('Settings') . '</a>';
209
+ array_push( $links, $settings_link ); // after other links
210
+ }
211
+ return $links;
212
+ }
213
+ add_filter('plugin_row_meta', 'wonderm00n_open_graph_settings_link', 9, 2 );
214
+
215
+
216
+ function wonderm00n_open_graph_admin() {
217
+ include_once 'includes/settings-page.php';
218
+ }
219
+
220
+ function wonderm00n_open_graph_scripts() {
221
+ wp_enqueue_script('media-upload');
222
+ wp_enqueue_script('thickbox');
223
+ wp_enqueue_script('jquery');
224
+ }
225
+ function wonderm00n_open_graph_styles() {
226
+ wp_enqueue_style('thickbox');
227
+ }
228
+ add_action('admin_print_scripts', 'wonderm00n_open_graph_scripts');
229
+ add_action('admin_print_styles', 'wonderm00n_open_graph_styles');
230
+
231
+ if ( isset($_POST['action']) ) {
232
+ if (trim($_POST['action'])=='save') {
233
+ update_option('wonderm00n_open_graph_fb_app_id_show', intval($_POST['fb_app_id_show']));
234
+ update_option('wonderm00n_open_graph_fb_app_id', trim($_POST['fb_app_id']));
235
+ update_option('wonderm00n_open_graph_fb_admin_id_show', intval($_POST['fb_admin_id_show']));
236
+ update_option('wonderm00n_open_graph_fb_admin_id', trim($_POST['fb_admin_id']));
237
+ update_option('wonderm00n_open_graph_fb_sitename_show', intval($_POST['fb_sitename_show']));
238
+ update_option('wonderm00n_open_graph_fb_title_show', intval($_POST['fb_title_show']));
239
+ update_option('wonderm00n_open_graph_fb_url_show', intval($_POST['fb_url_show']));
240
+ update_option('wonderm00n_open_graph_fb_type_show', intval($_POST['fb_type_show']));
241
+ update_option('wonderm00n_open_graph_fb_desc_show', intval($_POST['fb_desc_show']));
242
+ update_option('wonderm00n_open_graph_fb_desc_chars', intval($_POST['fb_desc_chars']));
243
+ update_option('wonderm00n_open_graph_fb_desc_homepage', trim($_POST['fb_desc_homepage']));
244
+ update_option('wonderm00n_open_graph_fb_desc_homepage_customtext', trim($_POST['fb_desc_homepage_customtext']));
245
+ update_option('wonderm00n_open_graph_fb_image_show', intval($_POST['fb_image_show']));
246
+ update_option('wonderm00n_open_graph_fb_image', trim($_POST['fb_image']));
247
+ }
248
  }
249
  }
250
  ?>