Viewing 2 reply threads
  • Author
    Posts
    • #3368
      Marcus
      Member

      I’ve been trying for the life of me to implement piklist checker in my plugin, but seem to get the same response everytime I activate the plugin without piklist being downloaded. ‘Plugin Activated’

      Maybe someone can help me with where its going wrong, as no matter what I try within these classes, nothing will show the ‘download piklist now’ box.
      Here’s the code:

      
      if(!class_exists('WP_piklist_fields'))
      {
      	class WP_piklist_fields
      	{
      		/**
      		 * Construct the plugin object
      		 */
      		public function __construct()
      		{
      			add_action( 'init', array('WP_piklist_fields', 'init_plugin'));
      		} // END public function load
      
      		/**
      		 * Init the plugin
      		 */
      		public static function init_plugin()
      		{
      			if(is_admin()) {
      				include_once('piklist-checker/class-piklist-checker.php');
      				if (!piklist_checker::check(__FILE__)) {
      					return;
      				}
      			}
      		} // END public static function init_plugin
      
      		/**
      		 * Activate the plugin
      		 */
      		public static function activate()
      		{
      			// Do nothing
      		} // END public static function activate
      
      		/**
      		 * Deactivate the plugin
      		 */
      		public static function deactivate()
      		{
      			// Do nothing
      		} // END public static function deactivate
      
      	} // END class WP_piklist_fields
      } // END if(!class_exists('WP_piklist_fields'))
      
      if(class_exists('WP_piklist_fields'))
      {
      	// Installation and uninstallation hooks
      	register_activation_hook(__FILE__, array('WP_piklist_fields', 'activate'));
      	register_deactivation_hook(__FILE__, array('WP_piklist_fields', 'deactivate'));
      
      	// instantiate the plugin class
      	$WP_piklist_fields = new WP_piklist_fields();
      }

      Pre-thanks to anyone that can fix this…

      Marcus

    • #3369
      Marcus
      Member

      Found it, solved it.

      It’s a BUG with windows and localhost installs.
      The __FILE__ var, doesn’t match the paths that wordpress generates when getting the list of plugins, so I changed the following in the piklist checker code from:

      if(is_admin()) {
      	include_once('piklist-checker/class-piklist-checker.php');
      	if (!piklist_checker::check(__FILE__)) {
      		return;
      	}
      }
      

      To:

      if(is_admin()) {
      	include_once('piklist-checker/class-piklist-checker.php');
      	$local=(strstr(__FILE__,'\\'))?str_replace('\\', '/',__FILE__):__FILE__;
      	if (!piklist_checker::check($local)) {
      		return;
      	}
      }
      

      Bam!:
      Fixed

    • #3381
      Steve
      Keymaster

      @marcus– Thank you for moving this fix into Piklist Checker. The latest version, which now support Windows, is on WordPress.org >

Viewing 2 reply threads
  • The topic ‘Piklist Checker Woes.’ is closed to new replies.