Esempio n. 1
0
 function __construct()
 {
     if (isset($params['plugin_url'])) {
         $this->plugin_url = $params['plugin_url'];
     } else {
         $this->plugin_url = trailingslashit(dirname(plugins_url('', __FILE__)));
     }
     $general_settings = array('jqlb_overlay_opacity' => '80', 'jqlb_help_text' => '', 'jqlb_margin_size' => 0, 'jqlb_automate' => 1, 'jqlb_comments' => 1, 'jqlb_resize_on_demand' => 0, 'jqlb_show_download' => 0, 'jqlb_navbarOnTop' => 0, 'jqlb_resize_speed' => 400);
     foreach ($general_settings as $key => $value) {
         if (!(get_option($key, 1.2365498798465132E+28) == 1.2365498798465132E+28)) {
             $general_settings[$key] = get_option($key);
         } else {
             $general_settings[$key] = $value;
         }
     }
     $this->get_general_settings = $general_settings;
     $locale = jqlb_get_locale();
     $folder = '';
     switch ($locale) {
         case 'cs_CZ':
             $folder = 'cs_CZ/';
             break;
         case 'ru_RU':
             $folder = 'ru_RU/';
             break;
         case 'pl_PL':
             $folder = 'pl_PL/';
             break;
         case 'he_IL':
             $folder = 'he_IL/';
             break;
     }
     // Note: Deprecated 3.0.5+
     $design_settings = array('jqlb_overlay_opacity' => '80', 'jqlb_overlay_color' => '#000000', 'jqlb_overlay_close' => '1', 'jqlb_border_width' => '10', 'jqlb_border_color' => '#ffffff', 'jqlb_border_radius' => '0', 'jqlb_image_info_background_transparency' => '100', 'jqlb_image_info_bg_color' => '#ffffff', 'jqlb_image_info_text_color' => '#000000', 'jqlb_image_info_text_fontsize' => '10', 'jqlb_show_text_for_image' => '1', 'jqlb_next_image_title' => __('next image', 'jqlb'), 'jqlb_previous_image_title' => __('previous image', 'jqlb'), 'jqlb_next_button_image' => $this->plugin_url . 'styles/images/' . $folder . 'next.gif', 'jqlb_previous_button_image' => $this->plugin_url . 'styles/images/' . $folder . 'prev.gif', 'jqlb_maximum_width' => '', 'jqlb_maximum_height' => '', 'jqlb_show_close_button' => '1', 'jqlb_close_image_title' => __('close image gallery', 'jqlb'), 'jqlb_close_image_max_heght' => '22', 'jqlb_image_for_close_lightbox' => $this->plugin_url . 'styles/images/' . $folder . 'closelabel.gif', 'jqlb_keyboard_navigation' => '1', 'jqlb_popup_size_fix' => '0');
     foreach ($design_settings as $key => $value) {
         if (!(get_option($key, 1.2365498798465132E+28) == 1.2365498798465132E+28)) {
             $design_settings[$key] = get_option($key);
         } else {
             $design_settings[$key] = $value;
         }
     }
     $this->get_design_settings = $design_settings;
 }
function jqlb_options_panel()
{
    if (!function_exists('current_user_can') || !current_user_can('manage_options')) {
        die(__('Cheatin’ uh?', 'jqlb'));
    }
    add_action('in_admin_footer', 'jqlb_add_admin_footer');
    ?>
	
	<div class="wrap">
	<h2>WP Lightbox 2</h2>	
     <div id="sideblock" style="float:right;width:270px;margin-left:10px;"> 
		 <iframe width=270 height=500 frameborder="0" src="http://demos.onlinewebapplication.com/wp-internal-links/SEOIinternalLinks.html"></iframe>
 	</div>
	<?php 
    include_once plugin_dir_path(__FILE__) . 'about.php';
    ?>
	<form method="post" action="options.php">
		<table>
		<?php 
    settings_fields('jqlb-settings-group');
    ?>
			<tr valign="baseline" colspan="2">
				<td colspan="">
					<?php 
    $check = get_option('jqlb_automate') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_automate" name="jqlb_automate" value="1" <?php 
    echo $check;
    ?>
/>
					<label for="jqlb_automate" title="<?php 
    _e('Let the plugin add necessary html to image links', 'jqlb');
    ?>
"> <?php 
    _e('Auto-lightbox image links', 'jqlb');
    ?>
</label>
				</td>
			</tr>
			<tr valign="baseline" colspan="2">
				<td colspan="2">
					<?php 
    $check = get_option('jqlb_comments') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_comments" name="jqlb_comments" value="1" <?php 
    echo $check;
    ?>
/>
					<label for="jqlb_comments" title="<?php 
    _e('Note: this will disable the nofollow-attribute of comment links, that otherwise interfere with the lightbox.', 'jqlb');
    ?>
"> <?php 
    _e('Enable lightbox in comments (disables <a href="http://codex.wordpress.org/Nofollow">the nofollow attribute!</a>)', 'jqlb');
    ?>
</label>
				</td>
			</tr>
			<tr valign="baseline" colspan="2">
				<td>
					<?php 
    $check = get_option('jqlb_show_download') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_show_download" name="jqlb_show_download" value="1" <?php 
    echo $check;
    ?>
 />
					<label for="jqlb_show_download"> <?php 
    _e('Show download link', 'jqlb');
    ?>
 </label>
				</td>
				<td>
				<?php 
    $target = get_option('jqlb_link_target');
    ?>
				<label for="jqlb_link_target" title="<?php 
    _e('_blank: open the image in a new window or tab
_self: open the image in the same frame as it was clicked (default)
_parent: open the image in the parent frameset
_top: open the image in the full body of the window', 'jqlb');
    ?>
"><?php 
    _e('Target for download link:', 'jqlb');
    ?>
</label> 
				<select id="jqlb_link_target" name="jqlb_link_target">
					<option <?php 
    if ('_blank' == $target) {
        echo 'selected="selected"';
    }
    ?>
>_blank</option>
					<option <?php 
    if ('_self' == $target) {
        echo 'selected="selected"';
    }
    ?>
>_self</option>
					<option <?php 
    if ('_top' == $target) {
        echo 'selected="selected"';
    }
    ?>
>_top</option>
					<option <?php 
    if ('_parent' == $target) {
        echo 'selected="selected"';
    }
    ?>
>_parent</option>
				</select>							
				</td>
			</tr>
      <tr valign="baseline" colspan="2">
        <td colspan="2"> 
          <?php 
    $check = get_option('jqlb_navbarOnTop') ? ' checked="yes" ' : '';
    ?>
          <input type="checkbox" id="jqlb_navbarOnTop" name="jqlb_navbarOnTop" value="1" <?php 
    echo $check;
    ?>
 />
          <label for="jqlb_navbarOnTop">
            <?php 
    _e('Show image info on top', 'jqlb');
    ?>
          </label>
        </td>
      </tr>
      <tr valign="baseline" colspan="2">
			<td>
				<?php 
    $check = get_option('jqlb_resize_on_demand') ? ' checked="yes" ' : '';
    ?>
				<input type="checkbox" id="jqlb_resize_on_demand" name="jqlb_resize_on_demand" value="1" <?php 
    echo $check;
    ?>
 />
				<label for="jqlb_resize_on_demand"><?php 
    _e('Shrink large images to fit smaller screens', 'jqlb');
    ?>
</label> 
			</td>
			<?php 
    if ($check != '') {
        ?>
			<td>					
				<input type="text" id="jqlb_margin_size" name="jqlb_margin_size" value="<?php 
        echo floatval(get_option('jqlb_margin_size'));
        ?>
" size="3" />
				<label for="jqlb_margin_size" title="<?php 
        _e('Keep a distance between the image and the screen edges.', 'jqlb');
        ?>
"><?php 
        _e('Minimum margin to screen edge (default: 0)', 'jqlb');
        ?>
</label>			
			</td>
			<?php 
    }
    ?>
		</tr>					
		<tr valign="baseline" colspan="2">
			<td colspan="2">					
				<input type="text" id="jqlb_resize_speed" name="jqlb_resize_speed" value="<?php 
    echo intval(get_option('jqlb_resize_speed'));
    ?>
" size="3" />
				<label for="jqlb_resize_speed"><?php 
    _e('Animation duration (in milliseconds) ', 'jqlb');
    ?>
</label>			
			</td>
		</tr>
		<tr valign="baseline" colspan="2">			
			<td>
				<input type="text" id="jqlb_help_text" name="jqlb_help_text" value="<?php 
    echo get_option('jqlb_help_text');
    ?>
" size="30" />		
				<label for="jqlb_help_text"><?php 
    _e('Help text (default: none) ', 'jqlb');
    ?>
</label>						
			</td>			
		</tr>			
		 </table>
		<p style="font-size:xx-small;font-style:italic;"><?php 
    _e('Browse images with your keyboard: Arrows or P(revious)/N(ext) and X/C/ESC for close.', 'jqlb');
    ?>
</p>
		<p class="submit">
		  <input type="submit" name="Submit" value="<?php 
    _e('Save Changes', 'jqlb');
    ?>
" />
		</p>
	</form>
	<?php 
    $locale = jqlb_get_locale();
    $diskfile = plugin_dir_path(__FILE__) . "I18n/howtouse-{$locale}.html";
    if (!file_exists($diskfile)) {
        $diskfile = plugin_dir_path(__FILE__) . 'I18n/howtouse.html';
    }
    $text = false;
    if (function_exists('file_get_contents')) {
        $text = @file_get_contents($diskfile);
    } else {
        $text = @file($diskfile);
        if ($text !== false) {
            $text = implode("", $text);
        }
    }
    if ($text === false) {
        $text = '<p>The documentation files are missing! Try <a href="http://wordpress.org/extend/plugins/wp-lightbox-2/">downloading</a> and <a href="http://wordpress.org/extend/plugins/wp-lightbox-2/installation/">re-installing</a> this lightbox plugin.</p>';
    }
    echo $text;
    ?>
	</div>	
<?php 
}
function jqlb_options_panel()
{
    if (!function_exists('current_user_can') || !current_user_can('manage_options')) {
        die(__('Cheatin&#8217; uh?', 'wp-jquery-lightbox'));
    }
    add_action('in_admin_footer', 'jqlb_add_admin_footer');
    ?>
	
	<div class="wrap">
	<h2>jQuery Lightbox</h2>	
	<?php 
    include_once plugin_dir_path(__FILE__) . 'about.php';
    ?>
	<form method="post" action="options.php">
		<table>
		<?php 
    settings_fields('jqlb-settings-group');
    ?>
			<tr valign="baseline" colspan="2">
				<td colspan="">
					<?php 
    $check = get_option('jqlb_automate') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_automate" name="jqlb_automate" value="1" <?php 
    echo $check;
    ?>
/>
					<label for="jqlb_automate" title="<?php 
    _e('Let the plugin add necessary html to image links', 'wp-jquery-lightbox');
    ?>
"> <?php 
    _e('Auto-lightbox image links', 'wp-jquery-lightbox');
    ?>
</label>
				</td>
			</tr>
			<tr valign="baseline" colspan="2">
				<td colspan="2">
					<?php 
    $check = get_option('jqlb_comments') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_comments" name="jqlb_comments" value="1" <?php 
    echo $check;
    ?>
/>
					<label for="jqlb_comments" title="<?php 
    _e('Note: this will disable the nofollow-attribute of comment links, that otherwise interfere with the lightbox.', 'wp-jquery-lightbox');
    ?>
"> <?php 
    _e('Enable lightbox in comments (disables <a href="http://codex.wordpress.org/Nofollow">the nofollow attribute!</a>)', 'wp-jquery-lightbox');
    ?>
</label>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
    $check = get_option('jqlb_showTitle') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_showTitle" name="jqlb_showTitle" value="1" <?php 
    echo $check;
    ?>
 />
					<label for="jqlb_showTitle"> <?php 
    _e('Show title', 'wp-jquery-lightbox');
    ?>
 </label>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
    $check = get_option('jqlb_showCaption') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_showCaption" name="jqlb_showCaption" value="1" <?php 
    echo $check;
    ?>
 />
					<label for="jqlb_showCaption"> <?php 
    _e('Show caption', 'wp-jquery-lightbox');
    ?>
 </label>
				</td>
			</tr>
			<tr valign="baseline">				
				<td>
					<?php 
    $check = get_option('jqlb_showNumbers') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_showNumbers" name="jqlb_showNumbers" value="1" <?php 
    echo $check;
    ?>
 />
					<label for="jqlb_showNumbers"> <?php 
    _e('Show image numbers:', 'wp-jquery-lightbox');
    printf(' <code>"%s # %s #"</code>', __('Image ', 'wp-jquery-lightbox'), __(' of ', 'wp-jquery-lightbox'));
    ?>
 </label>
				</td>				
			</tr>			
			<tr valign="baseline">				
				<td>
					<?php 
    $check = get_option('jqlb_showDownload') ? ' checked="yes" ' : '';
    ?>
					<input type="checkbox" id="jqlb_showDownload" name="jqlb_showDownload" value="1" <?php 
    echo $check;
    ?>
 />
					<label for="jqlb_showDownload"> <?php 
    _e('Show download link', 'wp-jquery-lightbox');
    ?>
 </label>
				</td>				
			</tr>
      <tr valign="baseline" colspan="2">
        <td colspan="2"> 
          <?php 
    $check = get_option('jqlb_navbarOnTop') ? ' checked="yes" ' : '';
    ?>
          <input type="checkbox" id="jqlb_navbarOnTop" name="jqlb_navbarOnTop" value="1" <?php 
    echo $check;
    ?>
 />
          <label for="jqlb_navbarOnTop">
            <?php 
    _e('Show image info on top', 'wp-jquery-lightbox');
    ?>
          </label>
        </td>
      </tr>
      <tr valign="baseline" colspan="2">
			<td>
				<?php 
    $check = get_option('jqlb_resize_on_demand') ? ' checked="yes" ' : '';
    ?>
				<input type="checkbox" id="jqlb_resize_on_demand" name="jqlb_resize_on_demand" value="1" <?php 
    echo $check;
    ?>
 />
				<label for="jqlb_resize_on_demand"><?php 
    _e('Shrink large images to fit smaller screens', 'wp-jquery-lightbox');
    ?>
</label> 
			</td>
			<?php 
    if ($check != '') {
        ?>
			<td>					
				<input type="text" id="jqlb_margin_size" name="jqlb_margin_size" value="<?php 
        echo floatval(get_option('jqlb_margin_size'));
        ?>
" size="3" />
				<label for="jqlb_margin_size" title="<?php 
        _e('Keep a distance between the image and the screen edges.', 'wp-jquery-lightbox');
        ?>
"><?php 
        _e('Minimum margin to screen edge (default: 0)', 'wp-jquery-lightbox');
        ?>
</label>			
			</td>
			<?php 
    }
    ?>
		</tr>
		<tr valign="baseline" colspan="2">			
			<td>
				<?php 
    $check = get_option('jqlb_use_theme_styles') ? ' checked="yes" ' : '';
    ?>
				<input type="checkbox" id="jqlb_use_theme_styles" name="jqlb_use_theme_styles" value="1" <?php 
    echo $check;
    ?>
 />	
				<label for="jqlb_use_theme_styles" title="You must put lightbox.min.css or lightbox.min.[locale].css in your theme's style-folder. This is good to keep your CSS edits when updating the plugin."><?php 
    _e('Use custom stylesheet', 'wp-jquery-lightbox');
    ?>
</label>						
			</td>			
		</tr>						
		<tr valign="baseline" colspan="2">
			<td colspan="2">					
				<input type="text" id="jqlb_resize_speed" name="jqlb_resize_speed" value="<?php 
    echo intval(get_option('jqlb_resize_speed'));
    ?>
" size="3" />
				<label for="jqlb_resize_speed"><?php 
    _e('Animation duration (in milliseconds) ', 'wp-jquery-lightbox');
    ?>
</label>			
			</td>
		</tr>
		<tr valign="baseline" colspan="2">
			<td colspan="2">					
				<input type="text" id="jqlb_slideshow_speed" name="jqlb_slideshow_speed" value="<?php 
    echo intval(get_option('jqlb_slideshow_speed'));
    ?>
" size="3" />
				<label for="jqlb_slideshow_speed"><?php 
    _e('Slideshow speed (in milliseconds). 0 to disable.', 'wp-jquery-lightbox');
    ?>
</label>			
			</td>
		</tr>		
		 </table>		
		<p class="submit">
		  <input type="submit" name="Submit" value="<?php 
    _e('Save Changes', 'wp-jquery-lightbox');
    ?>
" />
		</p>
	</form>
	<?php 
    $locale = jqlb_get_locale();
    $diskfile = plugin_dir_path(__FILE__) . "languages/howtouse-{$locale}.html";
    if (!file_exists($diskfile)) {
        $diskfile = plugin_dir_path(__FILE__) . 'languages/howtouse.html';
    }
    $text = false;
    if (function_exists('file_get_contents')) {
        $text = @file_get_contents($diskfile);
    } else {
        $text = @file($diskfile);
        if ($text !== false) {
            $text = implode("", $text);
        }
    }
    if ($text === false) {
        $text = '<p>The documentation files are missing! Try <a href="http://wordpress.org/extend/plugins/wp-jquery-lightbox/">downloading</a> and <a href="http://wordpress.org/extend/plugins/wp-jquery-lightbox/installation/">re-installing</a> this plugin.</p>';
    }
    echo $text;
    ?>
	</div>	
<?php 
}