Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 20 May 2016, 16:23
GHRake GHRake is offline
 
Join Date: Sep 2015
Real name: Anomander Rake
Social Media Plugin Code Review

Hello friends, I've been learning PHP and creating my first plugin the past few days. I'm using Nexia's OpenGraph Protocol Inserts as a basis for my project, so many thanks and credits for this great modification. I've shot him an email asking permission to perhaps update/release this project and am waiting to hear back.

The plugin accomplishes this so far:
  • Adds Open Graph and Twitter Card meta tags to pages for better sharing
  • Includes code linking Facebook Domain and app insights to your page
  • vbAdvanced Support (the main reason I started modifying this)
  • Picks an image from the content with priority being video, then hot linked image, then attached image.
  • Grabs thumbnail from youtube video and drives traffic from your social share to your page instead of youtube
  • Defaults to a vboptions defined image if no image is found, no more social shares without images or badly resized images
  • Tells twitter the aspect ratio of the image for better resizing

This is what is adds to the HTML:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now the share looks like this:

Instead of:


Combining this with some simple social share buttons makes my social marketing campaign 2easy

I was hoping to get some feedback on my code from the pros. Currently on vb4.2.3 and vbAdvanced 4.3.0
Please don't install if you don't know what you're doing, I've tested it thoroughly but am not an expert
Attached Files
File Type: xml product-GH-SocialMediaMeta050.xml (7.3 KB, 12 views)

Last edited by GHRake; 23 May 2016 at 19:42.
Reply With Quote
  #2  
Old 20 May 2016, 17:28
Dave Dave is online now
 
Join Date: Jun 2010
Real name: Dave
The code looks fine. The only comment I can make about it is that you should avoid using $GLOBALS. It's bad practice to use that these days.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #3  
Old 20 May 2016, 17:42
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
I agree with Dave on both counts. I've never needed to use $GLOBALS.

But, congratulations on creating your first product. But be warned...it can be addictive.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #4  
Old 22 May 2016, 03:16
GHRake GHRake is offline
 
Join Date: Sep 2015
Real name: Anomander Rake
Could you fine fellas enlighten on me on how I would access $GLOBALS['threadinfo']['description']
without using $GLOBALS? Thanks in advance
Reply With Quote
  #5  
Old 22 May 2016, 03:29
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Originally Posted by GHRake View Post
Could you fine fellas enlighten on me on how I would access $GLOBALS['threadinfo']['description']
without using $GLOBALS? Thanks in advance
You've already declared the array "$threadinfo" global in your plugin, so you should be able to access that element with:

$threadinfo['description']
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #6  
Old 23 May 2016, 19:41
GHRake GHRake is offline
 
Join Date: Sep 2015
Real name: Anomander Rake
Originally Posted by MarkFL View Post
You've already declared the array "$threadinfo" global in your plugin, so you should be able to access that element with:

$threadinfo['description']
Worked like a charm, thanks
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add-On Releases DJ's AME (Auto Media Embedding) XML Media Definitions (Third Time's the Charm) Digital Jedi Modification Graveyard 828 10 Mar 2010 05:45



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 15:19.

Layout Options | Width: Wide Color: