If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Zen Cart Code Suggestions / Mobile Detect version included with ZC distribution

Mobile Detect version included with ZC distribution

Started by torvista on 7 Nov 2016, 9:40 AM · Views: 94

Results 1 to 3 of 3
7 Nov 2016, 9:40 AM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Mobile Detect version included with ZC distribution

As far as I can see, the class
/includes/classes/Mobile_Detect.php
is the almost identical file from
http://mobiledetect.net/

with one change: the version number that is shown in the authors file,
eg:

has been replaced with a Zen Cart one:

  • @version $Id: Author: DrByte Sun Dec 13 16:32:43 2015 -0500 New in v1.5.5 $
    */

Since this file is updated outside of the Zen Cart development cycle and store owners may want to always use the latest version, I think the removal of the true version number is unhelpful for comparison purposes.

I note the version included with ZC155b a couple of days ago is actually 2.8.17, released in 17/09/2015.
That is already five versions behind the current version 2.8.22 released 24/04/2016.

An admin notification of a new version would be ideal.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

7 Nov 2016, 7:04 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Mobile Detect version included with ZC distribution

torvista:

Since this file is updated outside of the Zen Cart development cycle and store owners may want to always use the latest version, I think the removal of the true version number is unhelpful for comparison purposes.Ya, that was an error in the automated version stamping process.

torvista:

I note the version included with ZC155b a couple of days ago is actually 2.8.17, released in 17/09/2015.
That is already five versions behind the current version 2.8.22 released 24/04/2016.Oops. One more dependency I wish we hadn't embraced. It's a constantly moving target.

torvista:

An admin notification of a new version would be ideal.Feel free to offer a plugin if you want to maintain it.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Dec 2016, 3:43 PM
#3
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: Mobile Detect version included with ZC distribution

Well adding a programmatic check for a new version appears to be more difficult than I expected (I won't say impossible but...), so I just added extra info to the admin as a manual reminder to check now and again.

Attachment 16836

In YOUR_ADMIN/includes/header.php

<div class="hidden-xs col-sm-3 col-sm-push-6 noprint adminHeaderAlerts">    <?php if ($new_version) { ?>
        <?php echo $new_version; ?><br/>
        <?php echo '(' . TEXT_CURRENT_VER_IS . ' v' . PROJECT_VERSION_MAJOR . '.' . PROJECT_VERSION_MINOR . (PROJECT_VERSION_PATCH1 != '' ? 'p' . PROJECT_VERSION_PATCH1 : '') . ')'; ?>
    <?php } ?>
    
    <?php //steve bof check Mobile_Detect
    $mobile_detect_file = DIR_FS_CATALOG . DIR_WS_CLASSES . 'Mobile_Detect.php';
    if ( file_exists($mobile_detect_file) ){
    include($mobile_detect_file);
    $mobile_detect_version = Mobile_Detect::VERSION;
    $mobile_detect_date = date("d/m/Y", filectime($mobile_detect_file));
    echo '<br />using <a href="https://github.com/serbanghita/Mobile-Detect/releases" target="_blank" title="Check GitHub for the latest version">Mobile Detect</a> v' . $mobile_detect_version . ' ' . $mobile_detect_date;
    }//eof ?>
</div>

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...