vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Social Media Plugin Code Review (https://vborg.vbsupport.ru/showthread.php?t=322684)

GHRake 05-20-2016 02:23 PM

Social Media Plugin Code Review
 
1 Attachment(s)
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:
Code:

<meta property="og:description" content="Long tutorial here, gonna upload it in 4 seperate parts!  It is 1.5 hours long and will explain everything you need to know to get started using IDA Pro!
Requirements: Intermediate Knowledge of C++ and x86 Assembly"/>
<meta property="og:site_name" content="GuidedHacking How to Hack Games"/>
<meta property="og:title" content="How to Reverse Engineer with IDA Pro Disassembler"/>
<meta property="og:type" content="article"/>
<meta property="fb:app_id" content="1755543248015018"/>
<meta property="fb:admins" content="100009786466728"/>
<meta property="og:url" content="http://guidedhacking.com/showthread.php?7914-How-to-Reverse-Engineer-with-IDA-Pro-Disassembler"/>
<meta property="og:image" content="http://img.youtube.com/vi/fgMl0Uqiey8/maxresdefault.jpg"/>
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="@guidedhacking"/>
<meta name="twitter:image:width" content="1280"/>
<meta name="twitter:image:height" content="720"/>

Now the share looks like this:
https://vborg.vbsupport.ru/external/2016/05/11.png
Instead of:
https://vborg.vbsupport.ru/external/2016/05/12.png

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

Dave 05-20-2016 03:28 PM

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.

MarkFL 05-20-2016 03:42 PM

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. :)

GHRake 05-22-2016 01:16 AM

Could you fine fellas enlighten on me on how I would access $GLOBALS['threadinfo']['description']
without using $GLOBALS? Thanks in advance

MarkFL 05-22-2016 01:29 AM

Quote:

Originally Posted by GHRake (Post 2571154)
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']

GHRake 05-23-2016 05:41 PM

Quote:

Originally Posted by MarkFL (Post 2571155)
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


All times are GMT. The time now is 02:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01443 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete