Permalink
Browse files

Version 1.3 New FacebookInfo detailing the plugin info (version, auth…

…or, link, email, license) accessable from anywhere.
  • Loading branch information...
1 parent 8cff475 commit 6bbcf34e1527d4c5e0a9e8889e8f0439f232fa70 @webtechnick committed Feb 11, 2010
View
@@ -1,7 +1,7 @@
Facebook Plugin
==================
by Nick Baker (nick@webtechnick.com)
-version 1.2.1
+version 1.3.0
http://www.webtechnick.com
license: MIT
@@ -11,6 +11,7 @@ Changelog
1.1 Added API feature
1.2 Initial release beta
1.2.1 Minor Bug fixes and tests
+1.3 Added FacebookInfo class for easy reference to plugin details anywhere.
Docs
==================
@@ -27,7 +28,7 @@ TAR: http://projects.webtechnick.com/facebook.tar.gz
Description
==================
-The purpose if this plugin is to provide a complete interface to the facebook api, and to provide easy to install and manage various facebook features.
+The purpose of the Facebook plugin is to provide a seamless way to connect your cakePHP app to everyone's favorite social networking site -- Facebook. The goal for this plugin is to not only provide extremely useful dynamic features but to also provide a complete interface to the Facebook API.
@@ -1,4 +1,5 @@
<?php
+App::import('Lib', 'Facebook.FacebookInfo');
class FacebookAppController extends AppController {
}
View
@@ -1,5 +1,5 @@
<?php
-
+App::import('Lib', 'Facebook.FacebookInfo');
class FacebookAppModel extends AppModel {
}
View
No changes.
View
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Facebook Plugin Information
+ * versioning information
+ */
+class FacebookInfo {
+
+ public static $options = array(
+ 'name',
+ 'version',
+ 'author',
+ 'email',
+ 'link',
+ 'description',
+ );
+
+ /**
+ * Get the version of the Facebook Plugin
+ * @return string version number
+ */
+ static function version(){
+ return '1.3.0';
+ }
+
+ /**
+ * Get the offical name of the Facebook Plugin
+ * @return string plugin name
+ */
+ static function name(){
+ return 'CakePHP Facebook Plugin';
+ }
+
+ /**
+ * Get the name of the author
+ * @return string plugin author
+ */
+ static function author(){
+ return 'Nick Baker';
+ }
+
+ /**
+ * Get the support email
+ * @return string plugin support email
+ */
+ static function email(){
+ return 'nick@webtechnick.com';
+ }
+
+ /**
+ * Get the website for Facebook Plugin
+ * @return string plugin link
+ */
+ static function link(){
+ return 'http://www.webtechnick.com';
+ }
+
+ /**
+ * Get the license for Facebook Plugin
+ * @return string plugin license
+ */
+ static function license(){
+ return 'MIT';
+ }
+
+ /**
+ * Get the license for Facebook Plugin
+ * @return string plugin license
+ */
+ static function description(){
+ return "The purpose of the Facebook plugin is to provide a seamless way to connect your cakePHP app to everyone's favorite social networking site -- Facebook. The goal for this plugin is to not only provide extremely useful dynamic features but to also provide a complete interface to the Facebook API.";
+ }
+
+ /**
+ * Get the available options list
+ */
+ static function getOptions(){
+ return self::$options;
+ }
+
+ /**
+ * Utility method to test if this is available key.
+ */
+ static function _isAvailable($name){
+ return in_array($name, self::$options);
+ }
+}
+?>
@@ -9,6 +9,26 @@ function startTest(){
$this->Facebook->Html = new HtmlHelper();
}
+ function testInfo(){
+ $results = $this->Facebook->info();
+ $this->assertNotEqual('version not a valid option.', $results);
+
+ $results = $this->Facebook->info('author');
+ $this->assertNotEqual('author not a valid option.', $results);
+
+ $results = $this->Facebook->info('email');
+ $this->assertNotEqual('email not a valid option.', $results);
+
+ $results = $this->Facebook->info('name');
+ $this->assertNotEqual('name not a valid option.', $results);
+
+ $results = $this->Facebook->info('description');
+ $this->assertNotEqual('description not a valid option.', $results);
+
+ $results = $this->Facebook->info('notvalid');
+ $this->assertEqual('notvalid is not an available option', $results);
+ }
+
function testHtml(){
$results = $this->Facebook->html();
$this->assertTrue('<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">', $results);
View
@@ -3,10 +3,11 @@
* Facebook.Facebook helper generates fbxml and loads javascripts
*
* @author Nick Baker <nick [at] webtechnick [dot] com>
- * @version 1.2
+ * @version 1.3
* @license MIT
* @link http://www.webtechnick.com
*/
+App::import('Lib', 'Facebook.FacebookInfo');
class FacebookHelper extends AppHelper {
/**
* Helpers to load with this helper.
@@ -36,6 +37,25 @@ class FacebookHelper extends AppHelper {
* @access protected
*/
var $_fXdReceiver = 'facebook/receiver/xd_receiver.htm';
+
+ /**
+ * Get the info on this plugin
+ * @param string name to retrieve (default 'version')
+ * - 'name' => Plugin Name
+ * - 'author' => Author Name
+ * - 'email' => Support Email
+ * - 'link' => Support Link
+ * - 'license' => License Info
+ * @return string plugin version
+ */
+ function info($name = 'version'){
+ if(FacebookInfo::_isAvailable($name)){
+ return FacebookInfo::$name();
+ }
+ else {
+ return "$name is not an available option";
+ }
+ }
/**
* html header tag for xmlns of facebook. This is necessary for IE

0 comments on commit 6bbcf34

Please sign in to comment.