function isDevice($type) { $type = strtolower($type); if (detectDevice() === $type) { return true; } else { return false; } }
/** * Detect Opera browser * * @return int */ function isOpera() { return detectDevice('Opera'); }
function edsanimate_handler($attributes, $content = null) { $deviceType = detectDevice(); $enableSmartPhone = get_option('enable_on_phone'); $enableTablet = get_option('enable_on_tab'); $enable = $deviceType == 'phone' && intval($enableSmartPhone) || $deviceType == 'tablet' && intval($enableTablet) || $deviceType == 'computer'; if ($enable) { extract(shortcode_atts(array('animation' => '', 'delay' => '', 'duration' => '', 'infinite_animation' => '', 'animate_on' => '', 'scroll_offset' => ''), $attributes)); $classString = "animated"; if ($animation == '') { return do_shortcode($content); } $classString .= " " . $animation; if (strcasecmp($infinite_animation, 'yes') == 0) { $classString .= " infinite"; } if ($delay != '' && is_int((int) $delay) && $delay >= 0) { $classString .= " delay" . $delay; } if ($duration != '' && is_int((int) $duration) && $duration >= 0) { $classString .= " duration" . $duration; } if (strcasecmp($animate_on, 'scroll') == 0) { $classString .= " eds-on-scroll"; } else { if (strcasecmp($animate_on, 'click') == 0) { $classString .= " eds-on-click"; } else { if (strcasecmp($animate_on, 'hover') == 0) { $classString .= " eds-on-hover"; } } } if (isset($scroll_offset) && $scroll_offset != '') { return '<div class="' . $classString . '" eds_scroll_offset="' . $scroll_offset . '">' . do_shortcode($content) . '</div>'; } else { return '<div class="' . $classString . '">' . do_shortcode($content) . '</div>'; } } else { return do_shortcode($content); } }