[27898] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Take A Tour of Your Piwigo |
---|
| 4 | Version: 1.0 |
---|
| 5 | Description: Plugin Personnel |
---|
| 6 | Plugin URI: http://piwigo.org |
---|
| 7 | Author:Piwigo Team |
---|
| 8 | Author URI: |
---|
| 9 | */ |
---|
| 10 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 11 | { |
---|
| 12 | die('Hacking attempt!'); |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | $avalaible_tour = array('first_contact', 'privacy', 'picture_protection'); |
---|
| 16 | |
---|
| 17 | if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN ) |
---|
| 18 | { |
---|
| 19 | pwg_set_session_var('tour_to_launch', $_POST['submited_tour']); |
---|
| 20 | global $TAT_restart; |
---|
| 21 | $TAT_restart=true; |
---|
| 22 | } |
---|
| 23 | elseif ( isset($_GET['tour_ended']) and in_array($_GET['tour_ended'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN ) |
---|
| 24 | { |
---|
| 25 | pwg_unset_session_var('tour_to_launch'); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | if ( pwg_get_session_var('tour_to_launch') and defined('IN_ADMIN') and IN_ADMIN ) |
---|
| 29 | { |
---|
| 30 | add_event_handler('init', 'TAT_add_js_css'); |
---|
| 31 | } |
---|
| 32 | function TAT_add_js_css() |
---|
| 33 | { |
---|
| 34 | global $template, $TAT_restart; |
---|
| 35 | $tour_to_launch=pwg_get_session_var('tour_to_launch'); |
---|
| 36 | load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/'); |
---|
| 37 | $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl'); |
---|
| 38 | $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248 |
---|
| 39 | if (isset($TAT_restart) and $TAT_restart) |
---|
| 40 | { |
---|
| 41 | $TAT_restart=false; |
---|
| 42 | $template->assign('TAT_restart',true); |
---|
| 43 | } |
---|
| 44 | $tat_path=str_replace(basename($_SERVER['SCRIPT_NAME']),'', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']); |
---|
| 45 | //$tat_path=$_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; |
---|
| 46 | $template->assign('TAT_path', $tat_path); |
---|
| 47 | $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl'); |
---|
| 48 | $template->parse('TAT_tour_tpl'); |
---|
| 49 | unset($tour_to_launch); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | if ( defined('IN_ADMIN') and IN_ADMIN ) |
---|
| 53 | { |
---|
| 54 | /* first contact */ |
---|
| 55 | add_event_handler('loc_end_element_set_global', 'TAT_FC_14'); |
---|
| 56 | add_event_handler('loc_end_picture_modify', 'TAT_FC_16'); |
---|
| 57 | add_event_handler('loc_end_picture_modify', 'TAT_FC_17'); |
---|
| 58 | add_event_handler('loc_end_cat_modify', 'TAT_FC_23'); |
---|
| 59 | add_event_handler('loc_end_themes_installed', 'TAT_FC_35'); |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | function TAT_FC_14() { |
---|
| 63 | global $template; |
---|
| 64 | $template->set_prefilter('batch_manager_global', 'TAT_FC_14_prefilter'); |
---|
| 65 | } |
---|
| 66 | function TAT_FC_14_prefilter ($content, &$smarty) { |
---|
| 67 | $search = '<span class="wrap2'; |
---|
| 68 | $replacement = '{counter print=false assign=TAT_FC_14}<span {if $TAT_FC_14==1}id="TAT_FC_14"{/if} class="wrap2'; |
---|
| 69 | return str_replace($search, $replacement, $content); |
---|
| 70 | } |
---|
| 71 | function TAT_FC_16() { |
---|
| 72 | global $template; |
---|
| 73 | $template->set_prefilter('picture_modify', 'TAT_FC_16_prefilter'); |
---|
| 74 | } |
---|
| 75 | function TAT_FC_16_prefilter ($content, &$smarty) { |
---|
| 76 | $search = '<strong>{\'Linked albums\'|@translate}</strong>'; |
---|
| 77 | $replacement = '<span id="TAT_FC_16"><strong>{\'Linked albums\'|@translate}</strong></span>'; |
---|
| 78 | return str_replace($search, $replacement, $content); |
---|
| 79 | } |
---|
| 80 | function TAT_FC_17() { |
---|
| 81 | global $template; |
---|
| 82 | $template->set_prefilter('picture_modify', 'TAT_FC_17_prefilter'); |
---|
| 83 | } |
---|
| 84 | function TAT_FC_17_prefilter ($content, &$smarty) { |
---|
| 85 | $search = '<strong>{\'Representation of albums\'|@translate}</strong>'; |
---|
| 86 | $replacement = '<span id="TAT_FC_17"><strong>{\'Representation of albums\'|@translate}</strong></span>'; |
---|
| 87 | return str_replace($search, $replacement, $content); |
---|
| 88 | } |
---|
| 89 | function TAT_FC_23() { |
---|
| 90 | global $template; |
---|
| 91 | $template->set_prefilter('album_properties', 'TAT_FC_23_prefilter'); |
---|
| 92 | } |
---|
| 93 | function TAT_FC_23_prefilter ($content, &$smarty) { |
---|
| 94 | $search = '<strong>{\'Lock\'|@translate}</strong>'; |
---|
| 95 | $replacement = '<span id="TAT_FC_23"><strong>{\'Lock\'|@translate}</strong></span>'; |
---|
| 96 | return str_replace($search, $replacement, $content); |
---|
| 97 | } |
---|
| 98 | function TAT_FC_35() { |
---|
| 99 | global $template; |
---|
| 100 | $template->set_prefilter('themes', 'TAT_FC_35_prefilter'); |
---|
| 101 | } |
---|
| 102 | function TAT_FC_35_prefilter ($content, &$smarty) { |
---|
| 103 | $search = '<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip"'; |
---|
| 104 | $replacement = '{counter print=false assign=TAT_FC_35}<a href="{$set_default_baseurl}{$theme.ID}" class="tiptip" {if $TAT_FC_35==1}id="TAT_FC_35"{/if}'; |
---|
| 105 | return str_replace($search, $replacement, $content); |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | /* |
---|
| 109 | add_event_handler('init', 'TAT_add_js_css'); |
---|
| 110 | function TAT_add_js_css() |
---|
| 111 | { |
---|
| 112 | $avalaible_tour = array('first_contact', 'privacy', 'picture_protection'); |
---|
| 113 | |
---|
| 114 | if ( isset($_POST['submited_tour']) and in_array($_POST['submited_tour'], $avalaible_tour) and defined('IN_ADMIN') and IN_ADMIN ) |
---|
| 115 | { |
---|
| 116 | $tour_to_launch = $_POST['submited_tour']; |
---|
| 117 | } |
---|
| 118 | global $template; |
---|
| 119 | load_language('plugin.lang', PHPWG_PLUGINS_PATH .'TakeATour/'); |
---|
| 120 | $template->set_filename('TAT_js_css', PHPWG_PLUGINS_PATH.'TakeATour/tpl/js_css.tpl'); |
---|
| 121 | $template->parse('TAT_js_css');//http://piwigo.org/forum/viewtopic.php?id=23248 |
---|
| 122 | $template->set_filename('TAT_tour_tpl', PHPWG_PLUGINS_PATH.'TakeATour/tpl/'.$tour_to_launch.'.tpl'); |
---|
| 123 | $template->parse('TAT_tour_tpl'); |
---|
| 124 | }*/ |
---|
| 125 | add_event_handler('get_admin_plugin_menu_links', 'TAT_admin_menu' ); |
---|
| 126 | function TAT_admin_menu($menu) |
---|
| 127 | { |
---|
| 128 | array_push($menu, array( |
---|
| 129 | 'NAME' => 'Take a Tour', |
---|
| 130 | 'URL' => get_root_url().'admin.php?page=plugin-TakeATour' |
---|
| 131 | ) |
---|
| 132 | ); |
---|
| 133 | return $menu; |
---|
| 134 | } |
---|
| 135 | ?> |
---|