Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 22 months ago

#4614 closed enhancement (fixed)

Importer as plugin

Reported by: nazgul's profile Nazgul Owned by: westi's profile westi
Milestone: 2.3 Priority: high
Severity: normal Version: 2.3
Component: General Keywords: needs-patch
Focuses: Cc:

Description

I'm developing a plugin that can be used to show geocaches (and their logs) from within wordpress, by storing them as pages (and comments) and doing some magic while displaying them.

I've also included an importer which you can use to import them from so-called GPX files into Wordpress.

At the moment, they're 2 seperate files, because plugins have to be in wp-content/plugins and importers have to be in wp-admin/importers to work.

Because all user content should be in wp-content and for ease of install, I'd like to combine those 2 file into 1, the plugin file.

The attached patch introduces a new filter which can be used to modify the location where the system searches for it's importer. It also changes the include to a require_once to make sure that it isn't loaded twice (once as importer, once as plugin for example)

I've also attached a simple sample plugin which contains an importer plugin that uses this functionality.

Attachments (3)

importerplugin.php (726 bytes) - added by Nazgul 17 years ago.
Sample importer plugin
4614.diff (665 bytes) - added by Nazgul 17 years ago.
4614.2.diff (761 bytes) - added by westi 17 years ago.
Allow plugins to be importers.

Download all attachments as: .zip

Change History (12)

@Nazgul
17 years ago

Sample importer plugin

@Nazgul
17 years ago

#1 @Nazgul
17 years ago

Small typo in my description. Where I said pages, I meant posts.

#2 follow-up: @Nazgul
17 years ago

Any chance of getting this in 2.3 before we feature freeze it?

#3 in reply to: ↑ 2 @westi
17 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Replying to Nazgul:

Any chance of getting this in 2.3 before we feature freeze it?

I like the idea. Not keen on the solution.

I prefer the new patch I am about to attach.

@westi
17 years ago

Allow plugins to be importers.

#4 @ryan
17 years ago

+1 for westi's patch

#5 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5935]) Allow plugins to register importers. Props westi and Nazgul. fixes #4614

#6 follow-up: @Nazgul
17 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

The current implementation fails for registered import functions which are class members. The function_exists call returns false, because it's testing an array, not the actual function name.

#7 in reply to: ↑ 6 @westi
17 years ago

  • Priority changed from normal to high

Replying to Nazgul:

The current implementation fails for registered import functions which are class members. The function_exists call returns false, because it's testing an array, not the actual function name.

Good catch

I guess we need to check is_array and do some stuff to work out if the class exists then

#8 @westi
17 years ago

Actually is looks like is_callable should do the trick here.
Switching to that instead.

#9 @westi
17 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [6113]) Switch to is_callable instead of function_exists to allow for class based importer plugins. Fixes #4614

Note: See TracTickets for help on using tickets.