PHP Socializer Add Social Share Buttons Easily
For the longest time I held off adding share buttons to this site. When I finally decided to add them, I found it difficult to decide which solution to run with. I knew that I definitely didn't want to manually paste the HTML/JavaScript for each button, neither did I want to use some branded solution, like Add This.
I experimented with various solutions, including the Shareaholic WordPress plugin. Although I no longer use it, I do like this plugin a lot. It is easy to install and works as advertised. Ultimately though, it wasn't what I was looking for.
I wanted something different - a flexible way to easily insert native share buttons, with as little code as possible. Just the buttons, fully configurable. No branding. PHP Socializer is my attempt at implementing this.
With it, one can include a GitHub repository watch button (provided by Mark Dotto) with the following code:
1 2 3 4 5 6 | use COI\Social; echo Social\GitHub(array( 'username' => 'faceleg', 'repository' => 'PHP-Socializer', 'type' => Social\GitHub\Type\WATCH )); |
Most of the time, one won't want to print out just one button. For these cases, PHP Socializer provides a 'button manager' class to smooth the process.
For example, to prepare & print a Twitter, LinkedIn & StumbleUpon button for this post:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | use COI\Social; // Prepare the buttons $buttons = new Social\Manager(array( 'twitter' => new Social\Twitter(array( 'username' => 'pagesofinterest', )), 'linkedIn' => new Social\LinkedIn(), 'stumbleUpon' => new Social\StumbleUpon(), // The second optional argument is an array of options to be applied to all buttons ), array( 'title' => get_the_title(), 'url' => esc_url(get_permalink()) )); // Print the buttons & the buttons' scripts echo $buttons->render(); echo $buttons->javaScript(); |
PHP Socializer has more helpful features (like automatic Google Analytics integration, per-button overrides, easy extensibility...). I will describe them in detail in future posts.
In the mean time, checkout PHP Socializer's source!
Doxygen Graph Generation Issue “Error: dot: can’t open {dot file}”
Running Doxygen (1.7.4, Ubuntu 11.10) over one of the larger PHP applications we use at PANmedia, I ran into this error:
Error: dot: can't open /var/workspace/app/documentation/html/class_a_d_o_d_b___data_dict_a4ad217393b4e364e233cc70336d93ae8_cgraph.dot
Experimentation led to the following solution: switch DOT_CLEAN off, either via the Doxygen GUI (pictured) or directly in the Doxygen configuration file.
DOT_CLEANUP = NO
What does this do?
DOT_CLEANUP
If the DOT_CLEANUP tag is set to YES (the default) Doxygen will remove the intermediate dot files that are used to generate the various graphs.
I recall running into this error over a year ago (last time I used Doxygen), and it wasn’t until I stumbled onto the solution that I remembered solving it in the same way last time.
Documenting the solution here means that next time I use Doxygen after a long time away, I won’t have to repeat the process.
Auto-Notification of Broken Links, Fantastic Pre-Written Anti-Spam .htaccess File!
Aaron Logan has graciously made his .htaccess file available to the world. It handles bad user agents, known bad IP’s, and keywords in referrer URI’s. It is gold.
JS-Kit Recent Comments PHP Script
This script reads recent posts from your site’s comment rss feed and prints n comments out in a nicely formatted div. Using it is as simple as changing one line, uploading the file, and pasting some code wherever you want the recent comments to be displayed.
Exec-php and WP-Syntax Caveat
Parse error: syntax error, unexpected T_LOGICAL_AND in /home5/pagesofi/public_html/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1

