| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: flickr.inc,v 1.1.2.3.2.2 2008/11/21 23:25:30 jeffcd Exp $ 3 4 /** 5 * @file 6 * Flickr plugin for the YUI Editor. 7 */ 8 9 /** 10 * Menu-callback for flickr API interaction. 11 */ 12 function yui_editor_flickr() { 13 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 14 header('Last-Modified: '. gmdate('D, d M Y H:i:s') .' GMT'); 15 header('Cache-Control: no-store, no-cache, must-revalidate'); 16 header('Cache-Control: post-check=0, pre-check=0', FALSE); 17 header('Content-Type:text/xml'); 18 19 $tags = $_GET['tags']; 20 $key = $_GET['flickr_api_key']; 21 $url = "http://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=$key&machine_tag_mode=any&tags=$tags"; 22 23 function get_resource($url) { 24 $ch = curl_init(); 25 curl_setopt($ch, CURLOPT_URL, $url); 26 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 27 28 $result = curl_exec($ch); 29 curl_close($ch); 30 31 return $result; 32 } 33 34 print get_resource($url); 35 exit; 36 } 37 38 function yui_editor_flickr_menu(&$items) { 39 $items['yui_editor/flickr'] = array( 40 'page callback' => 'yui_editor_flickr', 41 'access callback' => 'user_access', 42 'access arguments' => array('Access YUI editor'), 43 'type' => MENU_CALLBACK, 44 ); 45 } 46 47 function yui_editor_flickr_settings(&$form, &$profile) { 48 $form['plugins']['flickr'] = array( 49 '#type' => 'checkbox', 50 '#title' => t('Flickr image insert'), 51 '#default_value' => $profile['flickr'], 52 '#description' => t('Allows flickr images to be browsed and inserted.'), 53 ); 54 $form['plugins']['flickr_api_key'] = array( 55 '#type' => 'textfield', 56 '#title' => t('Flickr API key'), 57 '#default_value' => $profile['flickr_api_key'], 58 '#size' => 20, 59 '#description' => t('Enter your flickr API key if you turned on the \'flickr image insert\' feature.'), 60 ); 61 } 62 63 function yui_editor_flickr_render(&$profile) { 64 if ($profile['flickr'] == 1) { 65 drupal_add_js(drupal_get_path('module', 'yui_editor') .'/plugins/flickr.js', 'module', 'footer'); 66 drupal_add_css(drupal_get_path('module', 'yui_editor') .'/plugins/flickr.css'); 67 } 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |