<?xml version="1.0" encoding="utf-8"?>
<dleplugin>
	<name>Fancybox gallery</name>
	<description>Плагин позволяет заменить стандартную галерею на FancyBox-галерею.
Не требует написания скрипта галереей в шаблоне.</description>
	<icon>engine/skins/images/fancybox.png</icon>
	<version>1.0</version>
	<dleversion>15</dleversion>
	<versioncompare>greater</versioncompare>
	<upgradeurl></upgradeurl>
	<filedelete>0</filedelete>
	<needplugin></needplugin>
	<mnotice>0</mnotice>
	<mysqlinstall><![CDATA[]]></mysqlinstall>
	<mysqlupgrade><![CDATA[]]></mysqlupgrade>
	<mysqlenable><![CDATA[]]></mysqlenable>
	<mysqldisable><![CDATA[]]></mysqldisable>
	<mysqldelete><![CDATA[]]></mysqldelete>
	<phpinstall><![CDATA[]]></phpinstall>
	<phpupgrade><![CDATA[]]></phpupgrade>
	<phpenable><![CDATA[]]></phpenable>
	<phpdisable><![CDATA[]]></phpdisable>
	<phpdelete><![CDATA[]]></phpdelete>
	<notice><![CDATA[]]></notice>
	<file name="engine/modules/functions.php">
		<operation action="before">
			<searchcode><![CDATA[function deletecomments( $id ) {]]></searchcode>
			<replacecode><![CDATA[function enable_fancybox( $matches=array() ) {

    $matches[0] = str_replace ( 'class="highslide"', 'data-fancybox="gallary"', $matches[0] );

    return $matches[0];
}]]></replacecode>
			<enabled>1</enabled>
		</operation>
	</file>
	<file name="engine/modules/show.full.php">
		<operation action="replace">
			<searchcode><![CDATA[$gallery_image[] = "<li><a href=\"{$path_parts->url}\" onclick=\"return hs.expand(this, { slideshowGroup: 'xf_{$row['id']}_{$value[0]}' })\" target=\"_blank\"><img src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a></li>";]]></searchcode>
			<replacecode><![CDATA[$gallery_image[] = "<li><a href=\"{$path_parts->url}\" data-fancybox=\"gallary-xf_{$row['id']}_{$value[0]}\" data-caption=\"{$temp_alt}\"  target=\"_blank\"><img src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a></li>";]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="replace">
			<searchcode><![CDATA[$gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$path_parts->url}\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a>";]]></searchcode>
			<replacecode><![CDATA[$gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$path_parts->url}\" data-fancybox=\"gallary\" data-caption=\"{$temp_alt}\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a>";]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="before">
			<searchcode><![CDATA[$tpl->set( '{short-story}', $row['short_story'] );]]></searchcode>
			<replacecode><![CDATA[$row['short_story'] = preg_replace_callback ( "#<(a)(.+?)>#i", "enable_fancybox", $row['short_story'] );
$row['full_story'] = preg_replace_callback ( "#<(a)(.+?)>#i", "enable_fancybox", $row['full_story'] );]]></replacecode>
			<enabled>1</enabled>
		</operation>
	</file>
	<file name="engine/modules/show.short.php">
		<operation action="replace">
			<searchcode><![CDATA[$gallery_image[] = "<li><a href=\"{$path_parts->url}\" onclick=\"return hs.expand(this, { slideshowGroup: 'xf_{$row['id']}_{$value[0]}' })\" target=\"_blank\"><img src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a></li>";]]></searchcode>
			<replacecode><![CDATA[$gallery_image[] = "<li><a href=\"{$path_parts->url}\" data-fancybox=\"gallary-xf_{$row['id']}_{$value[0]}\" data-caption=\"{$temp_alt}\"  target=\"_blank\"><img src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a></li>";]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="replace">
			<searchcode><![CDATA[$gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$path_parts->url}\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a>";]]></searchcode>
			<replacecode><![CDATA[$gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$path_parts->url}\" data-fancybox=\"gallary\" data-caption=\"{$temp_alt}\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a>";]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="after">
			<searchcode><![CDATA[if ($config['image_lazy']) $row['short_story'] = preg_replace_callback ( "#<(img|iframe)(.+?)>#i", "enable_lazyload", $row['short_story'] );]]></searchcode>
			<replacecode><![CDATA[$row['short_story'] = preg_replace_callback ( "#<(a)(.+?)>#i", "enable_fancybox", $row['short_story'] );]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="before">
			<searchcode><![CDATA[$tpl->set( '{full-story}',  trim($row['full_story']) );]]></searchcode>
			<replacecode><![CDATA[$row['full_story'] = preg_replace_callback ( "#<(a)(.+?)>#i", "enable_fancybox", $row['full_story'] );]]></replacecode>
			<enabled>1</enabled>
		</operation>
	</file>
	<file name="engine/modules/show.custom.php">
		<operation action="replace">
			<searchcode><![CDATA[$gallery_image[] = "<li><a href=\"{$path_parts->url}\" onclick=\"return hs.expand(this, { slideshowGroup: 'xf_{$row['id']}_{$value[0]}' })\" target=\"_blank\"><img src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a></li>";]]></searchcode>
			<replacecode><![CDATA[$gallery_image[] = "<li><a href=\"{$path_parts->url}\" data-fancybox=\"gallary-xf_{$row['id']}_{$value[0]}\" data-caption=\"{$temp_alt}\"  target=\"_blank\"><img src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a></li>";]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="replace">
			<searchcode><![CDATA[$gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$path_parts->url}\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a>";]]></searchcode>
			<replacecode><![CDATA[$gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$path_parts->url}\" data-fancybox=\"gallary\" data-caption=\"{$temp_alt}\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$path_parts->thumb}\" alt=\"{$temp_alt}\"></a>";]]></replacecode>
			<enabled>1</enabled>
		</operation>
		<operation action="before">
			<searchcode><![CDATA[if ($config['image_lazy']) $row['short_story'] = preg_replace_callback ( "#<(img|iframe)(.+?)>#i", "enable_lazyload", $row['short_story'] );]]></searchcode>
			<replacecode><![CDATA[$row['short_story'] = preg_replace_callback ( "#<(a)(.+?)>#i", "enable_fancybox", $row['short_story'] );]]></replacecode>
			<enabled>1</enabled>
		</operation>
	</file>
	<file name="engine/modules/main.php">
		<operation action="before">
			<searchcode><![CDATA[if ($config['image_lazy']) {
	$js_array[] = "engine/classes/js/lazyload.js";
}]]></searchcode>
			<replacecode><![CDATA[
if ( (strpos ( $tpl->result['content'], "fancybox" ) !== false
        OR strpos ( $tpl->copy_template, "fancybox" ) !== false
        OR strpos ( $tpl->result['content'], "fancybox" ) !== false
        OR strpos ( $tpl->copy_template, "fancybox" ) !== false) AND $dle_module != "addnews") {

    $css_array[] = "engine/classes/fancybox/fancybox.min.css";
    $js_array[] = "engine/classes/fancybox/fancybox.min.js";

    $onload_scripts[] = <<<HTML
        $('[data-fancybox]').fancybox({
    loop: true,
            buttons: [ 
   "zoom",
   "share",
   "slideShow",
   "fullScreen",
   "download",
   "thumbs",
   "close"
],
    autoFocus: false
});


HTML;

}
]]></replacecode>
			<enabled>1</enabled>
		</operation>
	</file>
</dleplugin>