WP version – 4.5
Plugin version – 2.0.9
PHP Version – 5.5.3
System – Windows NT 6.2 build 9200 (Windows 8 Business Edition) i586
Apache Version – Apache/2.4.4 (Win32) OpenSSL/1.0.1e PHP/5.5.3
Fatal error: Plugin is not initialized correctly. Please initalize plugin trough “WPAutoloader\AutoLoad::Hook” first. in C:\…wp-content\plugins\wp-autoloader\lib\WPAutoloader\Abstracts\Plugin.php on line 186
]]>How to initialize the plugin ‘properly’? When I follow the instruction I click on activate I get:
Fatal error: Plugin is not initialized correctly. Please initalize plugin trough “WPAutoloader\AutoLoad::Hook” first. in C:\xampp\htdocs\wordpress\wp-content\plugins\wp-autoloader\lib\WPAutoloader\Abstracts\Plugin.php on line 186
Web-Server: xampp
Version: 2.0.9.
PHP: 5.6.15
Windows 8.1
Hi,
I followed the instructions for a multi-site installation and the plugin doesn’t appear on the network plugins list.
One note, there was no folder called /wp-content/mu-plugins so I created it per the instructions. But all other network activated plugins are just in the main plugins folder. Does this matter?
Thanks.
]]>I am getting this error
Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected T_STRING in /home/…/wp-content/plugins/wp-autoloader1/index.php on line 16
Plugin version: 2.0.6
Wordpress version:3.5
PHP version: 5.2.17
While I’m trying to activate
Fatal error: Plugin is not initialized correctly. Please initalize plugin trough "WPAutoloader\AutoLoad::Hook" first. in D:\MUNKA\WPPROJECT\site\wp-content\plugins\wp-autoloader\lib\WPAutoloader\Abstracts\Plugin.php on line 134
… correct those dodgy typos in the summary:
WordPress Autoloader makes WP developers life really easy. This plugin loads automatically PHP classes. No need to wrote include scripts anymore.
Sorry, I know this isn’t the most pressing issue, but it suggest a very sloppy and careless rest of the plugin (probably undeservedly so).
]]>You can use WP Autoloader to make development of WordPress plugins faster and easier.
WP Autoloader comes with an easy to use interface for plugins.
An example of plugin file:
<?php
/*
* Plugin Name: fancyBox
* Plugin URI: https://bitbucket.org/holyfield/wp-fancybox
* Description: <strong>fancyBox</strong> is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages. It is built on the top of the popular JavaScript framework jQuery and is both easy to implement and a snap to customize.
* Version: 2.1.4
* Author: Premium WordPress Apps
* Author URI: https://wp-apps.co.uk/
* License: GNU General Public License
*/
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# FancyBox for WordPress
#
/**
* Output message
*/
function plg_fancybox__admin_notice_wpa_missing() {
$msg [ ] = '<div class="updated"><p>';
$msg [ ] = 'Plugin <strong>fancyBox</strong> is not hooked!<br>';
$msg [ ] = 'WordPress Autoloader plugin is required to use <strong>fancyBox</strong> plugin.<br>';
$msg [ ] = 'Please install <a href="https://bitbucket.org/holyfield/wp-autoloader" target="_blank">WordPress Autoloader</a> plugin first.';
$msg [ ] = '</p></div>';
echo implode( PHP_EOL, $msg );
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Hook TubePlus Premium
#
if ( class_exists( '\WPAutoloader\AutoLoad' ) ) {
\fancyBox\fancyBox::Hook();
}
else {
add_action( 'admin_notices', 'plg_fancybox__admin_notice_wpa_missing' );
}
As you see plugin file calls directly \fancyBox\fancyBox::Hook() without adding any include or request commands for related class files. All needed classes reside inside ./lib folder and a loaded automatically only when needed!
Lets check the file of related class itself. As you see our plugin class extends an abstract class. By using this abstract class you can save a lot of time. It’s not perfect yet, but still very robust and easy way to quickly develop plugins.
<?php
namespace fancyBox;
/**
*
* @version 2.1.4
*/
final class fancyBox extends \WPAutoloader\Abstracts\Plugin {
/**
* Fancybox version
*
* @var string
*/
const version = '2.1.4';
/* (non-PHPdoc)
* @see \WPAutoloader\Abstracts\Plugin::init()
*/
protected function init() {
$plugin = self::getInstance();
# Add extra links on plugins page
$plugin->_plugin_links['docs'] = '<a href="https://fancyapps.com/fancybox/#docs" target="_blank">' . __('Docs', 'fancyBox') . '</a>';
$plugin->_plugin_meta_row[] = '<a href="https://fancyapps.com/fancybox/" target="_blank">' . __('Visit fancyBox site', 'fancyBox') . '</a>';
# Define scripts and styles for front end
# jquery-mousewheel
self::AddJScript('jquery-mousewheel', self::GetUri('/inc/js/jquery.mousewheel-3.0.6.min.js'), 'jquery', '3.0.6');
# jquery-easing
self::AddJScript('jquery-easing', self::GetUri('/inc/js/jquery.easing-1.3.min.js'), 'jquery', '1.3');
# fancybox
self::AddJScript('fancybox', self::GetUri('/inc/js/jquery.fancybox.min.js'), 'jquery,jquery-mousewheel,jquery-easing', self::version);
self::AddStyleSheet('fancybox', self::GetUri('/inc/css/jquery.fancybox.css'), '', self::version);
# fancybox-thumbs
self::AddJScript('fancybox-thumbs', self::GetUri('/inc/js/jquery.fancybox-thumbs.min.js'), 'jquery,fancybox', self::version);
self::AddStyleSheet('fancybox-thumbs', self::GetUri('/inc/css/jquery.fancybox-thumbs.css'), 'fancybox', self::version);
# fancybox-buttons
self::AddJScript('fancybox-buttons', self::GetUri('/inc/js/jquery.fancybox-buttons.min.js'), 'jquery,fancybox', self::version);
self::AddStyleSheet('fancybox-buttons', self::GetUri('/inc/css/jquery.fancybox-buttons.css'), 'fancybox', self::version);
# fancybox-media
self::AddJScript('fancybox-media', self::GetUri('/inc/js/jquery.fancybox-media.min.js'), 'jquery,fancybox', self::version);
# fancybox-init
self::AddJScript('fancybox-init', admin_url('admin-ajax.php') . '?action=fancyboxscript', 'jquery,fancybox', self::version);
# Use front-end scripts on back-end
$plugin->_admin_scripts = $plugin->_front_scripts;
$plugin->_admin_styles = $plugin->_front_styles;
self::AddAdminJScript('fancybox-settings', self::GetUri('/inc/js/jquery.wp.fancybox.min.js'), 'jquery,fancybox', self::version);
# Load language
add_action('plugins_loaded', 'fancyBox\fancyBox::LoadTextDomain');
}
/**
* Loads language
*/
public static function LoadTextDomain() {
load_plugin_textdomain('fancyBox', false, self::GetBase('languages/'));
}
/**
*
* @since 2.1.4
*/
public static function PrintFrontEndHeader() {
}
/**
*
* @since 2.1.4
*/
public static function PrintAdminHeader() {
}
/**
*
* @since 2.1.4
*/
public static function AddActionsAndFilters() {
add_action('wp_ajax_nopriv_fancyboxscript', 'fancyBox\SettingsPanel::AjaxJSScript');
add_action('wp_ajax_fancyboxscript', 'fancyBox\SettingsPanel::AjaxJSScript');
add_action('admin_init', 'fancyBox\SettingsPanel::InitAdmin');
add_action('admin_menu', 'fancyBox\SettingsPanel::AdminMenu');
}
}
]]>