Plugin Directory

Changeset 2243958

Timestamp:
02/13/2020 03:24:22 PM (4 years ago)
Author:
Hellstrom
Message:

1.7

  • Implemented modern widget look following website relaunch.
Location:
i-plant-a-tree
Files:
14 added
4 edited

Legend:

Unmodified
Added
Removed
  • i-plant-a-tree/tags/1.7/iplantatree.php

    r2232879 r2243958  
    66Description: This plugin shows the count of planted trees via "I Plant A Tree", as well as saved CO2.
    77Author: Micha
    8 Version: 1.6
     8Version: 1.
    99Author URI: https://lightframefx.de
    1010URI: https://lightframefx.de
    1111Tags: ipat,widget,i plant a tree
    1212Requires at least: 4.2.2
    13 Tested up to: 5.1
     13Tested up to: 5.
    1414License: GPLv3
    1515License URI: https://www.gnu.org/licenses/gpl-3.0
     
    236236                <tr>
    237237                    <th scope="row">
    238                         <label for="ipat_userID">IPAT <?php _e('user ID','i-plant-a-tree');?></label>
    239                     </th>
    240                     <td colspan="4">
    241                         <input id="ipat_userID" class="regular-text" type="text" value="<?php echo $ipat_userID; ?>" name="ipat_userID">
    242                     </td>
    243                 </tr>
    244                 <tr>
    245                     <th scope="row">
    246238                        <label for="ipat_teamID">IPAT <?php _e('team ID','i-plant-a-tree');?></label>
    247239                    </th>
  • i-plant-a-tree/trunk/assets/css/ipat_style.css

    r1902142 r2243958  
    151151    border:none;
    152152}
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
     481
     482
     483
     484
     485
     486
     487
     488
     489
     490
     491
     492
     493
     494
     495
     496
     497
     498
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
  • i-plant-a-tree/trunk/iplantatree.php

    r2047318 r2243958  
    66Description: This plugin shows the count of planted trees via "I Plant A Tree", as well as saved CO2.
    77Author: Micha
    8 Version: 1.6
     8Version: 1.
    99Author URI: https://lightframefx.de
    1010URI: https://lightframefx.de
    1111Tags: ipat,widget,i plant a tree
    1212Requires at least: 4.2.2
    13 Tested up to: 5.1
     13Tested up to: 5.
    1414License: GPLv3
    1515License URI: https://www.gnu.org/licenses/gpl-3.0
     
    158158                default: $widgetImageSize='120x190'; break;
    159159            }
    160             $widgetHTML=ipat_generateWidgetHTML($ipat_settings['widgetType'],'shortcodeAlign_'.$atts['align'],$ipat_settings['isTeamWidget'],$ipat_settings['userID'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],$atts['class']);
     160            $widgetHTML=ipat_generateWidgetHTML($ipat_settings['widgetType'],'shortcodeAlign_'.$atts['align'],$ipat_settings['isTeamWidget'],$ipat_settings['user'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],$atts['class']);
    161161            return $widgetHTML;
    162162        }
     
    204204        if($_POST['ipat_isTeamWidget']=='true') $ipat_settings['isTeamWidget']=true;
    205205        $ipat_settings['remoteHost']=get_bloginfo('wpurl');
    206         $ipat_settings['widgetType']=intval($_POST['ipat_widgetType'],10);
    207         if ($ipat_settings['widgetType']==0) $ipat_settings['widgetType']=1;
     206        //$ipat_settings['widgetType']=intval($_POST['ipat_widgetType'],10);
     207        $ipat_settings['widgetType']=wp_strip_all_tags($_POST['ipat_widgetType'],true);
     208        if ($ipat_settings['widgetType']=='') $ipat_settings['widgetType']='1';
    208209        $ipat_language=sanitize_text_field($_POST['ipat_language']);
    209210        $ipat_supportedLanguages=array('de','en','it');
     
    235236                <tr>
    236237                    <th scope="row">
    237                         <label for="ipat_userID">IPAT <?php _e('user ID','i-plant-a-tree');?></label>
    238                     </th>
    239                     <td colspan="4">
    240                         <input id="ipat_userID" class="regular-text" type="text" value="<?php echo $ipat_userID; ?>" name="ipat_userID">
    241                     </td>
    242                 </tr>
    243                 <tr>
    244                     <th scope="row">
    245238                        <label for="ipat_teamID">IPAT <?php _e('team ID','i-plant-a-tree');?></label>
    246239                    </th>
     
    274267                <tr class="ipat_widgetType">
    275268                    <th scope="row">
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
    276298                        <label for="ipat_widgetType"><?php _e('widget type','i-plant-a-tree');?></label>
    277299                    </th>
    278300                    <td>
    279                         <input type="radio" <?php if ($ipat_settings['widgetType']==1) echo 'checked="checked"';?> value="1" name="ipat_widgetType"><span class="m-l">120 x 190 px</span><br/>
    280                         <?php
    281                             echo ipat_generateWidgetHTML(1,'',$ipat_settings['isTeamWidget'],$ipat_settings['userID'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
    282                         ?>
    283                     </td>
    284                     <td>
    285                         <input type="radio" <?php if ($ipat_settings['widgetType']==2) echo 'checked="checked"';?> value="2" name="ipat_widgetType"><span class="m-l">220 x 90 px</span><br/>
    286                         <?php
    287                             echo ipat_generateWidgetHTML(2,'',$ipat_settings['isTeamWidget'],$ipat_settings['userID'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
    288                         ?>
    289                     </td>
    290                     <td>
    291                         <input type="radio" <?php if ($ipat_settings['widgetType']==3) echo 'checked="checked"';?> value="3" name="ipat_widgetType"><span class="m-l">100 x 150 px</span><br/>
    292                         <?php
    293                             echo ipat_generateWidgetHTML(3,'',$ipat_settings['isTeamWidget'],$ipat_settings['userID'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
    294                         ?>
    295                     </td>
    296                     <td>
    297                         <input type="radio" <?php if ($ipat_settings['widgetType']==4) echo 'checked="checked"';?> value="4" name="ipat_widgetType"><span class="m-l">180 x 80 px</span><br/>
    298                         <?php
    299                             echo ipat_generateWidgetHTML(4,'',$ipat_settings['isTeamWidget'],$ipat_settings['userID'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     301                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_100x100') echo 'checked="checked"';?> value="white_100x100" name="ipat_widgetType"><span class="m-l">100×100 px</span><br/>
     302                        <?php
     303                            echo ipat_generateWidgetHTML('white_100x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     304                        ?>
     305                    </td>
     306                    <td>
     307                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_200x100') echo 'checked="checked"';?> value="white_200x100" name="ipat_widgetType"><span class="m-l">200×100 px</span><br/>
     308                        <?php
     309                            echo ipat_generateWidgetHTML('white_200x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     310                        ?>
     311                    </td>
     312                    <td>
     313                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_300x100') echo 'checked="checked"';?> value="white_300x100" name="ipat_widgetType"><span class="m-l">300×100 px</span><br/>
     314                        <?php
     315                            echo ipat_generateWidgetHTML('white_300x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     316                        ?>
     317                    </td>
     318                    <td>
     319                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_400x100') echo 'checked="checked"';?> value="white_400x100" name="ipat_widgetType"><span class="m-l">400×100 px</span><br/>
     320                        <?php
     321                            echo ipat_generateWidgetHTML('white_400x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     322                        ?>
     323                    </td>
     324                </tr>
     325                <tr class="ipat_widgetType">
     326                    <th>
     327                    </th>
     328                    <td>
     329                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_100x100') echo 'checked="checked"';?> value="green_100x100" name="ipat_widgetType"><span class="m-l">100×100 px</span><br/>
     330                        <?php
     331                            echo ipat_generateWidgetHTML('green_100x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     332                        ?>
     333                    </td>
     334                    <td>
     335                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_200x100') echo 'checked="checked"';?> value="green_200x100" name="ipat_widgetType"><span class="m-l">200×100 px</span><br/>
     336                        <?php
     337                            echo ipat_generateWidgetHTML('green_200x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     338                        ?>
     339                    </td>
     340                    <td>
     341                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_300x100') echo 'checked="checked"';?> value="green_300x100" name="ipat_widgetType"><span class="m-l">300×100 px</span><br/>
     342                        <?php
     343                            echo ipat_generateWidgetHTML('green_300x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     344                        ?>
     345                    </td>
     346                    <td>
     347                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_400x100') echo 'checked="checked"';?> value="green_400x100" name="ipat_widgetType"><span class="m-l">400×100 px</span><br/>
     348                        <?php
     349                            echo ipat_generateWidgetHTML('green_400x100','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     350                        ?>
     351                    </td>
     352                </tr>
     353                <tr class="ipat_widgetType">
     354                    <th>
     355                    </th>
     356                    <td>
     357                    </td>
     358                    <td>
     359                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_100x200') echo 'checked="checked"';?> value="white_100x200" name="ipat_widgetType"><span class="m-l">100×200 px</span><br/>
     360                        <?php
     361                            echo ipat_generateWidgetHTML('white_100x200','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     362                        ?>
     363                    </td>
     364                    <td>
     365                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_100x300') echo 'checked="checked"';?> value="white_100x300" name="ipat_widgetType"><span class="m-l">100×300 px</span><br/>
     366                        <?php
     367                            echo ipat_generateWidgetHTML('white_100x300','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     368                        ?>
     369                    </td>
     370                    <td>
     371                        <input type="radio" <?php if ($ipat_settings['widgetType']=='white_100x400') echo 'checked="checked"';?> value="white_100x400" name="ipat_widgetType"><span class="m-l">100×400 px</span><br/>
     372                        <?php
     373                            echo ipat_generateWidgetHTML('white_100x400','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     374                        ?>
     375                    </td>
     376                </tr>
     377                <tr class="ipat_widgetType">
     378                    <th>
     379                    </th>
     380                    <td>
     381                    </td>
     382                    <td>
     383                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_100x200') echo 'checked="checked"';?> value="green_100x200" name="ipat_widgetType"><span class="m-l">100×200 px</span><br/>
     384                        <?php
     385                            echo ipat_generateWidgetHTML('green_100x200','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     386                        ?>
     387                    </td>
     388                    <td>
     389                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_100x300') echo 'checked="checked"';?> value="green_100x300" name="ipat_widgetType"><span class="m-l">100×300 px</span><br/>
     390                        <?php
     391                            echo ipat_generateWidgetHTML('green_100x300','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     392                        ?>
     393                    </td>
     394                    <td>
     395                        <input type="radio" <?php if ($ipat_settings['widgetType']=='green_100x400') echo 'checked="checked"';?> value="green_100x400" name="ipat_widgetType"><span class="m-l">100×400 px</span><br/>
     396                        <?php
     397                            echo ipat_generateWidgetHTML('green_100x400','',$ipat_settings['isTeamWidget'],$ipat_settings['userName'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
    300398                        ?>
    301399                    </td>
     
    309407                        <input type="radio" <?php if ($ipat_settings['refreshInterval']==240) {echo 'checked="checked"'; $ipat_intervalChecked=true;} ?> value="240" name="ipat_refreshInterval"><span class="m-l"><?php _e('4 hours','i-plant-a-tree');?></span>
    310408                        <input type="radio" <?php if ($ipat_settings['refreshInterval']==720) {echo 'checked="checked"'; $ipat_intervalChecked=true;}?> value="720" name="ipat_refreshInterval"><span class="m-l"><?php _e('12 hours','i-plant-a-tree');?></span>
    311                         <input type="radio" <?php if ($ipat_settings['refreshInterval']==1440 || !$ipat_intervalChecked) echo 'checked="checked"';?> value="1440" name="ipat_refreshInterval"><span class="m-l"><?php _e('24 hours','i-plant-a-tree');?></span>
     409                        <input type="radio" <?php if ($ipat_settings['refreshInterval']==1440) {echo 'checked="checked"'; $ipat_intervalChecked=true;}?> value="1440" name="ipat_refreshInterval"><span class="m-l"><?php _e('24 hours','i-plant-a-tree');?></span>
     410                        <input type="radio" <?php if ($ipat_settings['refreshInterval']==10080 || !$ipat_intervalChecked) echo 'checked="checked"';?> value="10080" name="ipat_refreshInterval"><span class="m-l"><?php _e('weekly','i-plant-a-tree');?></span>
    312411                        <p class="description"><?php _e('The update interval determines how often new data will be gotten from server. Usually a daily update will do.','i-plant-a-tree');?></p>
    313412                    </td>
     
    393492        $co2Saving=$widget->{"co2"};
    394493        $ipat_settings['lastUpdate']=time();
    395         if ((!$ipat_settings['isTeamWidget'] && $ipat_settings['userID']==0) || ($ipat_settings['isTeamWidget'] && $ipat_settings['teamID']==0)) {
    396             $ipat_settings['treeCount']=0;
     494        if ((!$ipat_settings['isTeamWidget'] && $ipat_settings['userID']==0) || ($ipat_settings['isTeamWidget'] && $ipat_settings['teamID']==0)) {
     495            $ipat_settings['treeCount']=;
    397496            $ipat_settings['co2Saving']=0;
    398497        } else {
     
    415514    $ipat_sidebarWidgetHTML.='<p>';
    416515
    417     $ipat_sidebarWidgetHTML.=ipat_generateWidgetHTML($ipat_settings['widgetType'],$ipat_settings['widgetControlAlign'],$ipat_settings['isTeamWidget'],$ipat_settings['userID'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
     516    $ipat_sidebarWidgetHTML.=ipat_generateWidgetHTML($ipat_settings['widgetType'],$ipat_settings['widgetControlAlign'],$ipat_settings['isTeamWidget'],$ipat_settings['user'],$ipat_settings['teamID'],$ipat_settings['treeCount'],$ipat_settings['co2Saving'],'');
    418517
    419518    $ipat_sidebarWidgetHTML.='</p>';
     
    425524}
    426525
    427 function ipat_generateWidgetHTML($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userID,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass) {
     526function ipat_generateWidgetHTML($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_user,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass) {
    428527    $ipat_sidebarWidgetHTML='';
    429528
    430529    switch ($ipat_widgetType) {
    431         case 2: $widgetImageSize='220x90'; break;
    432         case 3: $widgetImageSize='100x150'; break;
    433         case 4: $widgetImageSize='180x80'; break;
    434         default: $widgetImageSize='120x190'; break;
     530        case '1':
     531            $ipat_sidebarWidgetHTML=ipat_generateWidgetHTML_classic($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass); break;
     532        case '2':
     533            $ipat_sidebarWidgetHTML=ipat_generateWidgetHTML_classic($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass); break;
     534        case '3':
     535            $ipat_sidebarWidgetHTML=ipat_generateWidgetHTML_classic($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass); break;
     536        case '4':
     537            $ipat_sidebarWidgetHTML=ipat_generateWidgetHTML_classic($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass); break;
     538        default:
     539            $ipat_sidebarWidgetHTML=ipat_generateWidgetHTML_modern($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass); break;
     540    }
     541
     542    return $ipat_sidebarWidgetHTML;
     543}
     544
     545function ipat_generateWidgetHTML_modern($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass) {
     546
     547    $ipat_sidebarWidgetHTML='<a ';
     548    if ($ipat_co2Saving>1) {
     549        $ipat_sidebarWidgetHTML.='title="'.round(($ipat_co2Saving*1000),1).' kg" ';
     550    }
     551    if ($ipat_isTeamWidget) {
     552        $ipat_sidebarWidgetHTML.='href="https://www.iplantatree.org/team/'.$ipat_teamID.'" target="_blank" rel="noopener">';
     553    } else {
     554        $ipat_sidebarWidgetHTML.='href="https://www.iplantatree.org/user/'.$ipat_userName.'" target="_blank" rel="noopener">';
     555    }
     556
     557    $ipat_sidebarWidgetHTML.='<div ';
     558    $ipat_sidebarWidgetHTML.='style=background-image:url('.plugins_url().'/'.dirname(plugin_basename(__FILE__)).'/assets/image/ipat_widget_'.$ipat_widgetType.'.svg)';
     559    $ipat_sidebarWidgetHTML.=' class="ipat_widget ipat_widgetType_'.$ipat_widgetType;
     560
     561    switch ($ipat_widgetControlAlign) {
     562        case 'left': $ipat_sidebarWidgetHTML.=' ipat_alignSidebarLeft'; break;
     563        case 'right': $ipat_sidebarWidgetHTML.=' ipat_alignSidebarRight'; break;
     564        case 'center': $ipat_sidebarWidgetHTML.=' ipat_alignSidebarCenter'; break;
     565        case 'shortcodeAlign_left': $ipat_sidebarWidgetHTML.=' ipat_alignLeft'; break;
     566        case 'shortcodeAlign_right': $ipat_sidebarWidgetHTML.=' ipat_alignRight'; break;
     567        case 'shortcodeAlign_center': $ipat_sidebarWidgetHTML.=' ipat_alignCenter'; break;
     568    }
     569    $ipat_sidebarWidgetHTML.=' '.$ipat_extraClass.'">';
     570
     571    $ipat_sidebarWidgetHTML.='<div class="ipat_m_widgetTreeCountTextWrapper">';
     572    $ipat_sidebarWidgetHTML.='<div class="ipat_m_widgetTreeCountText">';
     573    if ($ipat_widgetType=='white_100x100' || $ipat_widgetType=='green_100x100') {
     574        $ipat_sidebarWidgetHTML.=__('trees','i-plant-a-tree').':</div>';
     575    } else {
     576        $ipat_sidebarWidgetHTML.=__('planted trees','i-plant-a-tree').':</div>';
     577    }
     578    $ipat_sidebarWidgetHTML.='<div class="ipat_m_widgetTreeCount">'.$ipat_treeCount.'</div>';
     579    $ipat_sidebarWidgetHTML.='</div>';
     580
     581    $ipat_sidebarWidgetHTML.='<div class="ipat_m_widgetCo2SavingWrapper">';
     582    $ipat_sidebarWidgetHTML.='<div class="ipat_m_widgetCo2SavingText">';
     583    if ($ipat_widgetType=='white_100x100' || $ipat_widgetType=='green_100x100') {
     584        $ipat_sidebarWidgetHTML.='CO<sub>2</sub>:</div>';
     585    } else {
     586        $ipat_sidebarWidgetHTML.=__('CO<sub>2</sub> saved','i-plant-a-tree').':</div>';
     587    }
     588    $ipat_sidebarWidgetHTML.='<div class="ipat_m_widgetCo2Saving">'.ipat_formatHumanReadable($ipat_co2Saving).'</div>';
     589    $ipat_sidebarWidgetHTML.='</div>';
     590
     591    $ipat_sidebarWidgetHTML.='</div>';
     592    $ipat_sidebarWidgetHTML.='</a>';
     593
     594    return $ipat_sidebarWidgetHTML;
     595}
     596
     597function ipat_generateWidgetHTML_classic($ipat_widgetType,$ipat_widgetControlAlign,$ipat_isTeamWidget,$ipat_userName,$ipat_teamID,$ipat_treeCount,$ipat_co2Saving,$ipat_extraClass) {
     598    $ipat_sidebarWidgetHTML='';
     599
     600    switch ($ipat_widgetType) {
     601        case '1': $widgetImageSize='120x190'; break;
     602        case '2': $widgetImageSize='220x90'; break;
     603        case '3': $widgetImageSize='100x150'; break;
     604        case '4': $widgetImageSize='180x80'; break;
    435605    }
    436606
     
    453623        $ipat_sidebarWidgetHTML.='href="https://www.iplantatree.org/team/'.$ipat_teamID.'" target="_blank" rel="noopener">';
    454624    } else {
    455         $ipat_sidebarWidgetHTML.='href="https://www.iplantatree.org/user/'.$ipat_userID.'" target="_blank" rel="noopener">';
     625        $ipat_sidebarWidgetHTML.='href="https://www.iplantatree.org/user/'.$ipat_user.'" target="_blank" rel="noopener">';
    456626    }
    457627
  • i-plant-a-tree/trunk/readme.txt

    r2047331 r2243958  
    33Tags: ipat,widget,i plant a tree
    44Requires at least: 4.2.2
    5 Tested up to: 5.1
    6 Stable tag: 1.6
     5Tested up to: 5.
     6Stable tag: 1.
    77License: GPLv3
    88License URI: https://www.gnu.org/licenses/gpl-3.0
     
    2525
    2626== Changelog ==
     27
     28
     29
    2730
    2831= 1.6 =
     
    98101== Upgrade Notice ==
    99102
    100 = 1.6 =
    101 Aufgrund eines holperigen Webseite-Relaunchs bei IPAT ist es notwendig, deinen Benutzernamen in den Einstellungen einzutragen, damit das Widget wieder funktioniert.
    102 Due to a kind of bumpy website relaunch at IPAT it is neccessary to provide your user name in the settings, to make your widget working again.
     103= 1. =
     104.
     105.
Note: See TracChangeset for help on using the changeset viewer.