my_config['ImageButton'] == 8) || (empty($page['category']) && $this->my_config['HomeButton'] == 8) || (isset($page['category']) && $this->my_config['CategoryButton'] == 8) ) // $cssfile = ''; $cssfile = ''; } if (isset($cssfile)) $template->append('head_elements',$cssfile); } // Add Addthis icon function add_AddThis_icon() { global $template, $page, $user; include ADDTHIS_INC_PATH.'constants.inc.php'; if ($this->my_config['addthis_languser']) // langue de l'utilisateur { $research = pwg_query('SELECT language FROM '.USER_INFOS_TABLE.' WHERE user_id = '.$user['id'].';'); $defaultlanguage = mysql_fetch_array($research); $defaultlanguage = substr($defaultlanguage[0], 0, 2); if (in_array($defaultlanguage, $language_list[0])) $this->my_config['addthis_language'] = $defaultlanguage; } $addthis_img_src = array( '', 'Share', 'Share', 'Bookmark', 'Bookmark', 'Add This', 'AddThis', '' ); // Taille des boutons $addthis_img_size = array( '', '125', '83', '123', '83', '125', '16', ''); $addthis_option = ''; $addthis_img = 0; if (isset($page['section']) && ($page['section']) == 'categories') { // image if (isset($page['image_id'])) { $addthis_img = $this->my_config['ImageButton']; } // Page accueil elseif( empty($page['category'])) { $addthis_img = $this->my_config['HomeButton']; } elseif (isset($page['category'])) { $addthis_img = $this->my_config['CategoryButton']; } } // pas d'affichage sur selection = 'desactive' ou si selection = 'icones' if ($addthis_img > 0 && $addthis_img < 9) { foreach ($this->my_config['addthis_options'] as $key => $value) { if ($value == true) { if (strlen($addthis_option) != 0) $addthis_option .= ', '; $addthis_option .= $key; } } $tpl_code = (isset($page['image_id']) ? "\n" :"\n
  • ") .''; $tpl_code .= '' ."\n" .$addthis_img_src[$addthis_img] ."\n" // si selection du 7 .($addthis_img == 7 ? (strlen($this->my_config['addthis_icon_text']) != 0 ? $this->my_config['addthis_icon_text'] : 'Share' ) : '') ."\n" .'' ."\n" .(isset($page['image_id']) ? '' :'
  • '); } else if ($addthis_img == 8) { $tpl_code .= ''; $tpl_code .= ' ' ."\n"; $nb_icons = 1; $tpl_code .= (isset($page['image_id']) ? '' : '
  • '); $tpl_code .= '
    '; foreach ($this->my_config['addthis_options'] as $key => $value) { if ($nb_icons <= $this->my_config['addthis_icon_nb']) { if ($value == true) { $nb_icons++; if ($key == "more") { $tpl_code .='|'; $tpl_code .=''; } else $tpl_code .=''; } } } // $tpl_code .= ''."\n"; $tpl_code .= ''."\n"; $tpl_code .= (isset($page['image_id']) ? '' : '
  • '); } } if (isset($tpl_code)) { if (isset($page['image_id'])) $template->concat('PLUGIN_PICTURE_ACTIONS', $tpl_code); else $template->concat('PLUGIN_INDEX_ACTIONS', $tpl_code); } } /* Loading of the configuration file - If not exist -> load default values */ function load_config() { $x = @file_get_contents( ADDTHIS_CFG_FILE ); if ($x!==false) { $c = unserialize($x); $this->my_config = $c; } // Init default value for the config file $this->load_default_config(); } /* Saving of the configuration file with data */ function save_config() { $file = fopen( ADDTHIS_CFG_FILE, 'w' ); fwrite($file, serialize($this->my_config) ); fclose( $file ); } private function load_default_config() { include ADDTHIS_INC_PATH.'default_values.inc.php'; foreach ($addthis_default_values as $key => $value) { if (!isset($this->my_config[$key])) $this->my_config[$key] = $value; if ($key = 'addthis_options') { foreach ($addthis_default_values[$key] as $subkey => $subvalue) if (!isset($this->my_config[$key][$subkey])) $this->my_config[$key][$subkey] = $subvalue; } } } function restore_default_config() { include ADDTHIS_INC_PATH.'default_values.inc.php'; foreach ($addthis_default_values as $key => $value) { $this->my_config[$key] = $value; } } function AddThis_admin_menu($menu) { array_push($menu, array( 'NAME' => 'AddThis', 'URL' => get_admin_plugin_menu_link(ADDTHIS_ADMIN_PATH.'AddThis_admin.php') ) ); return $menu; } } ?>