function modal_dialog_plugin() { $this->mdpluginpath = WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)) . '/'; load_plugin_textdomain('modal-dialog', $this->mdpluginpath . '/languages', 'modal-dialog/languages'); $options = get_option('MD_PP'); $genoptions = get_option('MD_General'); if ($genoptions == false) { $this->md_install(); } //add filter for WordPress 2.8 changed backend box system ! add_filter('screen_layout_columns', array($this, 'on_screen_layout_columns'), 10, 2); //register callback for admin menu setup add_action('admin_menu', array($this, 'on_admin_menu')); //register the callback been used if options of page been submitted and needs to be processed add_action('admin_post_save_modal_dialog_general', array($this, 'on_save_changes_general')); add_action('admin_post_save_modal_dialog_configurations', array($this, 'on_save_changes_configurations')); // Add addition section to Post/Page Edition page add_meta_box('modaldialog_meta_box', __('Modal Dialog', 'modal-dialog'), array($this, 'md_post_edit_extra'), 'post', 'normal', 'high'); add_meta_box('modaldialog_meta_box', __('Modal Dialog', 'modal-dialog'), array($this, 'md_post_edit_extra'), 'page', 'normal', 'high'); add_action('edit_post', array($this, 'md_editsave_post_field')); add_action('save_post', array($this, 'md_editsave_post_field')); add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); $genoptions = get_option('MD_General'); for ($counter = 1; $counter <= $genoptions['numberofmodaldialogs']; $counter++) { $optionsname = "MD_PP" . $counter; $options = get_option($optionsname); if ($genoptions['disableonmobilebrowsers'] == true) { require_once ABSPATH . '/wp-content/plugins/modal-dialog/mdetect.php'; $browserchecker = new uagent_info(); $mobilebrowser = $browserchecker->DetectMobileQuick(); } if ($options['active'] == true) { if ($genoptions['disableonmobilebrowsers'] == false || $genoptions['disableonmobilebrowsers'] == true && $mobilebrowser == false) { add_action('wp_footer', array($this, 'modal_dialog_footer')); add_action('wp_head', array($this, 'modal_dialog_header')); break; } } } add_action('admin_head', array($this, 'modal_dialog_admin_header')); add_action('comment_post_redirect', array($this, 'comment_redirect_filter'), 10, 2); register_activation_hook(__FILE__, array($this, 'md_install')); register_deactivation_hook(__FILE__, array($this, 'md_uninstall')); return $this; }
/** * Loads MDetect library */ public static function mdetect() { if (!class_exists('uagent_info')) { require_once dirname(__FILE__) . '/lib/mdetect/mdetect.php'; $agent = new uagent_info(); $is_mobile = $agent->DetectMobileQuick(); $is_tablet = $agent->DetectTierTablet(); if (true == $is_mobile) { PhotoSwipe::$device = 'mobile'; } elseif (true == $is_tablet) { PhotoSwipe::$device = 'tablet'; } else { PhotoSwipe::$device = 'desktop'; } add_action('wp_head', array('PhotoSwipe', 'wp_head')); } }
exit; } if (!isset($_SESSION['status']) || $_SESSION['status'] > 2) { header("location: ../index.php"); exit; } if (!isset($_SESSION['token']['act'])) { $_SESSION['token']['act'] = random_token(7); } include_once '../php/config/database.php'; if (is_file('../php/config/setting.txt')) { $setting = file('../php/config/setting.txt', FILE_IGNORE_NEW_LINES); } include_once '../php/mobileESP.php'; $uagent_obj = new uagent_info(); $isMob = $uagent_obj->DetectMobileQuick(); try { $DBH = new PDO("mysql:host={$Hostname};dbname={$DatabaseName}", $Username, $Password); $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($_SESSION['status'] == 2 || $_SESSION['status'] == 1) { $query = "SELECT \n\t\t\t\t\t\t\ta.id,\n\t\t\t\t\t\t\ta.enabled,\n\t\t\t\t\t\t\ta.ref_id,\n\t\t\t\t\t\t\ta.title,\n\t\t\t\t\t\t\ta.user_id,\n\t\t\t\t\t\t\ta.operator_id,\n\t\t\t\t\t\t\ta.ticket_status,\n\t\t\t\t\t\t\ta.department_id,\n\t\t\t\t\t\t\ta.website,\n\t\t\t\t\t\t\ta.contype,\n\t\t\t\t\t\t\ta.ftp_user,\n\t\t\t\t\t\t\ta.ftp_password,\n\t\t\t\t\t\t\ta.enc_key,\n\t\t\t\t\t\t\tb.rate,\n\t\t\t\t\t\t\tb.note,\n\t\t\t\t\t\t\tc.reason,\n\t\t\t\t\t\t\td.free,\n\t\t\t\t\t\t\tIF(d.free=0,a.support_time,NULL) AS support_time\n\t\t\t\t\t\tFROM " . $SupportTicketsTable . " a\n\t\t\t\t\t\tLEFT JOIN " . $SupportRateTable . " b\n\t\t\t\t\t\t\tON b.id=a.id\n\t\t\t\t\t\tLEFT JOIN " . $SupportFlagTable . " c\n\t\t\t\t\t\t\tON (c.tk_id=a.id AND c.usr_id='" . $_SESSION['id'] . "')\n\t\t\t\t\t\tLEFT JOIN " . $SupportDepaTable . " d\n\t\t\t\t\t\t\tON d.id=a.department_id\n\t\t\t\t\t\tWHERE a.id=? LIMIT 1"; } else { $query = "SELECT \n\t\t\t\t\t\t\ta.id,\n\t\t\t\t\t\t\ta.enabled,\n\t\t\t\t\t\t\ta.ref_id,\n\t\t\t\t\t\t\ta.title,\n\t\t\t\t\t\t\ta.user_id,\n\t\t\t\t\t\t\ta.operator_id,\n\t\t\t\t\t\t\ta.ticket_status,\n\t\t\t\t\t\t\ta.department_id,\n\t\t\t\t\t\t\ta.website,\n\t\t\t\t\t\t\ta.contype,\n\t\t\t\t\t\t\ta.ftp_user,\n\t\t\t\t\t\t\ta.ftp_password,\n\t\t\t\t\t\t\ta.enc_key,\n\t\t\t\t\t\t\tb.rate,\n\t\t\t\t\t\t\tb.note,\n\t\t\t\t\t\t\tc.reason,\n\t\t\t\t\t\t\td.free,\n\t\t\t\t\t\t\tIF(d.free=0,a.support_time,NULL) AS support_time\n\t\t\t\t\t\tFROM " . $SupportTicketsTable . " a\n\t\t\t\t\t\tLEFT JOIN " . $SupportRateTable . " b\n\t\t\t\t\t\t\tON b.id=a.id\n\t\t\t\t\t\tLEFT JOIN " . $SupportFlagTable . " c\n\t\t\t\t\t\t\tON (c.tk_id=a.id AND c.usr_id=" . $_SESSION['id'] . ")\n\t\t\t\t\t\tLEFT JOIN " . $SupportDepaTable . " d\n\t\t\t\t\t\t\tON d.id=a.department_id\n\t\t\t\t\t\tWHERE a.id=? AND a.user_id=" . $_SESSION['id'] . " LIMIT 1"; } $STH = $DBH->prepare($query); $STH->bindParam(1, $_GET['id'], PDO::PARAM_INT); $STH->execute(); $STH->setFetchMode(PDO::FETCH_ASSOC); $a = $STH->fetch(); if (!empty($a)) { do {
public static function detectMobile() { if (defined('OPC_DETECTED_DEVICE')) { if (OPC_DETECTED_DEVICE != 'DESKTOP') { return true; } else { return false; } } $isMobile = false; if (!class_exists('uagent_info')) { require_once JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_onepage' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR . 'mdetect.php'; } $ua = new uagent_info(); if ($ua->DetectMobileQuick()) { define('OPC_DETECTED_DEVICE', 'MOBILE'); $isMobile = true; } if ($ua->DetectTierTablet()) { define('OPC_DETECTED_DEVICE', 'TABLET'); $isMobile = true; } if ($isMobile == false) { define('OPC_DETECTED_DEVICE', 'DESKTOP'); } return $isMobile; }
<?php require_once 'mdetect.php'; if (preg_match('@^/([0-9]+)/?$@', $_SERVER['REQUEST_URI'], $matches)) { $ui = new uagent_info(); if ($ui->DetectMobileQuick() == $ui->true) { header("Location: http://m.flickr.com/#/photos/noboru/sets/{$matches['1']}/"); } else { header("Location: http://www.flickr.com/photos/noboru/sets/{$matches['1']}/"); } } else { header("Location: http://www.flickr.com/photos/noboru/sets/"); }