[4270] | 1 | <?php |
---|
| 2 | /* ----------------------------------------------------------------------------- |
---|
| 3 | Plugin : UserStat |
---|
| 4 | Author : Grum |
---|
| 5 | email : grum@piwigo.org |
---|
| 6 | website : http://photos.grum.fr |
---|
| 7 | |
---|
| 8 | << May the Little SpaceFrog be with you ! >> |
---|
| 9 | ------------------------------------------------------------------------------ |
---|
| 10 | See main.inc.php for release information |
---|
| 11 | |
---|
| 12 | UserStat_AIM : classe to manage plugin integration into plugin menu |
---|
| 13 | |
---|
| 14 | --------------------------------------------------------------------------- */ |
---|
| 15 | |
---|
| 16 | if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } |
---|
| 17 | |
---|
[5549] | 18 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php'); |
---|
| 19 | include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php'); |
---|
[4270] | 20 | |
---|
[5549] | 21 | class UserStat_AIM extends CommonPlugin |
---|
[4270] | 22 | { |
---|
| 23 | protected $css = null; |
---|
| 24 | |
---|
[5549] | 25 | public function __construct($prefixeTable, $filelocation) |
---|
[4270] | 26 | { |
---|
[5549] | 27 | $this->setPluginName("UserStat"); |
---|
| 28 | $this->setPluginNameFiles("userstat"); |
---|
[4270] | 29 | parent::__construct($prefixeTable, $filelocation); |
---|
[5549] | 30 | $this->css = new GPCCss(dirname($this->getFileLocation()).'/'.$this->getPluginNameFiles().".css"); |
---|
[4270] | 31 | } |
---|
| 32 | |
---|
[5549] | 33 | public function __destruct() |
---|
| 34 | { |
---|
| 35 | unset($this->css); |
---|
| 36 | parent::__destruct(); |
---|
| 37 | } |
---|
| 38 | |
---|
[4270] | 39 | /* |
---|
| 40 | initialize events call for the plugin |
---|
| 41 | */ |
---|
[5549] | 42 | function initEvents() |
---|
[4270] | 43 | { |
---|
[5549] | 44 | add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') ); |
---|
[4270] | 45 | } |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | /* |
---|
| 49 | initialization of config properties |
---|
| 50 | */ |
---|
[5549] | 51 | function initConfig() |
---|
[4270] | 52 | { |
---|
[5549] | 53 | $this->config=array( |
---|
[4270] | 54 | 'UserStat_MouseOverColor' => '303030', |
---|
| 55 | /*'AStat_BarColor_Pages' => '6666ff', |
---|
| 56 | 'AStat_BarColor_Img' => '66ff66', |
---|
| 57 | 'AStat_BarColor_IP' => 'ff6666', |
---|
| 58 | 'AStat_NpIPPerPages' => '25', |
---|
| 59 | 'AStat_NpCatPerPages' => '50', |
---|
| 60 | 'AStat_MaxBarWidth' => '400', |
---|
| 61 | 'AStat_default_period' => 'global', //global, all, year, month, day |
---|
| 62 | 'AStat_ShowThumbCat' => 'true', |
---|
| 63 | 'AStat_DefaultSortCat' => 'page', //page, picture, nbpicture |
---|
| 64 | 'AStat_ShowThumbImg' => 'true', |
---|
| 65 | 'AStat_DefaultSortImg' => 'picture', //picture, catname |
---|
| 66 | 'AStat_NbImgPerPages' => '100', |
---|
| 67 | 'AStat_BarColor_Cat' => 'fff966', |
---|
| 68 | 'AStat_DefaultSortIP' => 'page', //page, ip, picture |
---|
| 69 | 'AStat_SeeTimeRequests' => 'false', |
---|
| 70 | 'AStat_BlackListedIP' => '', // ip blacklisted (separator : ",") |
---|
| 71 | 'AStat_UseBlackList' => 'false' // if false, blacklist usage is disabled, if "invert" then result are inverted*/ |
---|
| 72 | ); |
---|
| 73 | |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | /* |
---|
[5549] | 77 | surchage of CommonPlugin->saveConfig function |
---|
[4270] | 78 | */ |
---|
[5549] | 79 | function loadConfig() |
---|
[4270] | 80 | { |
---|
[5549] | 81 | parent::loadConfig(); |
---|
| 82 | if(!$this->css->fileExists()) |
---|
[4270] | 83 | { |
---|
[5549] | 84 | $this->css->makeCSS($this->generate_CSS()); |
---|
[4270] | 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | /* |
---|
[5549] | 89 | surchage of CommonPlugin->saveConfig function |
---|
[4270] | 90 | */ |
---|
[5549] | 91 | function saveConfig() |
---|
[4270] | 92 | { |
---|
[5549] | 93 | if(parent::saveConfig()) |
---|
[4270] | 94 | { |
---|
[5549] | 95 | $this->css->makeCSS($this->generate_CSS()); |
---|
[4270] | 96 | return(true); |
---|
| 97 | } |
---|
| 98 | return(false); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | /* |
---|
| 102 | generate the css code |
---|
| 103 | */ |
---|
| 104 | function generate_CSS() |
---|
| 105 | { |
---|
| 106 | $text = " |
---|
[5549] | 107 | .StatTableRow:hover { background-color:#".$this->config['UserStat_MouseOverColor']."; } |
---|
[4270] | 108 | .formtable, .formtable P { text-align:left; display:block; } |
---|
| 109 | .formtable tr { vertical-align:top; } |
---|
| 110 | .invisible { visibility:hidden; display:none; } |
---|
| 111 | .littlefont { font-size:90%; } |
---|
| 112 | table.table2.littlefont td { text-align:center;padding:0px;padding-left:3px;padding-right:3px; } |
---|
| 113 | .throw { line-height:auto; font-size:100%; } |
---|
| 114 | table.table2 tr.throw { height:26px; } |
---|
| 115 | table.table2 td.toLeft { text-align:left; } |
---|
| 116 | div.table { margin-bottom:15px; } |
---|
| 117 | pointerHand { cursor:pointer; } |
---|
| 118 | "; |
---|
| 119 | |
---|
| 120 | return($text); |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | /* --------------------------------------------------------------------------- |
---|
| 124 | Function needed for plugin activation |
---|
| 125 | --------------------------------------------------------------------------- */ |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | } // UserStat_Plugin class |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | ?> |
---|