Exemplo n.º 1
0
function mfbfw_init()
{
    $settings = mfbfw_get_settings();
    echo "\n" . "\n" . "<!-- Fancybox for WordPress v" . $settings['version'] . " -->" . "\n";
    ?>

<script type="text/javascript">

	<?php 
    if ($settings['jQnoConflict']) {
        ?>
jQuery.noConflict();<?php 
    }
    echo "\n";
    ?>

	jQuery(function(){

		<?php 
    // This copies the title of every IMG tag and adds it to its parent A so that fancybox can use it
    ?>
		jQuery.fn.getTitle = function() {
			var arr = jQuery("a.fancybox");
			jQuery.each(arr, function() {
				var title = jQuery(this).children("img").attr("title");
				jQuery(this).attr('title',title);
			})
		}

		// Supported file extensions
		var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	<?php 
    if ($settings['galleryType'] == 'post') {
        // Gallery type BY POST and we are on post or page (so only one post or page is visible)
        if (is_single() | is_page()) {
            ?>

		jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

	<?php 
        } else {
            ?>

		var posts = jQuery('.post');

		posts.each(function() {
			jQuery(this).find(thumbnails).addClass("fancybox").attr('rel','fancybox'+posts.index(this)).getTitle()
		});


	<?php 
        }
    } elseif ($settings['galleryType'] == 'all') {
        ?>

		jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

	<?php 
    } elseif ($settings['galleryType'] == 'none') {
        ?>

		jQuery(thumbnails).addClass("fancybox").getTitle();

	<?php 
    } else {
        echo $settings['customExpression'];
    }
    // Now we call fancybox and apply it on any link with a rel atribute that starts with "fancybox", with the options set on the admin panel
    ?>
		jQuery("a.fancybox").fancybox({
			'imageScale': <?php 
    if ($settings['imageScale']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'padding': <?php 
    echo $settings['padding'];
    ?>
,
			'zoomOpacity': <?php 
    if ($settings['zoomOpacity']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'zoomSpeedIn': <?php 
    echo $settings['zoomSpeedIn'];
    ?>
,
			'zoomSpeedOut': <?php 
    echo $settings['zoomSpeedOut'];
    ?>
,
			'zoomSpeedChange': <?php 
    echo $settings['zoomSpeedChange'];
    ?>
,
			'overlayShow': <?php 
    if ($settings['overlayShow']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'overlayColor': <?php 
    echo '"' . $settings['overlayColor'] . '"';
    ?>
,
			'overlayOpacity': <?php 
    echo $settings['overlayOpacity'];
    ?>
,
			'enableEscapeButton': <?php 
    if ($settings['enableEscapeButton']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'showCloseButton': <?php 
    if ($settings['showCloseButton']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'hideOnOverlayClick': <?php 
    if ($settings['hideOnOverlayClick']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'hideOnContentClick': <?php 
    if ($settings['hideOnContentClick']) {
        echo "true";
    } else {
        echo "false";
    }
    ?>
,
			'frameWidth':  <?php 
    echo $settings['frameWidth'];
    ?>
,
			'frameHeight':  <?php 
    echo $settings['frameHeight'];
    ?>
,
			'callbackOnStart': <?php 
    if ($settings['callbackOnStart']) {
        echo $settings['callbackOnStart'];
    } else {
        echo 'null';
    }
    ?>
,
			'callbackOnShow': <?php 
    if ($settings['callbackOnShow']) {
        echo $settings['callbackOnShow'];
    } else {
        echo 'null';
    }
    ?>
,
			'callbackOnClose': <?php 
    if ($settings['callbackOnClose']) {
        echo $settings['callbackOnClose'];
    } else {
        echo 'null';
    }
    ?>
,
			'centerOnScroll': <?php 
    if ($settings['centerOnScroll']) {
        echo "true";
    } else {
        echo "false";
    }
    if ($settings['easing']) {
        ?>
,
			'easingIn': <?php 
        echo '"' . $settings['easingIn'] . '"';
        ?>
,
			'easingOut': <?php 
        echo '"' . $settings['easingOut'] . '"';
        ?>
,
			'easingChange': <?php 
        echo '"' . $settings['easingChange'] . '"';
    }
    ?>

		});

})

</script>
<?php 
    echo "<!-- END Fancybox for WordPress -->" . "\n";
}
Exemplo n.º 2
0
<?php

echo "\n" . '<link rel="stylesheet" href="' . FBFW_URL . '/css/jquery-ui.css" type="text/css" media="screen" />' . "\n";
// Get array with all the options
$settings = mfbfw_get_settings();
// Make selects data
$closePositionArray = array('left', 'right');
$overlayArray = array(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1);
$msArray = array(0, 25, 50, 75, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1250, 1500, 1750, 2000);
$easingArray = array('easeInQuad', 'easeOutQuad', 'easeInOutQuad', 'easeInCubic', 'easeOutCubic', 'easeInOutCubic', 'easeInQuart', 'easeOutQuart', 'easeInOutQuart', 'easeInQuint', 'easeOutQuint', 'easeInOutQuint', 'easeInSine', 'easeOutSine', 'easeInOutSine', 'easeInExpo', 'easeOutExpo', 'easeInOutExpo', 'easeInCirc', 'easeOutCirc', 'easeInOutCirc', 'easeInElastic', 'easeOutElastic', 'easeInOutElastic', 'easeInBack', 'easeOutBack', 'easeInOutBack', 'easeInBounce', 'easeOutBounce', 'easeInOutBounce');