<?php

/**
 Plugin Name: Bootstrap Hooks
 Plugin URI: http://github.com/benignware/wp-bootstrap-hooks
 Description: A collection of action and filters for bootstrap based themes
 Version: 0.0.1
 Author: Rafael Nowrotek, Benignware
 Author URI: http://benignware.com
 License: MIT
*/

function wp_bootstrap_hooks() {
  $args = func_get_args();
  if (!count($args)) {
    $args = array('comments', 'content', 'forms', 'gallery', 'menu', 'pagination', 'widgets');
  }
  foreach ($args as $arg) {
    require_once "bootstrap-$arg.php";
  }
}

// If file resides in template directory, require all immediately
if (preg_match("~^" . preg_quote(get_template_directory(), "~") . "~", __FILE__)) {
  wp_bootstrap_hooks();
}
<?php


function wp_bootstrap_hooks() {

  require_once "bootstrap-comments.php";
  require_once "bootstrap-content.php";
  require_once "bootstrap-gallery.php";
  require_once "bootstrap-menu.php";
  require_once "bootstrap-pagination.php";
  require_once "bootstrap-searchform.php";
  require_once "bootstrap-widgets.php";

}
--- 
+++ 
@@ -1,14 +1,26 @@
 <?php
 
+/**
+ Plugin Name: Bootstrap Hooks
+ Plugin URI: http://github.com/benignware/wp-bootstrap-hooks
+ Description: A collection of action and filters for bootstrap based themes
+ Version: 0.0.1
+ Author: Rafael Nowrotek, Benignware
+ Author URI: http://benignware.com
+ License: MIT
+*/
 
 function wp_bootstrap_hooks() {
+  $args = func_get_args();
+  if (!count($args)) {
+    $args = array('comments', 'content', 'forms', 'gallery', 'menu', 'pagination', 'widgets');
+  }
+  foreach ($args as $arg) {
+    require_once "bootstrap-$arg.php";
+  }
+}
 
-  require_once "bootstrap-comments.php";
-  require_once "bootstrap-content.php";
-  require_once "bootstrap-gallery.php";
-  require_once "bootstrap-menu.php";
-  require_once "bootstrap-pagination.php";
-  require_once "bootstrap-searchform.php";
-  require_once "bootstrap-widgets.php";
-
+// If file resides in template directory, require all immediately
+if (preg_match("~^" . preg_quote(get_template_directory(), "~") . "~", __FILE__)) {
+  wp_bootstrap_hooks();
 }
Handle require when used as plugin or from template
