<?php

/*
Plugin Name: Big Boom Initialize WP
Description: Initialize options and sample content for your WordPress site
Author: Big Boom Design
Author URI: http://www.bigboomdesign.com
Version: 1.1.1
*/
/* 
* Main Routine
*/
require_once bbdi_dir('/lib/class-bbd-init.php');
/* 
* Back end
*/
if (is_admin()) {
    # Scripts
    add_action('admin_enqueue_scripts', array('BBD_Init', 'admin_enqueue'));
    # Menu Page under 'Tools'
    add_action('admin_menu', array('BBD_Init', 'admin_menu'));
    # ajax
    BBD_Init_Ajax::add_actions();
} else {
    # Login Screen
    function bbdi_custom_login()
    {
        wp_enqueue_style('bbd-initialize-login-css', bbdi_url('/custom-login/custom-login.css'));
    }
    add_action('login_head', 'bbdi_custom_login');
    ## URL link for logo
    public static function req_file($path)
    {
        if (file_exists($path)) {
            require_once $path;
        }
    }
    # return a permalink-friendly version of a string
    public static function clean_str_for_url($sIn)
    {
        if ($sIn == "") {
            return "";
        }
        $sOut = trim(strtolower($sIn));
        $sOut = preg_replace("/\\s\\s+/", " ", $sOut);
        $sOut = preg_replace("/[^a-zA-Z0-9 -]/", "", $sOut);
        $sOut = preg_replace("/--+/", "-", $sOut);
        $sOut = preg_replace("/ +- +/", "-", $sOut);
        $sOut = preg_replace("/\\s\\s+/", " ", $sOut);
        $sOut = preg_replace("/\\s/", "-", $sOut);
        $sOut = preg_replace("/--+/", "-", $sOut);
        $nWord_length = strlen($sOut);
        if ($sOut[$nWord_length - 1] == "-") {
            $sOut = substr($sOut, 0, $nWord_length - 1);
        }
        return $sOut;
    }
}
# require files for plugin
foreach (BBD_Init::$classes as $class) {
    BBD_Init::req_file(bbdi_dir("/lib/class-{$class}.php"));
}