function widget_zenpressed($args)
 {
     // $args is an array of strings that help widgets to conform to
     // the active theme: before_widget, before_title, after_widget,
     // and after_title are the array keys. Default tags: li and h2.
     extract($args);
     // Each widget can store its own options. We keep strings here.
     $options = get_option('widget_zenpressed');
     $title = $options['title'];
     $conf = zenpressed_conf();
     if ($options['select'] != "") {
         $conf['select'] = $options['select'];
     }
     if ($options['count'] != "") {
         $conf['count'] = $options['count'];
     }
     if ($options['size'] != "") {
         $conf['size'] = $options['size'];
     }
     if ($options['album'] != "") {
         $conf['album'] = $options['album'];
     }
     $conf['showtitle'] = $options['showtitle'] ? "on" : "off";
     $conf['showdescription'] = $options['showdescription'] ? "on" : "off";
     $conf['showalbumtitle'] = $options['showalbumtitle'] ? "on" : "off";
     $conf['showalbumdescription'] = $options['showalbumdescription'] ? "on" : "off";
     $conf['lightbox'] = $options['lightbox'] ? "on" : "off";
     if ($options['lightbox_size'] != "") {
         $conf['lightbox_size'] = $options['lightbox_size'];
     }
     // These lines generate our output. Widgets can be very complex
     // but as you can see here, they can also be very, very simple.
     echo $before_widget . $before_title . $title . $after_title;
     zenpressed_photos($conf['album'], $conf);
     echo $after_widget;
 }
Example #2
0
function zenpressed_quicktag()
{
    $conf = zenpressed_conf();
    if ($conf["quicktag"] == "on") {
        ?>
		<script type="text/javascript">
		<!--
		var zp_tb = document.getElementById( "ed_toolbar" );
		if( zp_tb ) {
			var zp_nr = edButtons.length;
			edButtons[edButtons.length] = new edButton('ed_zp','','','','');
			var zp_btn = zp_tb.lastChild;
			while ( zp_btn.nodeType != 1 ) {
				zp_btn = zp_btn.previousSibling;
			}
			zp_btn = zp_btn.cloneNode( true );
			zp_tb.appendChild( zp_btn );
			zp_btn.value = 'zen';
			zp_btn.onclick = edInsertZP;
			zp_btn.title = "Insert a ZENphoto item";
			zp_btn.id = "ed_zp";
		}
		
		function edInsertZP( ) {
			if( !edCheckOpenTags( zp_nr ) ){
				var I = prompt('Give the name of the image' , '.jpg' );
				var A = prompt('Give the name of the album' , '' );
				var O = confirm('Do you want to add all other attributes, so you can edit them?');
				var theTag = '<zen'
				theTag += (I) ? ' image="' + I + '"' : "" 
				theTag += (A) ? ' album="' + A + '"' : "";
				theTag += (O) ? ' size="<?php 
        echo $conf["size"];
        ?>
" showtitle="<?php 
        echo $conf["showtitle"];
        ?>
" />' : ' />'
				edButtons[zp_nr].tagStart  = theTag;
				edInsertTag( edCanvas, zp_nr );
			}
			else {
				edInsertTag( edCanvas, zp_nr );
			}
		}
		
		//-->
		</script>
		<?php 
    }
}