[17307] | 1 | <?php |
---|
[3609] | 2 | /* |
---|
[17307] | 3 | Plugin Name: Embedded Videos |
---|
[3697] | 4 | Version: auto |
---|
[20804] | 5 | Description: Add videos from Dailymotion, Youtube, Vimeo, Wideo and Wat. |
---|
[26470] | 6 | Plugin URI: auto |
---|
| 7 | Author: Mistic |
---|
[17307] | 8 | Author URI: http://www.strangeplanet.fr |
---|
[3609] | 9 | */ |
---|
| 10 | |
---|
[26470] | 11 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
[3609] | 12 | |
---|
[17307] | 13 | global $prefixeTable; |
---|
[3609] | 14 | |
---|
[26470] | 15 | define('GVIDEO_ID', basename(dirname(__FILE__))); |
---|
[20804] | 16 | define('GVIDEO_PATH', PHPWG_PLUGINS_PATH . GVIDEO_ID . '/'); |
---|
| 17 | define('GVIDEO_ADMIN', get_root_url() . 'admin.php?page=plugin-' . GVIDEO_ID); |
---|
[17661] | 18 | define('GVIDEO_TABLE', $prefixeTable.'image_video'); |
---|
[19056] | 19 | define('GVIDEO_VERSION', 'auto'); |
---|
[3609] | 20 | |
---|
| 21 | |
---|
[17661] | 22 | add_event_handler('init', 'gvideo_init'); |
---|
[17678] | 23 | add_event_handler('picture_pictures_data', 'gvideo_prepare_picture'); |
---|
[3609] | 24 | |
---|
[17307] | 25 | if (defined('IN_ADMIN')) |
---|
[3609] | 26 | { |
---|
[17307] | 27 | add_event_handler('get_admin_plugin_menu_links', 'gvideo_admin_menu'); |
---|
[17626] | 28 | add_event_handler('tabsheet_before_select','gvideo_tab', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); |
---|
[17661] | 29 | } |
---|
| 30 | |
---|
[26470] | 31 | add_event_handler('delete_elements', 'gvideo_delete_elements'); |
---|
[17661] | 32 | |
---|
[26470] | 33 | include_once(GVIDEO_PATH . 'include/events.inc.php'); |
---|
[17661] | 34 | |
---|
[26470] | 35 | |
---|
[17661] | 36 | /** |
---|
[26470] | 37 | * init |
---|
[17661] | 38 | */ |
---|
| 39 | function gvideo_init() |
---|
| 40 | { |
---|
[26470] | 41 | global $conf; |
---|
[17383] | 42 | |
---|
[26470] | 43 | include_once(GVIDEO_PATH . 'maintain.inc.php'); |
---|
| 44 | $maintain = new gvideo_maintain(GVIDEO_ID); |
---|
| 45 | $maintain->autoUpdate(GVIDEO_VERSION, 'install'); |
---|
[17661] | 46 | |
---|
| 47 | load_language('plugin.lang', GVIDEO_PATH); |
---|
[26470] | 48 | |
---|
| 49 | $conf['gvideo'] = unserialize($conf['gvideo']); |
---|
[17661] | 50 | } |
---|
[3609] | 51 | |
---|
[17661] | 52 | /** |
---|
| 53 | * admin plugins menu |
---|
| 54 | */ |
---|
| 55 | function gvideo_admin_menu($menu) |
---|
| 56 | { |
---|
[26470] | 57 | $menu[] = array( |
---|
[17661] | 58 | 'NAME' => 'Embedded Videos', |
---|
| 59 | 'URL' => GVIDEO_ADMIN, |
---|
[26470] | 60 | ); |
---|
[17661] | 61 | return $menu; |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * special tabs |
---|
| 66 | */ |
---|
| 67 | function gvideo_tab($sheets, $id) |
---|
| 68 | { |
---|
| 69 | if ($id != 'photo') return $sheets; |
---|
[17626] | 70 | |
---|
[17661] | 71 | $query = ' |
---|
[17626] | 72 | SELECT * |
---|
| 73 | FROM '.GVIDEO_TABLE.' |
---|
| 74 | WHERE picture_id = '.$_GET['image_id'].' |
---|
| 75 | ;'; |
---|
[17661] | 76 | $result = pwg_query($query); |
---|
| 77 | |
---|
| 78 | if (!pwg_db_num_rows($result)) return $sheets; |
---|
[17626] | 79 | |
---|
[17661] | 80 | global $gvideo; |
---|
| 81 | $gvideo = pwg_db_fetch_assoc($result); |
---|
| 82 | |
---|
| 83 | $sheets['gvideo'] = array( |
---|
| 84 | 'caption' => l10n('Video properties'), |
---|
| 85 | 'url' => GVIDEO_ADMIN.'-photo&image_id='.$_GET['image_id'], |
---|
| 86 | ); |
---|
| 87 | unset($sheets['coi'], $sheets['update']); |
---|
| 88 | |
---|
| 89 | return $sheets; |
---|
[13114] | 90 | } |
---|