tobylewis
Forum Replies Created
-
Hi Micheal
I tried using the form but it says “that file type is not allowed” was sending a .zip
Download it here
https://dl.dropbox.com/u/8839941/flickr-shortcode-importer.zip
~TobyHi Michael
Here are the various edits in one pastebin
Basically they are all whole functions except for a modification of the query in the middle of function user_interface() and the two snippets that go into the settings page.
I guess you will have to test if the curl functions exist and then choose to do the curl or file_get_contents() methods.
HTH
~Toby
One more thing. It would be nice to be able to set the options in the [gallery] shortcode to replace the [flickr] shortcode. Therefore this will add an option to the settings so it can be specified
[ Moderator note: See above note about code formatting. ]
$this->settings['default_gallery_markup'] = array( 'title' => __( 'Default Gallery Markup' , 'flickr-shortcode-importer'), 'desc' => __( 'The shortcode and parameters to replace [flickr] etc with.' , 'flickr-shortcode-importer'), 'std' => '[gallery link="file"]', 'type' => 'text', 'section' => 'general' );
and then in shortcode_flickrset( ) and shortcode_flickr_gallery( )
change the $markup assignment to:$markup = fsi_get_options( 'default_gallery_markup' );
The error was due to there being no titles on the files on flickr. prevent problem by checking $title has a value before using it.
if ($title && fsi_get_options( ‘replace_file_name’ ) ) {
also here is a more robust curl function
function file_get_contents_curl($url) {
$ch = curl_init();curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);$data = curl_exec($ch);
curl_close($ch);return $data;
}