Plugin Directory

Changeset 1008309


Ignore:
Timestamp:
10/16/2014 01:25:11 AM (11 years ago)
Author:
average.technology
Message:

Updated to version 1.1

Location:
average-mobile-detect
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • average-mobile-detect/trunk/average-mobile-detect.php

    r975566 r1008309  
    44    Plugin URI:
    55    Description: Redirects mobile traffic to your mobile website on a page-by-page basis (posts and custom post types included). This can be overridden on any page individually with a convenient meta box adjacent to the WYSIWYG. Sets a cookie to remember which version of your website (desktop or mobile, usually) your visitors opted for. Includes a widget for inserting a link back to your mobile site, which is only generated for mobile devices. Includes two shortcodes for generating links to your mobile site--one is generated only for mobile devices and the other is generated regardless. No CSS rules are used. CSS classes are provided, yielding coders full reign to style the generated links to fit the website theme. Adds a class to the body ("mobile-detected") to help coders write styles specifically for mobile devices. Leaves 404 errors untouched, allowing you to maintain 404 statuses. Basically, it gives you loads of control of your mobile redirects.
    6     Version: 1.0
     6    Version: 1.1
    77    Author: Average
    88    Author URI: http://profiles.wordpress.org/averagetechnology
     
    201201      }
    202202      $title = apply_filters('widget_title',$instance['title']);
     203      $class = "mobile-site-opt mobile-site-link";
    203204      echo $args['before_widget'];
    204205      if (!empty($title))
    205206      {
    206         $mobsitelink = '<a class="mobile-site-link" href="'.$the_mobile_site_uri.'" title="'.$title.'">'.$title.'</a>';
     207        $mobsitelink = '<a class="'.$class.'" href="'.$the_mobile_site_uri.'" title="'.$title.'">'.$title.'</a>';
    207208      }
    208209      else
    209210      {
    210         $mobsitelink = '<a class="mobile-site-link" href="'.$the_mobile_site_uri.'" title="View Mobile Version">View Mobile Version</a></div>';
     211        $mobsitelink = '<a class="'.$class.'" href="'.$the_mobile_site_uri.'" title="View Mobile Version">View Mobile Version</a></div>';
    211212      }
    212213      echo __($mobsitelink,'text_domain');
     
    325326}
    326327add_shortcode('mobilesitebutton', 'avrgmobdtct_mobsitebttn_sc');
     328
     329#   [mobilesite text="View Mobile Version" class="mobile-site-link"]
     330function avrgmobdtct_mobsite_sc($atts)
     331{
     332  if(!class_exists('Mobile_Detect'))
     333  {
     334    include plugin_basename('/Mobile_Detect.php');
     335  }
     336  $detect = new Mobile_Detect();
     337  if ($detect->isMobile() && !$detect->isTablet())
     338  {
     339    if(get_option('the_mobile_site_uri'))
     340    {
     341      $the_mobile_site_uri=get_option('the_mobile_site_uri');
     342    }
     343    ob_start();
     344    $avrgmobdtctScMerged = shortcode_atts( array(
     345      'text'    => 'View Mobile Version',
     346      'class'   => 'mobile-site-link',
     347      'page'    => '',
     348    ), $atts, 'mobilesite' );
     349    extract($avrgmobdtctScMerged);
     350    if(!empty($page))
     351    {
     352      if($page=='/')
     353      {
     354        $mobPageURN = '';
     355      }
     356      else
     357      {
     358        $mobPageURN = '/'.$page;
     359      }
     360    }
     361    else
     362    {
     363      $mobPageURN = $_SERVER['REQUEST_URI'];
     364    }
     365    echo '<a href="'.$the_mobile_site_uri.$mobPageURN.'" class="'.$class.'">'.$text.'</a>';
     366    return ob_get_clean();
     367  }
     368}
     369add_shortcode('mobilesite', 'avrgmobdtct_mobsitebttn_sc');
    327370
    328371
  • average-mobile-detect/trunk/readme.txt

    r1008156 r1008309  
    77Requires at least: 3.0.1
    88Tested up to: 4.0
    9 Stable tag: 1.0
     9Stable tag: 1.1
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8989
    9090== Changelog ==
     91
     92= 1.1 =
     9315-Oct-2014
     94
     95*   Adds shortcode [mobilesite] back in for older websites that are using it (websites created before Average Mobile Detect was released on the WordPress repository)
     96*   Adds CSS class "mobile-site-opt" to link output by widget to replace css class "mobile-site-link"
     97*   Declares CSS class "mobile-site-link" deprecated for widgets (not deprecated for shortcode). Use "mobile-site-opt" instead. This was decided upon to avoid confusion between the widget and the shortcode when styling.
    9198
    9299= 1.0 =
Note: See TracChangeset for help on using the changeset viewer.