IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » stipsan's snipts The latest snipts from stipsan.

showing 1-20 of 34 snipts
  • ComNinjaboardConverterPhpbb
    <?php
    /**
     * @version		$Id: phpbb.php 606 2010-07-19 00:22:47Z stian $
     * @category	Ninjaboard
     * @copyright	Copyright (C) 2007 - 2010 NinjaForge. All rights reserved.
     * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
     * @link     	http://ninjaforge.com
     */
    
    /**
     * ComNinjaboardConverterPhpbb
     *
     * Imports data from phpBB.
     * 
     * @author Stian Didriksen <stian@ninjaforge.com>
     */
    class ComNinjaboardConverterPhpbb extends ComNinjaboardConverterAbstract
    {
    	/**
    	 * This converter is able to run in steps
    	 *
    	 * @var boolean
    	 */
    	public $splittable = true;
    
    	/**
    	 * Import the sample content
    	 *
    	 * @return $this
    	 */
    	public function convert()
    	{
    		$config = array(
    			'adapter'		=> KFactory::get('lib.joomla.config')->getValue('dbtype'),
    			'username'		=> KRequest::get('post.user', 'cmd', KFactory::get('lib.joomla.config')->getValue('user')),
    			'password'		=> KRequest::get('post.password', 'cmd', KFactory::get('lib.joomla.config')->getValue('password')),
    			'hostspec'		=> KRequest::get('post.host', 'string', KFactory::get('lib.joomla.config')->getValue('host')),
    			'dbname'		=> KRequest::get('post.db', 'string', KFactory::get('lib.joomla.config')->getValue('db')),
    			'table_prefix'	=> KRequest::get('post.dbprefix', 'string', KFactory::get('lib.joomla.config')->getValue('dbprefix'))
    		);
    		//$jdb = KFactory::tmp('lib.koowa.database', $config)->setConnection()->connect();
    		$bdb = KFactory::get('lib.joomla.database');
    		$jdb = new JDatabaseMySQLi(array(
    					'host'	=>	$config['hostspec'],
    					'user'	=>	$config['username'],
    					'password'	=>	$config['password'],
    					'database'	=>	$config['dbname']
    				));
    
    		$db = KFactory::get('lib.koowa.database')
    			->setConnection($jdb->_resource)
    			->setTablePrefix($config['table_prefix']);
    		//*/
    
    		$tables = array(
    			array(
    				'name' => 'forums',
    				'options' => array(
    					'name' => 'forums',
    					'base' => 'forums',
    					'identity_column' => 'forum_id'
    				),
    				'query' => KFactory::tmp('lib.koowa.database.query')
    							->select(array(
    								'*',
    								'forum_name AS title',
    								'forum_desc AS description',
    								'forum_status AS locked',
    								'forum_topics AS topics',
    								'forum_posts AS posts',
    								'forum_last_post_id AS last_post_id'
    							))
    			),
    			array(
    				'name' => 'topics',
    				'options' => array(
    					'name' => 'topics',
    					'base' => 'topics',
    					'identity_column' => 'topic_id'
    				),
    				'query' => KFactory::tmp('lib.koowa.database.query')
    							->select(array(
    								'*',
    								'topic_title AS title',
    								'icon_id AS status',
    								'topic_last_post_id AS last_post_id',
    								'topic_moved_id AS moved_from_forum_id',
    								'topic_first_post_id AS first_post_id',
    								'topic_replies AS replies',
    								'topic_views AS hits'
    							))
    			),
    			array(
    				'name' => 'posts',
    				'options' => array(
    					'name' => 'posts',
    					'base' => 'posts',
    					'identity_column' => 'post_id'
    				),
    				'query' => KFactory::tmp('lib.koowa.database.query')
    							->select(array(
    								'tbl.*',
    								'topic_id AS ninjaboard_topic_id',
    								'icon_id AS status',
    								'poster_id AS created_user_id',
    								'post_time AS created_time',
    								'poster_ip AS user_ip',
    								'post_edit_time AS mofidied_on',
    								'post_edit_reason AS edit_reason',
    								'post_subject AS subject',
    								'post_text AS text'
    							))
    			)
    		);
    
    		//This returns false if the import is big enough to be done in steps.
    		//So we need to stop the importing in this step, in order for it to initiate
    		if($this->importData($tables, 'phpbb') === false) return $this;
    		
    		if(isset($this->data['forums']))
    		{
    			foreach($this->data['forums'] as $id => $forum)
    			{
    				if($forum['forum_parents']) $this->data['forums'][$id]['path'] = '/' . implode('/', array_keys(unserialize($forum['forum_parents']))) . '/';
    				else $this->data['forums'][$id]['path'] = '/';
    			}
    		}
    		
    		///*
    		$db = KFactory::get('lib.koowa.database')
    			->setConnection($bdb->_resource)
    			->setTablePrefix(KFactory::get('lib.joomla.config')->getValue('dbprefix'));
    		//*/
    
    		parent::convert();
    
    		return $this;
    	}
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Jul 25, 2010 at 1:03 p.m. EDT
  • qtip compatible with jq 1.4.2
    eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('"6t 6u";(j($){$(31).3A(j(){R i;$(2g).1M(\'3K 3D\',j(r){1S(i=0;i<$.19.g.O.Q;i++){R T=$.19.g.O[i];c(T&&T.V&&T.V.1b&&T.8.k.17!==\'28\'&&T.d.h.2q(\':2c\')&&(T.8.k.1g.3D&&r.17===\'3D\'||T.8.k.1g.3K&&r.17===\'3K\')){T.2f(r,H)}}});$(31).1M(\'5d.g\',j(r){c($(r.s).52(\'12.g\').Q===0){R h=$(\'.6x\'),T=h.g(\'T\');c(h.2q(\':2c\')&&T&&T.V&&!T.V.22&&$(r.s).2o(T.d.s).Q>1){T.D(r)}}})});j 2D(w){c(!w){B p}A.x=5w(w).3k(/5m/i,\'1j\').5o(/M|25|1j/i)[0].2F();A.y=5w(w).3k(/5m/i,\'1j\').5o(/K|26|1j/i)[0].2F();A.1q={M:0,K:0};A.2y=(w.2H(0).6L(/^(t|b)/)>-1)?\'y\':\'x\';A.1x=j(){B(A.2y===\'y\')?A.y+A.x:A.x+A.y}}j 42(w,o,F){R 1N={5B:[[0,0],[o,F],[o,0]],6a:[[0,0],[o,0],[0,F]],5K:[[0,F],[o,0],[o,F]],5N:[[0,0],[0,F],[o,F]],6z:[[0,F],[o/2,0],[o,F]],6v:[[0,0],[o,0],[o/2,F]],6w:[[0,0],[o,F/2],[0,F]],6J:[[o,0],[o,F],[0,F/2]]};1N.6M=1N.5B;1N.6A=1N.6a;1N.6B=1N.5K;1N.6D=1N.5N;B 1N[w]}j 4d(E){R 2j;c($(\'<1e />\').1p(0).1D){2j={3M:[E,E],4p:[0,E],4h:[E,0],3Q:[0,0]}}C c($.15.1d){2j={3M:[-2z,2z,0],4p:[-2z,2z,-E],4h:[2z,5H,0],3Q:[2z,5H,-E]}}B 2j}j 2G(e,49){R 2U,i;2U=$.2r(H,{},e);1S(i 5R 2U){c(49===H&&(/(f|1f)/i).1Y(i)){3r 2U[i]}C c(!49&&(/(o|J|f|U|1f|4v)/i).1Y(i)){3r 2U[i]}}B 2U}j 45(e){c(P e.f!==\'18\'){e.f={w:e.f}}c(P e.f.N!==\'18\'){e.f.N={o:e.f.N,F:e.f.N}}c(P e.J!==\'18\'){e.J={o:e.J}}c(P e.o!==\'18\'){e.o={2Z:e.o}}c(P e.o.1H===\'1x\'){e.o.1H=1y(e.o.1H.3k(/([0-9]+)/i,"$1"),10)}c(P e.o.2b===\'1x\'){e.o.2b=1y(e.o.2b.3k(/([0-9]+)/i,"$1"),10)}c(P e.f.N.x===\'2n\'){e.f.N.o=e.f.N.x;3r e.f.N.x}c(P e.f.N.y===\'2n\'){e.f.N.F=e.f.N.y;3r e.f.N.y}B e}j 4e(){R 7,i,3z,2v,1F,1P;7=A;3z=[H,{}];1S(i=0;i<35.Q;i++){3z.51(35[i])}2v=[$.2r.4a($,3z)];6G(P 2v[0].20===\'1x\'){2v.5O(45($.19.g.3c[2v[0].20]))}2v.5O(H,{1f:{h:\'g-\'+(35[0].20||\'39\')}},$.19.g.3c.39);1F=$.2r.4a($,2v);1P=($.15.1d)?1:0;1F.f.N.o+=1P;1F.f.N.F+=1P;c(1F.f.N.o%2>0){1F.f.N.o+=1}c(1F.f.N.F%2>0){1F.f.N.F+=1}c(1F.f.w===H){c(7.8.k.w.h===\'1j\'&&7.8.k.w.s===\'1j\'){1F.f.w=p}C{1F.f.w=7.8.k.w.h}}B 1F}j 4b(1e,X,E,I){R 1l=1e.1p(0).1D(\'2d\');1l.5G=I;1l.5U();1l.3y(X[0],X[1],E,0,1t.6N*2,p);1l.5Y()}j 5v(){R 7,i,o,E,I,X,1O,N,4L,2s,3e,3g,43,4M,4o;7=A;7.d.1u.1J(\'.g-3g, .g-3e\').3W();o=7.8.e.J.o;E=7.8.e.J.E;I=7.8.e.J.I||7.8.e.f.I;X=4d(E);1O={};1S(i 5R X){1O[i]=\'<12 1R="\'+i+\'" e="\'+((/6n/).1Y(i)?\'M\':\'25\')+\':0; \'+\'k:34; F:\'+E+\'1a; o:\'+E+\'1a; 2u:1G; 2S-F:0.1B; 2Y-N:1B">\';c($(\'<1e />\').1p(0).1D){1O[i]+=\'<1e F="\'+E+\'" o="\'+E+\'" e="4i-3o: K"></1e>\'}C c($.15.1d){N=E*2+3;1O[i]+=\'<v:3y 5j="p" 3q="\'+I+\'" 6s="\'+X[i][0]+\'" 6r="\'+X[i][1]+\'" \'+\'e="o:\'+N+\'1a; F:\'+N+\'1a; 2p-K:\'+((/26/).1Y(i)?-2:-1)+\'1a; \'+\'2p-M:\'+((/6k/).1Y(i)?X[i][2]-3.5:-1)+\'1a; \'+\'4i-3o:K; 27:5c-4J; 3F:1z(#2L#3L)"></v:3y>\'}1O[i]+=\'</12>\'}4L=7.3d().o-(1t.1H(o,E)*2);2s=\'<12 1K="g-2s" e="F:\'+E+\'1a; o:\'+4L+\'1a; \'+\'2u:1G; 1s-I:\'+I+\'; 2S-F:0.1B; 2Y-N:1B;">\';3e=\'<12 1K="g-3e" 4y="4g" e="F:\'+E+\'1a; \'+\'2p-M:\'+E+\'1a; 2S-F:0.1B; 2Y-N:1B; 2x:0;">\'+1O.3M+1O.4p+2s;7.d.1u.3v(3e);3g=\'<12 1K="g-3g" 4y="4g" e="F:\'+E+\'1a; \'+\'2p-M:\'+E+\'1a; 2S-F:0.1B; 2Y-N:1B; 2x:0;">\'+1O.4h+1O.3Q+2s;7.d.1u.5s(3g);c($(\'<1e />\').1p(0).1D){7.d.1u.1J(\'1e\').1I(j(){43=X[$(A).3N(\'[1R]:1U\').W(\'1R\')];4b.S(7,$(A),43,E,I)})}C c($.15.1d){7.d.h.5s(\'<v:3T e="3F:1z(#2L#3L);"></v:3T>\')}4M=1t.1H(E,(E+(o-E)));4o=1t.1H(o-E,0);7.d.1w.G({J:\'6C 3s \'+I,6I:4o+\'1a \'+4M+\'1a\'})}j 44(1e,X,I){R 1l=1e.1p(0).1D(\'2d\');1l.5G=I;1l.5U();1l.6o(X[0][0],X[0][1]);1l.5Q(X[1][0],X[1][1]);1l.5Q(X[2][0],X[2][1]);1l.5Y()}j 4Q(w){R 7,1P,23,41,40,3S;7=A;c(7.8.e.f.w===p||!7.d.f){B}c(!w){w=2T 2D(7.d.f.W(\'1R\'))}1P=23=($.15.1d)?1:0;7.d.f.G(w[w.2y],0);c(w.2y===\'y\'){c($.15.1d){c(1y($.15.2X.2H(0),10)===6){23=w.y===\'K\'?-3:1}C{23=w.y===\'K\'?1:2}}c(w.x===\'1j\'){7.d.f.G({M:\'50%\',6K:-(7.8.e.f.N.o/2)})}C c(w.x===\'M\'){7.d.f.G({M:7.8.e.J.E-1P})}C{7.d.f.G({25:7.8.e.J.E+1P})}c(w.y===\'K\'){7.d.f.G({K:-23})}C{7.d.f.G({26:23})}}C{c($.15.1d){23=(1y($.15.2X.2H(0),10)===6)?1:(w.x===\'M\'?1:2)}c(w.y===\'1j\'){7.d.f.G({K:\'50%\',4f:-(7.8.e.f.N.F/2)})}C c(w.y===\'K\'){7.d.f.G({K:7.8.e.J.E-1P})}C{7.d.f.G({26:7.8.e.J.E+1P})}c(w.x===\'M\'){7.d.f.G({M:-23})}C{7.d.f.G({25:23})}}41=\'2x-\'+w[w.2y];40=7.8.e.f.N[w.2y===\'x\'?\'o\':\'F\'];7.d.h.G(\'2x\',0).G(41,40);c($.15.1d&&1y($.15.2X.2H(0),6)===6){3S=1y(7.d.f.G(\'2p-K\'),10)||0;3S+=1y(7.d.u.G(\'2p-K\'),10)||0;7.d.f.G({4f:3S})}}j 4w(w){R 7,I,X,3I,2l,f;7=A;c(7.d.f!==1A){7.d.f.3W()}I=7.8.e.f.I||7.8.e.J.I;c(7.8.e.f.w===p){B}C c(!w){w=2T 2D(7.8.e.f.w)}X=42(w.1x(),7.8.e.f.N.o,7.8.e.f.N.F);7.d.f=\'<12 1K="\'+7.8.e.1f.f+\'" 4y="4g" 1R="\'+w.1x()+\'" e="k:34; \'+\'F:\'+7.8.e.f.N.F+\'1a; o:\'+7.8.e.f.N.o+\'1a; \'+\'2p:0 6e; 2S-F:0.1B; 2Y-N:1B;"></12>\';7.d.h.3v(7.d.f);c($(\'<1e />\').1p(0).1D){f=\'<1e F="\'+7.8.e.f.N.F+\'" o="\'+7.8.e.f.N.o+\'"></1e>\'}C c($.15.1d){3I=7.8.e.f.N.o+\',\'+7.8.e.f.N.F;2l=\'m\'+X[0][0]+\',\'+X[0][1];2l+=\' l\'+X[1][0]+\',\'+X[1][1];2l+=\' \'+X[2][0]+\',\'+X[2][1];2l+=\' 6i\';f=\'<v:3P 3q="\'+I+\'" 5j="p" 6p="H" 2l="\'+2l+\'" 3I="\'+3I+\'" \'+\'e="o:\'+7.8.e.f.N.o+\'1a; F:\'+7.8.e.f.N.F+\'1a; \'+\'2S-F:0.1B; 27:5c-4J; 3F:1z(#2L#3L); \'+\'4i-3o:\'+(w.y===\'K\'?\'26\':\'K\')+\'"></v:3P>\';f+=\'<v:3T e="3F:1z(#2L#3L);"></v:3T>\';7.d.1w.G(\'k\',\'4S\')}7.d.f=7.d.h.1J(\'.\'+7.8.e.1f.f).6E(0);7.d.f.2k(f);c($(\'<1e  />\').1p(0).1D){44.S(7,7.d.f.1J(\'1e:1U\'),X,I)}c(w.y===\'K\'&&$.15.1d&&1y($.15.2X.2H(0),10)===6){7.d.f.G({4f:-4})}4Q.S(7,w)}j 5x(){R 7=A;c(7.d.U!==1A){7.d.U.3W()}7.d.h.W(\'3p-6F\',\'g-\'+7.Y+\'-U\');7.d.U=$(\'<12 Y="g-\'+7.Y+\'-U" 1K="\'+7.8.e.1f.U+\'"></12>\').G(2G(7.8.e.U,H)).G({29:($.15.1d)?1:0}).4X(7.d.1w);c(7.8.u.U.1k){7.5W.S(7,7.8.u.U.1k)}c(7.8.u.U.1h!==p&&P 7.8.u.U.1h===\'1x\'){7.d.1h=$(\'<a 1K="\'+7.8.e.1f.1h+\'" 4W="1h" e="6H:25; k: 4S"></a>\').G(2G(7.8.e.1h,H)).2k(7.8.u.U.1h).4X(7.d.U).4V(j(r){c(!7.V.22){7.D(r)}})}}j 5i(){R 7,3h,2m,3t;7=A;3h=7.8.q.L.s;2m=7.8.D.L.s;c(7.8.D.3i){2m=2m.2o(7.d.h)}3t=[\'4V\',\'6h\',\'6l\',\'6j\',\'4R\',\'4T\',\'5d\',\'6m\',\'36\'];j 3w(r){c(7.V.22===H){B}2a(7.1E.1V);7.1E.1V=4D(j(){$(3t).1I(j(){2m.1Q(A+\'.g-1V\');7.d.u.1Q(A+\'.g-1V\')});7.D(r)},7.8.D.2V)}c(7.8.D.3i===H){7.d.h.1M(\'36.g\',j(){c(7.V.22===H){B}2a(7.1E.D)})}j 4C(r){c(7.V.22===H){B}c(7.8.D.L.r===\'1V\'){$(3t).1I(j(){2m.1M(A+\'.g-1V\',3w);7.d.u.1M(A+\'.g-1V\',3w)});3w()}2a(7.1E.q);2a(7.1E.D);c(7.8.q.2V>0){7.1E.q=4D(j(){7.q(r)},7.8.q.2V)}C{7.q(r)}}j 4E(r){c(7.V.22===H){B}c(7.8.D.3i===H&&(/1L(6q|6y)/i).1Y(7.8.D.L.r)&&$(r.70).52(\'12.g[Y^="g"]\').Q>0){r.7L();r.7K();2a(7.1E.D);B p}2a(7.1E.q);2a(7.1E.D);7.d.h.3R(H,H);7.1E.D=4D(j(){7.D(r)},7.8.D.2V)}c(7.8.k.s===\'1L\'&&7.8.k.17!==\'28\'){3h.1M(\'4R.g\',j(r){7.1v.1L={M:r.3Y,K:r.4x};c(7.V.22===p&&7.8.k.1g.1L===H&&7.8.k.17!==\'28\'&&7.d.h.G(\'27\')!==\'3a\'){7.2f(r)}})}c((7.8.q.L.s.2o(7.8.D.L.s).Q===1&&7.8.q.L.r===7.8.D.L.r&&7.8.D.L.r!==\'1V\')||7.8.D.L.r===\'4H\'){7.1v.2I=0;3h.1M(7.8.q.L.r+\'.g\',j(r){c(7.1v.2I===0){4C(r)}C{4E(r)}})}C{3h.1M(7.8.q.L.r+\'.g\',4C);c(7.8.D.L.r!==\'1V\'){2m.1M(7.8.D.L.r+\'.g\',4E)}}c((/(3i|34)/).1Y(7.8.k.17)){7.d.h.1M(\'36.g\',7.2E)}}j 21(){R 7,2k,2t;7=A;2t=7.3d();2k=\'<7J 1K="g-21" 7I="0" 7M="-1" 4G="7N:p" \'+\'e="27:4J; k:34; z-3x:-1; 5n:7R(2B=\\\'0\\\'); J: 1B 3s 4l; \'+\'F:\'+2t.F+\'1a; o:\'+2t.o+\'1a" />\';7.d.21=7.d.1u.3v(2k).2w(\'.g-21:1U\')}j 4c(){R 7,u,1z,Z,2A;7=A;7.5J.S(7);7.V.1b=2;7.d.h=\'<12 g="\'+7.Y+\'" Y="g-\'+7.Y+\'" 4W="h" \'+\'3p-7Q="g-\'+7.Y+\'-u" 1K="g \'+(7.8.e.1f.h||7.8.e)+\'" \'+\'e="27:3a; -7P-J-E:0; -7O-J-E:0; J-E:0; k:\'+7.8.k.17+\';"> \'+\'  <12 1K="g-1u" e="k:4S; 2u:1G; 1k-3o:M;"> \'+\'    <12 1K="g-1w" e="2u:1G;"> \'+\'       <12 Y="g-\'+7.Y+\'-u" 1K="g-u \'+7.8.e.1f.u+\'"></12> \'+\'</12></12></12>\';7.d.h=$(7.d.h);7.d.h.5P(7.8.k.3U);7.d.h.Z(\'g\',{3j:0,O:[7]});7.d.1u=7.d.h.2w(\'12:1U\');7.d.1w=7.d.1u.2w(\'12:1U\');7.d.u=7.d.1w.2w(\'12:1U\').G(2G(7.8.e));c($.15.1d){7.d.1u.2o(7.d.u).G({29:1})}c(7.8.D.L.r===\'4H\'){7.d.h.W(\'4H\',H)}c(P 7.8.e.o.2Z===\'2n\'){7.4s()}c($(\'<1e />\').1p(0).1D||$.15.1d){c(7.8.e.J.E>0){5v.S(7)}C{7.d.1w.G({J:7.8.e.J.o+\'1a 3s \'+7.8.e.J.I})}c(7.8.e.f.w!==p){4w.S(7)}}C{7.d.1w.G({J:7.8.e.J.o+\'1a 3s \'+7.8.e.J.I});7.8.e.J.E=0;7.8.e.f.w=p}c((P 7.8.u.1k===\'1x\'&&7.8.u.1k.Q>0)||(7.8.u.1k.48&&7.8.u.1k.Q>0)){u=7.8.u.1k}C{u=\' \'}c(7.8.u.U.1k!==p){5x.S(7)}7.4U(u,p);5i.S(7);c(7.8.q.3A===H){7.q()}c(7.8.u.1z!==p){1z=7.8.u.1z;Z=7.8.u.Z;2A=7.8.u.2A||\'1p\';7.5Z(1z,Z,2A)}7.V.1b=H;7.4Z.S(7)}j 5k(s,8,Y){R 7=A;7.Y=Y;7.8=8;7.V={4t:p,1b:p,22:p,3Z:p};7.d={s:s.5l(7.8.e.1f.s),h:1A,1u:1A,u:1A,1w:1A,U:1A,1h:1A,f:1A,21:1A};7.1v={W:p,1L:{},2I:0,2u:{M:p,K:p}};7.1E={};$.2r(7,7.8.T,{q:j(r){R 1c,1W;c(!7.V.1b){B p}c(7.d.h.G(\'27\')!==\'3a\'){B 7}7.d.h.3R(H,p);1c=7.5p.S(7,r);c(1c===p){B 7}j 2M(){7.d.h.W(\'3p-1G\',H);c(7.8.k.17!==\'28\'){7.2E()}7.5r.S(7,r);c($.15.1d){R 4B=7.d.h.1p(0).e;4B.4z(\'5n\');4B.4z(\'2B\')}C{7.d.h.G({2B:\'\'})}}7.1v.2I=1;c(7.8.k.17!==\'28\'){7.2f(r,(7.8.q.11.Q>0&&7.1b!==2))}c(P 7.8.q.1W===\'18\'){1W=$(7.8.q.1W)}C c(7.8.q.1W===H){1W=$(\'12.g\').5S(7.d.h)}c(1W){1W.1I(j(){c($(A).g(\'T\').V.1b===H){$(A).g(\'T\').D()}})}c(P 7.8.q.11.17===\'j\'){7.8.q.11.17.S(7.d.h,7.8.q.11.Q);7.d.h.5f(j(){2M();$(A).5g()})}C{4m(7.8.q.11.17.2F()){1X\'3u\':7.d.h.7H(7.8.q.11.Q,2M);1C;1X\'5h\':7.d.h.7G(7.8.q.11.Q,j(){2M();c(7.8.k.17!==\'28\'){7.2f(r,H)}});1C;1X\'5q\':7.d.h.q(7.8.q.11.Q,2M);1C;2L:7.d.h.q(1A,2M);1C}7.d.h.5l(7.8.e.1f.3O)}B 7},D:j(r){R 1c;c(!7.V.1b){B p}C c(7.d.h.G(\'27\')===\'3a\'){B 7}2a(7.1E.q);7.d.h.3R(H,p);1c=7.5t.S(7,r);c(1c===p){B 7}j 2K(){7.d.h.W(\'3p-1G\',H);c($.15.1d){7.d.h.1p(0).e.4z(\'2B\')}C{7.d.h.G({2B:\'\'})}7.5A.S(7,r)}7.1v.2I=0;c(P 7.8.D.11.17===\'j\'){7.8.D.11.17.S(7.d.h,7.8.D.11.Q);7.d.h.5f(j(){2K();$(A).5g()})}C{4m(7.8.D.11.17.2F()){1X\'3u\':7.d.h.7z(7.8.D.11.Q,2K);1C;1X\'5h\':7.d.h.7y(7.8.D.11.Q,2K);1C;1X\'5q\':7.d.h.D(7.8.D.11.Q,2K);1C;2L:7.d.h.D(1A,2K);1C}7.d.h.7x(7.8.e.1f.3O)}B 7},2I:j(r,38){R 5e=/7w|2n/.1Y(P 38)?38:!7.d.h.2q(\':2c\');7[5e?\'q\':\'D\'](r);B 7},2f:j(r,4r){c(!7.V.1b){B p}R 24=8.k,s=$(24.s),2Q=7.d.h.47(),2P=7.d.h.4P(),1m,1n,k,1o=24.w.h,2R=24.w.s,1c,14,i,4k,2h,4j={M:j(){R 3m=$(2g).3G(),3l=$(2g).o()+$(2g).3G(),2J=1o.x===\'1j\'?2Q/2:2Q,2N=1o.x===\'1j\'?1m/2:1m,2O=(1o.x===\'1j\'?1:2)*7.8.e.J.E,1q=-2*24.1g.x,3n=k.M+2Q,1i;c(3n>3l){1i=1q-2J-2N+2O;c(k.M+1i>3m||3m-(k.M+1i)<3n-3l){B{1g:1i,f:\'25\'}}}c(k.M<3m){1i=1q+2J+2N-2O;c(3n+1i<3l||3n+1i-3l<3m-k.M){B{1g:1i,f:\'M\'}}}B{1g:0,f:1o.x}},K:j(){R 30=$(2g).3H(),33=$(2g).F()+$(2g).3H(),2J=1o.y===\'1j\'?2P/2:2P,2N=1o.y===\'1j\'?1n/2:1n,2O=(1o.y===\'1j\'?1:2)*7.8.e.J.E,1q=-2*24.1g.y,32=k.K+2P,1i;c(32>33){1i=1q-2J-2N+2O;c(k.K+1i>30||30-(k.K+1i)<32-33){B{1g:1i,f:\'26\'}}}c(k.K<30){1i=1q+2J+2N-2O;c(32+1i<33||32+1i-33<30-k.K){B{1g:1i,f:\'K\'}}}B{1g:0,f:1o.y}}};c(r&&8.k.s===\'1L\'){2R={x:\'M\',y:\'K\'};1m=1n=0;c(!r.3Y){k=7.1v.1L}C{k={K:r.4x,M:r.3Y}}}C{c(s[0]===31){1m=s.o();1n=s.F();k={K:0,M:0}}C c(s[0]===2g){1m=s.o();1n=s.F();k={K:s.3H(),M:s.3G()}}C c(s.2q(\'7A\')){14=7.8.k.s.W(\'14\').7B(\',\');1S(i=0;i<14.Q;i++){14[i]=1y(14[i],10)}4k=7.8.k.s.3N(\'7F\').W(\'20\');2h=$(\'4K[7E="#\'+4k+\'"]:1U\').1q();k={M:1t.3J(2h.M+14[0]),K:1t.3J(2h.K+14[1])};4m(7.8.k.s.W(\'3P\').2F()){1X\'7T\':1m=1t.55(1t.54(14[2]-14[0]));1n=1t.55(1t.54(14[3]-14[1]));1C;1X\'7C\':1m=14[2]+1;1n=14[2]+1;1C;1X\'7S\':1m=14[0];1n=14[1];1S(i=0;i<14.Q;i++){c(i%2===0){c(14[i]>1m){1m=14[i]}c(14[i]<14[0]){k.M=1t.3J(2h.M+14[i])}}C{c(14[i]>1n){1n=14[i]}c(14[i]<14[1]){k.K=1t.3J(2h.K+14[i])}}}1m=1m-(k.M-2h.M);1n=1n-(k.K-2h.K);1C}1m-=2;1n-=2}C{1m=s.47();1n=s.4P();c(!7.d.h.2q(\':2c\')){7.d.h.G({M:\'-81\'}).q()}c(7.d.h.4n()[0]===31.5b){k=s.1q()}C{k=s.k();k.K+=s.4n().3H();k.M+=s.4n().3G()}}k.M+=2R.x===\'25\'?1m:2R.x===\'1j\'?1m/2:0;k.K+=2R.y===\'26\'?1n:2R.y===\'1j\'?1n/2:0}k.M+=24.1g.x+(1o.x===\'25\'?-2Q:1o.x===\'1j\'?-2Q/2:0);k.K+=24.1g.y+(1o.y===\'26\'?-2P:1o.y===\'1j\'?-2P/2:0);c(7.8.e.J.E>0){c(1o.x===\'M\'){k.M-=7.8.e.J.E}C c(1o.x===\'25\'){k.M+=7.8.e.J.E}c(1o.y===\'K\'){k.K-=7.8.e.J.E}C c(1o.y===\'26\'){k.K+=7.8.e.J.E}}c(24.1g.63){(j(){R 2W={x:0,y:0},2i={x:4j.M(),y:4j.K()},f=2T 2D(8.e.f.w);c(7.d.f&&f){c(2i.y.1g!==0){k.K+=2i.y.1g;f.y=2W.y=2i.y.f}c(2i.x.1g!==0){k.M+=2i.x.1g;f.x=2W.x=2i.x.f}7.1v.2u={M:2W.x===p,K:2W.y===p};c(7.d.f.W(\'1R\')!==f.1x()){4w.S(7,f)}}}())}c(!7.d.21&&$.15.1d&&1y($.15.2X.2H(0),10)===6){21.S(7)}1c=7.5u.S(7,r);c(1c===p){B 7}c(8.k.s!==\'1L\'&&4r===H){7.V.4t=H;7.d.h.3R().4r(k,7V,\'80\',j(){7.V.4t=p})}C{7.d.h.G(k)}7.5z.S(7,r);B 7},4s:j(1r){c(!7.V.1b||(1r&&P 1r!==\'2n\')){B p}R 1G=7.d.1w.7W().2o(7.d.f).2o(7.d.1h),29=7.d.1u.2o(7.d.1w.2w()),h=7.d.h,1H=7.8.e.o.1H,2b=7.8.e.o.2b;c(!1r){c(P 7.8.e.o.2Z===\'2n\'){1r=7.8.e.o.2Z}C{7.d.h.G({o:\'6e\'});1G.D();h.o(1r);c($.15.1d){29.G({29:\'\'})}1r=7.3d().o;c(!7.8.e.o.2Z){1r=1t.2b(1t.1H(1r,2b),1H)}}}c(1r%2){1r+=1}7.d.h.o(1r);1G.q();c(7.8.e.J.E){7.d.h.1J(\'.g-2s\').1I(j(i){$(A).o(1r-(7.8.e.J.E*2))})}c($.15.1d){29.G({29:1});7.d.1u.o(1r);c(7.d.21){7.d.21.o(1r).F(7.3d.F)}}B 7},7Y:j(20){R f,2j,1l,w,X;c(!7.V.1b||P 20!==\'1x\'||!$.19.g.3c[20]){B p}7.8.e=4e.S(7,$.19.g.3c[20],7.8.4v.e);7.d.u.G(2G(7.8.e));c(7.8.u.U.1k!==p){7.d.U.G(2G(7.8.e.U,H))}7.d.1w.G({7U:7.8.e.J.I});c(7.8.e.f.w!==p){c($(\'<1e />\').1p(0).1D){f=7.d.h.1J(\'.g-f 1e:1U\');1l=f.1p(0).1D(\'2d\');1l.5I(0,0,3C,3C);w=f.3N(\'12[1R]:1U\').W(\'1R\');X=42(w,7.8.e.f.N.o,7.8.e.f.N.F);44.S(7,f,X,7.8.e.f.I||7.8.e.J.I)}C c($.15.1d){f=7.d.h.1J(\'.g-f [5C="3P"]\');f.W(\'3q\',7.8.e.f.I||7.8.e.J.I)}}c(7.8.e.J.E>0){7.d.h.1J(\'.g-2s\').G({7X:7.8.e.J.I});c($(\'<1e />\').1p(0).1D){2j=4d(7.8.e.J.E);7.d.h.1J(\'.g-1u 1e\').1I(j(){1l=$(A).1p(0).1D(\'2d\');1l.5I(0,0,3C,3C);w=$(A).3N(\'12[1R]:1U\').W(\'1R\');4b.S(7,$(A),2j[w],7.8.e.J.E,7.8.e.J.I)})}C c($.15.1d){7.d.h.1J(\'.g-1u [5C="3y"]\').1I(j(){$(A).W(\'3q\',7.8.e.J.I)})}}B 7},4U:j(u,5F){R 3b,37,4I;j 4F(){7.4s();c(5F!==p){c(7.8.k.17!==\'28\'){7.2f(7.d.h.2q(\':2c\'),H)}c(7.8.e.f.w!==p){4Q.S(7)}}}c(!u){B p}3b=7.59.S(7,u);c(P 3b===\'1x\'){u=3b}C c(3b===p){B}c(7.V.1b){c($.15.1d){7.d.1w.2w().G({29:\'7Z\'})}c(u.48&&u.Q>0){u.5V(H).5P(7.d.u).q()}C{7.d.u.2k(u)}37=7.d.u.1J(\'4K[6O=p]\');c(37.Q>0){4I=0;37.1I(j(i){$(\'<4K 4G="\'+$(A).W(\'4G\')+\'" />\').7D(j(){c(++4I===37.Q){4F()}})})}C{4F()}}C{7.8.u.1k=u}7.58.S(7);B 7},5Z:j(1z,Z,2A){R 1c;j 4O(u){7.6g.S(7);7.4U(u)}c(!7.V.1b){B p}1c=7.5a.S(7);c(1c===p){B 7}c(2A===\'60\'){$.60(1z,Z,4O)}C{$.1p(1z,Z,4O)}B 7},5W:j(u){R 1c;c(!7.V.1b||!u){B p}1c=7.64.S(7);c(1c===p){B 7}c(7.d.1h){7.d.1h=7.d.1h.5V(H)}7.d.U.2k(u);c(7.d.1h){7.d.U.3v(7.d.1h)}7.65.S(7);B 7},2E:j(r){R 4A,3E,3B,1c;c(!7.V.1b||7.8.k.17===\'28\'){B p}4A=1y(7.d.h.G(\'z-3x\'),10);3E=7u+$(\'12.g[Y^="g"]\').Q-1;c(!7.V.3Z&&4A!==3E){1c=7.5D.S(7,r);c(1c===p){B 7}$(\'12.g[Y^="g"]\').5S(7.d.h).1I(j(){c($(A).g(\'T\').V.1b===H){3B=1y($(A).G(\'z-3x\'),10);c(P 3B===\'2n\'&&3B>-1){$(A).G({68:1y($(A).G(\'z-3x\'),10)-1})}$(A).g(\'T\').V.3Z=p}});7.d.h.G({68:3E});7.V.3Z=H;7.5E.S(7,r)}B 7},3X:j(38){7.V.22=38?H:p;B 7},3f:j(){R i,1c,O,4N=7.d.s.Z(\'46\'+7.1v.W[0]);1c=7.61.S(7);c(1c===p){B 7}c(7.V.1b){7.8.q.L.s.1Q(\'4R.g\',7.2f);7.8.q.L.s.1Q(\'4T.g\',7.D);7.8.q.L.s.1Q(7.8.q.L.r+\'.g\');7.8.D.L.s.1Q(7.8.D.L.r+\'.g\');7.d.h.1Q(7.8.D.L.r+\'.g\');7.d.h.1Q(\'36.g\',7.2E);7.d.h.3W()}C{7.8.q.L.s.1Q(7.8.q.L.r+\'.g-\'+7.Y+\'-4u\')}c(P 7.d.s.Z(\'g\')===\'18\'){O=7.d.s.Z(\'g\').O;c(P O===\'18\'&&O.Q>0){1S(i=0;i<O.Q-1;i++){c(O[i].Y===7.Y){O.5X(i,1)}}}}$.19.g.O.5X(7.Y,1);c(P O===\'18\'&&O.Q>0){7.d.s.Z(\'g\').3j=O.Q-1}C{7.d.s.73(\'g\')}c(4N){7.d.s.W(7.1v.W[0],4N)}7.62.S(7);B 7.d.s},72:j(){R q,1q;c(!7.V.1b){B p}q=(7.d.h.G(\'27\')!==\'3a\')?p:H;c(q){7.d.h.G({3V:\'1G\'}).q()}1q=7.d.h.1q();c(q){7.d.h.G({3V:\'2c\'}).D()}B 1q},3d:j(){R q,2t;c(!7.V.1b){B p}q=(!7.d.h.2q(\':2c\'))?H:p;c(q){7.d.h.G({3V:\'1G\'}).q()}2t={F:7.d.h.4P(),o:7.d.h.47()};c(q){7.d.h.G({3V:\'2c\'}).D()}B 2t}})}$.19.g=j(8,4q){R i,Y,O,1Z,2e,1T,16,T;c(P 8===\'1x\'){c($(A).Z(\'g\')){c(8===\'T\'){B $(A).Z(\'g\').O[$(A).Z(\'g\').3j]}C c(8===\'O\'){B $(A).Z(\'g\').O}}C{B $(A)}}C{c(!8){8={}}c(P 8.u!==\'18\'||(8.u.48&&8.u.Q>0)){8.u={1k:8.u}}c(P 8.u.U!==\'18\'){8.u.U={1k:8.u.U}}c(P 8.k!==\'18\'){8.k={w:8.k}}c(P 8.k.w!==\'18\'){8.k.w={s:8.k.w,h:8.k.w}}c(P 8.q!==\'18\'){8.q={L:8.q}}c(P 8.q.L!==\'18\'){8.q.L={r:8.q.L}}c(P 8.q.11!==\'18\'){8.q.11={17:8.q.11}}c(P 8.D!==\'18\'){8.D={L:8.D}}c(P 8.D.L!==\'18\'){8.D.L={r:8.D.L}}c(P 8.D.11!==\'18\'){8.D.11={17:8.D.11}}c(P 8.e!==\'18\'){8.e={20:8.e}}8.e=45(8.e);1Z=$.2r(H,{},$.19.g.39,8);1Z.e=4e.S({8:1Z},1Z.e);1Z.4v=$.2r(H,{},8)}B $(A).1I(j(){R 7=$(A),u=p;c(P 8===\'1x\'){1T=8.2F();O=$(A).g(\'O\');c(P O===\'18\'){c(4q===H&&1T===\'3f\'){1S(i=O.Q-1;i>-1;i--){c(\'18\'===P O[i]){O[i].3f()}}}C{c(4q!==H){O=[$(A).g(\'T\')]}1S(i=0;i<O.Q;i++){c(1T===\'3f\'){O[i].3f()}C c(O[i].V.1b===H){c(1T===\'q\'){O[i].q()}C c(1T===\'D\'){O[i].D()}C c(1T===\'2E\'){O[i].2E()}C c(1T===\'3X\'){O[i].3X(H)}C c(1T===\'71\'){O[i].3X(p)}C c(1T===\'7v\'){O[i].2f()}}}}}}C{16=$.2r(H,{},1Z);16.D.11.Q=1Z.D.11.Q;16.q.11.Q=1Z.q.11.Q;c(16.k.3U===p){16.k.3U=$(31.5b)}c(16.k.s===p){16.k.s=$(A)}c(16.q.L.s===p){16.q.L.s=$(A)}c(16.D.L.s===p){16.D.L.s=$(A)}16.k.w.h=2T 2D(16.k.w.h);16.k.w.s=2T 2D(16.k.w.s);c(!16.u.1k.Q){$([\'U\',\'6f\']).1I(j(i,W){R 2C=7.W(W);c(2C&&2C.Q){u=[W,2C];7.Z(\'46\'+W,2C).74(W);16.u.1k=2C.3k(/\\n/75,\'<78 />\');B p}})}Y=$.19.g.O.Q;1S(i=0;i<Y;i++){c(P $.19.g.O[i]===\'56\'){Y=i;1C}}2e=2T 5k($(A),16,Y);$.19.g.O[Y]=2e;2e.1v.W=u;c(P $(A).Z(\'g\')===\'18\'&&$(A).Z(\'g\')){c(P $(A).W(\'g\')===\'56\'){$(A).Z(\'g\').3j=$(A).Z(\'g\').O.Q}$(A).Z(\'g\').O.51(2e)}C{$(A).Z(\'g\',{3j:0,O:[2e]})}c(16.u.5y===p&&16.q.L.r!==p&&16.q.3A!==H){16.q.L.s.1M(16.q.L.r+\'.g-\'+Y+\'-4u\',{g:Y},j(r){T=$.19.g.O[r.Z.g];T.8.q.L.s.1Q(T.8.q.L.r+\'.g-\'+r.Z.g+\'-4u\');T.1v.1L={M:r.3Y,K:r.4x};4c.S(T);T.8.q.L.s.77(T.8.q.L.r)})}C{2e.1v.1L={M:16.q.L.s.1q().M,K:16.q.L.s.1q().K};4c.S(2e)}}})};$.19.g.O=[];$.19.g.19={W:$.19.W};$.19.W=j(W){R T=$(A).g(\'T\');B(35.Q===1&&(/U|6f/i).1Y(W)&&T.V&&T.V.1b===H)?$(A).Z(\'46\'+T.1v.W[0]):$.19.g.19.W.4a(A,35)};$.19.g.39={u:{5y:p,1k:p,1z:p,Z:1A,U:{1k:p,1h:p}},k:{s:p,w:{s:\'3Q\',h:\'3M\'},1g:{x:0,y:0,1L:H,63:p,3D:H,3K:H},17:\'34\',3U:p},q:{L:{s:p,r:\'36\'},11:{17:\'3u\',Q:5T},2V:76,1W:p,3A:p},D:{L:{s:p,r:\'4T\'},11:{17:\'3u\',Q:5T},2V:0,3i:p},T:{5J:j(){},4Z:j(){},5u:j(){},5z:j(){},5p:j(){},5r:j(){},5t:j(){},5A:j(){},59:j(){},58:j(){},5a:j(){},6g:j(){},64:j(){},65:j(){},61:j(){},62:j(){},5D:j(){},5E:j(){}}};$.19.g.3c={39:{1s:\'66\',I:\'#6Z\',2u:\'1G\',6Y:\'M\',o:{2b:0,1H:6S},2x:\'6R 6Q\',J:{o:1,E:0,I:\'#6P\'},f:{w:p,I:p,N:{o:13,F:13},2B:1},U:{1s:\'#6T\',6U:\'6X\',2x:\'6W 6V\'},1h:{79:\'7a\'},1f:{s:\'\',f:\'g-f\',U:\'g-U\',1h:\'g-1h\',u:\'g-u\',3O:\'g-3O\'}},5L:{J:{o:3,E:0,I:\'#7o\'},U:{1s:\'#7n\',I:\'#5M\'},1s:\'#7m\',I:\'#5M\',1f:{h:\'g-5L\'}},6c:{J:{o:3,E:0,I:\'#7p\'},U:{1s:\'#7q\',I:\'#6d\'},1s:\'66\',I:\'#6d\',1f:{h:\'g-6c\'}},69:{J:{o:3,E:0,I:\'#7t\'},U:{1s:\'#7s\',I:\'#67\'},1s:\'#7r\',I:\'#67\',1f:{h:\'g-69\'}},4l:{J:{o:3,E:0,I:\'#7l\'},U:{1s:\'#7k\',I:\'#6b\'},1s:\'#7e\',I:\'#6b\',1f:{h:\'g-4l\'}},4Y:{J:{o:3,E:0,I:\'#7d\'},U:{1s:\'#7c\',I:\'#53\'},1s:\'#7b\',I:\'#53\',1f:{h:\'g-4Y\'}},57:{J:{o:3,E:0,I:\'#7f\'},U:{1s:\'#7g\',I:\'#7j\'},1s:\'#7i\',I:\'#7h\',1f:{h:\'g-57\'}}}}(82));',62,499,'|||||||self|options||||if|elements|style|tip|qtip|tooltip||function|position||||width|false|show|event|target||content||corner||||this|return|else|hide|radius|height|css|true|color|border|top|when|left|size|interfaces|typeof|length|var|call|api|title|status|attr|coordinates|id|data||effect|div||coords|browser|config|type|object|fn|px|rendered|returned|msie|canvas|classes|adjust|button|adj|center|text|context|targetWidth|targetHeight|my|get|offset|newWidth|background|Math|wrapper|cache|contentWrapper|string|parseInt|url|null|1px|break|getContext|timers|finalStyle|hidden|max|each|find|class|mouse|bind|tips|containers|ieAdjust|unbind|rel|for|command|first|inactive|solo|case|test|opts|name|bgiframe|disabled|positionAdjust|posOptions|right|bottom|display|static|zoom|clearTimeout|min|visible||obj|updatePosition|window|imagePos|adapted|borders|html|path|hideTarget|number|add|margin|is|extend|betweenCorners|dimensions|overflow|styleExtend|children|padding|precedance|90|method|opacity|val|Corner|focus|toLowerCase|jQueryStyle|charAt|toggle|myOffset|afterHide|default|afterShow|atOffset|borderAdjust|elemHeight|elemWidth|at|line|new|styleObj|delay|adjusted|version|font|value|topEdge|document|pBottom|bottomEdge|absolute|arguments|mouseover|images|state|defaults|none|parsedContent|styles|getDimensions|borderTop|destroy|borderBottom|showTarget|fixed|current|replace|rightEdge|leftEdge|pRight|align|aria|fillcolor|delete|solid|inactiveEvents|fade|prepend|inactiveMethod|index|arc|styleArray|ready|elemIndex|300|scroll|newIndex|behavior|scrollLeft|scrollTop|coordsize|floor|resize|VML|topLeft|parent|active|shape|bottomRight|stop|newMargin|image|container|visiblity|remove|disable|pageX|focused|paddingSize|paddingCorner|calculateTip|borderCoord|drawTip|sanitizeStyle|old|outerWidth|jquery|sub|apply|drawBorder|construct|calculateBorders|buildStyle|marginTop|ltr|bottomLeft|vertical|adapt|mapName|red|switch|offsetParent|vertWidth|topRight|blanket|animate|updateWidth|animated|create|user|createTip|pageY|dir|removeAttribute|curIndex|ieStyle|showMethod|setTimeout|hideMethod|afterLoad|src|unfocus|loadedImages|block|img|betweenWidth|sideWidth|oldattr|setupContent|outerHeight|positionTip|mousemove|relative|mouseout|updateContent|click|role|prependTo|green|onRender||push|parents|58792E|abs|ceil|undefined|blue|onContentUpdate|beforeContentUpdate|beforeContentLoad|body|inline|mouseenter|condition|queue|dequeue|slide|assignEvents|stroked|QTip|addClass|middle|filter|match|beforeShow|grow|onShow|append|beforeHide|beforePositionUpdate|createBorder|String|createTitle|prerender|onPositionUpdate|onHide|bottomright|nodeName|beforeFocus|onFocus|reposition|fillStyle|270|clearRect|beforeRender|topright|cream|A27D35|topleft|unshift|appendTo|lineTo|in|not|100|beginPath|clone|updateTitle|splice|fill|loadContent|post|beforeDestroy|onDestroy|screen|beforeTitleUpdate|onTitleUpdate|white|f3f3f3|zIndex|dark|bottomleft|9C2F2F|light|454545|auto|alt|onContentLoad|dblclick|xe|mouseup|Right|mousedown|mouseleave|Left|moveTo|filled|out|endangle|startangle|use|strict|bottomcenter|rightcenter|qtipSelector|leave|topcenter|righttop|leftbottom|0px|rightbottom|eq|labelledby|while|float|borderWidth|leftcenter|marginLeft|search|lefttop|PI|complete|d3d3d3|9px|5px|250|e1e1e1|fontWeight|12px|7px|bold|textAlign|111|relatedTarget|enable|getPosition|removeData|removeAttr|gi|140|trigger|br|cursor|pointer|CDE6AC|b9db8c|A9DB66|F79992|ADD9ED|D0E9F5|4D9FBF|E5F6FE|5E99BD|f28279|CE6F6F|FBF7AA|F0DE7D|F9E98E|E2E2E2|f1f1f1|505050|404040|303030|15000|update|boolean|removeClass|slideUp|fadeOut|area|split|circle|load|usemap|map|slideDown|fadeIn|frameborder|iframe|preventDefault|stopPropagation|tabindex|javascript|webkit|moz|describedby|alpha|poly|rect|borderColor|200|siblings|backgroundColor|updateStyle|normal|swing|10000000em|jQuery'.split('|'),0,{}))
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Jul 13, 2010 at 11:36 a.m. EDT
  • ComNinjaboardModelAttachments
    <?php
    /**
     * @version		$Id: attachments.php 443 2010-04-28 01:19:48Z stian $
     * @category	Ninjaboard
     * @copyright	Copyright (C) 2007 - 2010 NinjaForge. All rights reserved.
     * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
     * @link     	http://ninjaforge.com
     */
    
    /**
     * Ninjaboard Attachments model
     *
     * Fetches posts' attachments
     * 
     * @author Stian Didriksen <stian@ninjaforge.com>
     */
    class ComNinjaboardModelAttachments extends KModelTable
    {
    	
    	/**
    	 * Only attachments that are images
    	 *
    	 * @var array
    	 */
    	protected $_images = array();
    	
    	/**
    	 * Only attachments that are isn't images
    	 *
    	 * @var array
    	 */
    	protected $_files = array();
    
    	/**
    	 * Constructor
         *
         * @param	array An optional associative array of configuration settings.
    	 */
    	public function __construct(KConfig $options)
    	{
    		parent::__construct($options);
    
    		$this->_state
    						->insert('file', 'cmd')
    						->insert('post', 'int')
    						->insert('id'  , 'int');
    	}
    	
    	protected function _buildQueryWhere(KDatabaseQuery $query)
    	{
    		parent::_buildQueryWhere($query);
    
    		if($file = $this->_state->file) $query->where('tbl.file'	, '=', $file, 'and');
    		if($post = $this->_state->post) $query->where('tbl.post_id'	, '=', $post, 'and');
    	}
    	
    	public function getList()
    	{
    		if(!isset($this->_list))
    		{
    			require_once JPATH_ROOT.'/components/com_media/helpers/media.php';
    
    			foreach(parent::getList() as $item)
    			{
    				$item->type = MediaHelper::getTypeIcon($item->file);
    				if(MediaHelper::isImage($item->file))
    				{
    					$this->_images[] = $item;
    				}
    				else
    				{
    					$this->_files[] = $item;
    				}
    			}
    		}
    
    		return $this->_list;
    	}
    	
    	/**
    	 * Get only attachments that are images
    	 */
    	public function getImages()
    	{
    		if(!isset($this->_list)) $this->getList();
    
    		return $this->_images;
    	}
    	
    	/**
    	 * Get only attachments that isn't images
    	 */
    	public function getFiles()
    	{
    		if(!isset($this->_list)) $this->getList();
    
    		return $this->_files;
    	}
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Jun 08, 2010 at 9:59 a.m. EDT
  • delaing with file uploads
    <?php
    class ComFooControllerBar extends KControllerView
    	public function setAttachments()
    	{
    		$context		= $this->getCommandChain()->getContext();
    		$data			= $context['result'];
    		$err			= null;
    		$errors			= array();
    		$identifier		= $this->getIdentifier();
    		$destination	= JPATH_ROOT.'/media/'.$identifier->type.'_'.$identifier->package.'/attachments/';
    		$attachments	= array();
    		
    		require_once JPATH_ROOT.'/components/com_media/helpers/media.php';
    
    		$files = KRequest::get('files.attachments.name', 'raw', array());
    		foreach ($files as $i => $file)
    		{
    			foreach (KRequest::get('files.attachments', 'raw') as $key => $values)
    			{
    				$attachment[$key] = KRequest::get('files.attachments.'.$key.'.'.$i, 'raw');
    			}
    			if(MediaHelper::canUpload($attachment, $err)) $attachments[] = $attachment;
    			else $errors[] = array_merge($attachment, array('error' => $err));
    		}
    		
    		foreach ($attachments as $attachment)
    		{
    			$upload = JFile::makeSafe(uniqid(time())).'.'.JFile::getExt($attachment['name']);
    	
    			JFile::upload($attachment['tmp_name'], $destination.$upload);
    			KFactory::tmp('site::com.ninjaboard.model.attachments')
    				->post($data->id)
    				->getItem()
    				->setData(array('post_id' => $data->id, 'file' => $upload, 'name' => $attachment['name']))
    				->save();
    		}
    		
    		foreach ($errors as $error)
    		{
    			JError::raiseWarning(21, sprintf(JText::_("%s couldn't upload because %s"), $error['name'], lcfirst($error['error'])));
    		}
    		
    		foreach (KRequest::get('post.attachments', 'int', array()) as $attachment)
    		{
    			$item = KFactory::tmp('site::com.ninjaboard.model.attachments')
    					->id($attachment)
    					->getItem();
    
    			if(JFile::exists($destination.$item->file)) JFile::delete($destination.$item->file);
    			$item->delete();
    		}		
    	}
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Jun 08, 2010 at 9:14 a.m. EDT
  • KViewJsonp
    <?php
    /**
     * @version     $Id: json.php 1924 2010-04-25 22:22:10Z johanjanssens $
     * @category	Koowa
     * @package     Koowa_View
     * @copyright   Copyright (C) 2007 - 2010 Johan Janssens and Mathias Verraes. All rights reserved.
     * @license     GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
     * @link     	http://www.koowa.org
     */
    
    /**
     * View JSONP Class
     *
     * JSON with Padding. Allows cross domain json requests by using the script tag.
     *
     * @see			http://mootools.net/docs/more/Request/Request.JSONP
     * @see			http://api.jquery.com/jQuery.getJSON/
     * @see			http://en.wikipedia.org/wiki/JSON#JSONP
     * @see			http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/
     * @see			http://developer.yahoo.com/common/json.html#callbackparam
     *
     * @author      Stian Didriksen <stian@nooku.org>
     * @category	Koowa
     * @package     Koowa_View
     */
    class KViewJsonp extends KViewJson
    {
    	/**
    	 * Constructor
    	 *
    	 * @param 	object 	An optional KConfig object with configuration options
    	 */
    	public function __construct(KConfig $config)
    	{
    		parent::__construct($config);
    
    		//Set the correct mime type
    		$this->_document->setMimeEncoding('application/javascript');
    	}
    
    	/**
    	 * Renders and echo's the views output wrapping it in a js callback
     	 *
    	 * @return KViewJsonp
    	 */
        public function display()
        {	
    		$callback = KRequest::get('get.callback', 'cmd');
        	
        	echo $callback . '(';
        	parent::display();
        	echo ');';
        	
        	return $this;
        }
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Jun 07, 2010 at 6:23 p.m. EDT
  • Koowa sef patch
    --- /plugins/system/koowa.php	Fri Apr 30 02:50:24 2010
    +++ /plugins/system/koowa.php	Mon May 17 15:17:15 2010
    @@ -93,6 +93,43 @@
     	}
     	
     	/**
    +	 * Sets the GET request after route
    +	 *
    +	 * This is crucial for SEF mode compatibility.
    +	 * Unfortunately, when the routing is done, the parsed URI request is set in the $_REQUEST global,
    +	 * only some of the variables are set in the $_GET global. Important ones like the 'view' variable is not set in $_GET.
    +	 * 
    +	 * So in order to fix it, we do the following:
    +	 * 	1. get and clone the current JURI instance.
    +	 *	2. Fetch the router from the application instance.
    +	 *	3. Call the routers parse method on the JURI instance.
    +	 *	4. Set the result in the $_GET global, without overwriting the existing variables
    +	 *
    +	 * @see JApplication::route()
    +	 * @see JRequest::setVar()
    +	 * @see KDispatcherDefault::_actionDispatch() 
    +	 *
    +	 * @author Stian Didriksen <stian@nooku.org>
    +	 * @return void
    +	 */
    +	public function onAfterRoute()
    +	{
    +		$uri = clone(JURI::getInstance());
    +
    +		/**
    +		 * @TODO figure out how to use KRequest::url
    +		 * Currently a BadMethodCallException 'Call to undefined method :getPath' from /includes/router.php(50)
    +		 * is thrown if we try using it.
    +		 */
    +		//$uri = KRequest::url();
    +
    +		$router = KFactory::get('lib.koowa.application')->getRouter();
    +		$result = $router->parse($uri);
    +
    +		KRequest::set('get', KHelperArray::merge($result, KRequest::get('get', 'raw')));
    +	}
    +
    +	/**
     	 * Prettify the output using Tidy filter (if available) and debug has been
     	 * enabled
     	 *
    

    copy | embed

    0 comments - tagged in  posted by stipsan on May 17, 2010 at 9:20 a.m. EDT
  • PlgKoowaScout
    <?php
    /**
     * @package   Scout
     * @author    Dioscouri Design
     * @link      http://www.dioscouri.com
     * @copyright Copyright (C) 2010 Dioscouri Design. All rights reserved.
     * @license   http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
    */
    
    /**
     * PlgKoowaScout
     *
     * Plugin for Scout that logs every add, edit and delete event in every Nooku Framework powered extension
     * 
     * @author Stian Didriksen <stian@nooku.org>
     */
    class PlgKoowaScout extends PlgKoowaDefault
    {
    	/**
    	 * Constructor
    	 *
    	 * Prevents plugin from being executed if Scout isn't installed
    	 *
    	 * @param  $dispatcher
    	 * @param  $config
    	 */
    	public function __construct($dispatcher, $config = array())
    	{
    		if(!$this->isInstalled()) return false;
    
    		JTable::addIncludePath( JPATH_ADMINISTRATOR . '/components/com_scout/tables' );
    
    		parent::__construct($dispatcher, $config);
    	}
    
    	/**
    	 * controller.after.read event
    	 *
    	 * records read topics
    	 *
    	 * @author Stian Didriksen <stian@nooku.org>
    	 * @param  $context
    	 */
    	public function onControllerAfterRead(KCommandcontext $context)
    	{
    		$this->createLogEntry($context);
    	}
    	
    	/**
    	 * controller.after.add event
    	 *
    	 * records when something is added
    	 *
    	 * @author Stian Didriksen <stian@nooku.org>
    	 * @param  $context
    	 */
    	public function onControllerAfterAdd(KCommandcontext $context)
    	{
    		$this->createLogEntry($context, 'created');
    	}
    	
    	/**
    	 * controller.after.edit event
    	 *
    	 * records when something is edit
    	 *
    	 * @author Stian Didriksen <stian@nooku.org>
    	 * @param  $context
    	 */
    	public function onControllerAfterEdit(KCommandcontext $context)
    	{
    		$this->createLogEntry($context, 'modified');
    	}
    	
    	/**
    	 * controller.after.delete event
    	 *
    	 * records when something is deleted
    	 *
    	 * @author Stian Didriksen <stian@nooku.org>
    	 * @param  $context
    	 */
    	public function onControllerAfterDelete(KCommandcontext $context)
    	{
    		$this->createLogEntry($context, 'deleted');
    	}
    
    	/**
    	 * Determines if Scout is installed
    	 * and registers necessary classes with the autoloader
    	 * 
    	 * @return boolean
    	 */
    	public function isInstalled()
    	{
    		jimport( 'joomla.filesystem.file' );
    		return JFile::exists(JPATH_ADMINISTRATOR.'/components/com_scout/defines.php');
    	}
    
    	/**
    	 * Create a Scout log entry of site activity
    	 *
    	 * Usage, using controller.after.read as example:<pre>
    	 * public function onControllerAfterRead(KCommandcontext $context)
    	 * {
    	 *     $this->createLogEntry($context);
    	 * }
    	 * </pre>
    	 * 
    	 * @param  KCommandcontext $context
    	 * 
    	 * @return boolean
    	 */
    	public function createLogEntry(KCommandcontext $context, $action = false)
    	{
    		if ( !$this->isInstalled() || JFactory::getUser()->guest ) return;
    
    		//The caller is a reference to the object that is triggering this event
    		$caller = $context['caller'];
    
    		//the result will contain the result of the controller action.
    		$result = $context['result'];
    
    		//The identifier
    		$identifier = $caller->getIdentifier();
    		
    		if(is_a($result, 'KDatabaseRowAbstract')) $result = array($result);
    		
    		foreach($result as $row)
    		{
    			// get the object if possible
    			if (!$object = $this->getObject( $context, $row )) return;
    	
    			// get a scout logs object
    			$log = JTable::getInstance( 'Logs', 'ScoutTable' );
    	  
    			// set the subject
    			$log->setSubject(array( 'value' => JFactory::getUser()->id, 'name' => JFactory::getUser()->name, 'type' => 'user' ));
    	
    			// set the verb and object
    			if(!$action) $action = $caller->getAction();
    			$log->setVerb(array( 'value' => $action, 'name' => JText::_(KInflector::humanize($action)) ));
    			$log->setObject($object);
    	  
    			$log->save();
    		}
    	}
    
    
    	/**
    	 * Sets the object array 
    	 * Sets it with some default values if not being set manually
    	 * to make its creation as easy as possible
    	 * 
    	 * @return array
    	 */
    	public function getObject( KCommandcontext $context, $result = false, $object = array() )
    	{
    
    		//The caller is a reference to the object that is triggering this event
    		$caller = $context['caller'];
    
    		// The event result is usually a data row
    		if(!$result) $result = $context['result'];
    
    		// Get the caller identifier
    		$identifier = $caller->getIdentifier();
    
    		$object = new KConfig($object);
    	
    		$object->append(array(
    			'value'				=> $result->id,
    			'name'				=>  isset($result->title) ? $result->title : 'Untitled',
    			'scope_identifier'	=> 'option=com_' . $identifier->package . '&view=' . $identifier->name,
    			'scope_name'		=> JText::_(KInflector::humanize($identifier->package)) . ' / ' . KInflector::humanize($identifier->name),
    			'scope_url'			=> 'index.php?option=com_' . $identifier->package . '&view=' . $identifier->name . '&id=',
    			'client_id'			=> $identifier->application == 'admin'
    		));
    
    		if (empty($object->value) || empty($object->name) || empty($object->scope_identifier)) return false;
    
      		return $object->toArray();
    	}
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on May 10, 2010 at 11:37 a.m. EDT
  • CURL OOP wrapper
    <?php
    
    /**
    * OO cURL Class
    * Object oriented wrapper for the cURL library.
    * @author David Hopkins (semlabs.co.uk)
    * @version 0.3
    */
    class CURL
    {
    	
    	public $sessions 				=	array();
    	public $retry					=	0;
    	
    	/**
    	* Adds a cURL session to stack
    	* @param $url string, session's URL
    	* @param $opts array, optional array of cURL options and values
    	*/
    	public function addSession( $url, $opts = false )
    	{
    		$this->sessions[] = curl_init( $url );
    		if( $opts != false )
    		{
    			$key = count( $this->sessions ) - 1;
    			$this->setOpts( $opts, $key );
    		}
    	}
    	
    	/**
    	* Sets an option to a cURL session
    	* @param $option constant, cURL option
    	* @param $value mixed, value of option
    	* @param $key int, session key to set option for
    	*/
    	public function setOpt( $option, $value, $key = 0 )
    	{
    		curl_setopt( $this->sessions[$key], $option, $value );
    	}
    	
    	/**
    	* Sets an array of options to a cURL session
    	* @param $options array, array of cURL options and values
    	* @param $key int, session key to set option for
    	*/
    	public function setOpts( $options, $key = 0 )
    	{
    		curl_setopt_array( $this->sessions[$key], $options );
    	}
    	
    	/**
    	* Executes as cURL session
    	* @param $key int, optional argument if you only want to execute one session
    	*/
    	public function exec( $key = false )
    	{
    		$no = count( $this->sessions );
    		
    		if( $no == 1 )
    			$res = $this->execSingle();
    		elseif( $no > 1 ) {
    			if( $key === false )
    				$res = $this->execMulti();	
    			else
    				$res = $this->execSingle( $key );
    		}
    		
    		if( $res )
    			return $res;
    	}
    	
    	/**
    	* Executes a single cURL session
    	* @param $key int, id of session to execute
    	* @return array of content if CURLOPT_RETURNTRANSFER is set
    	*/
    	public function execSingle( $key = 0 )
    	{
    		if( $this->retry > 0 )
    		{
    			$retry = $this->retry;
    			$code = 0;
    			while( $retry >= 0 && ( $code[0] == 0 || $code[0] >= 400 ) )
    			{
    				$res = curl_exec( $this->sessions[$key] );
    				$code = $this->info( $key, CURLINFO_HTTP_CODE );
    				
    				$retry--;
    			}
    		}
    		else
    			$res = curl_exec( $this->sessions[$key] );
    		
    		return $res;
    	}
    	
    	/**
    	* Executes a stack of sessions
    	* @return array of content if CURLOPT_RETURNTRANSFER is set
    	*/
    	public function execMulti()
    	{
    		$mh = curl_multi_init();
    		
    		#Add all sessions to multi handle
    		foreach ( $this->sessions as $i => $url )
    			curl_multi_add_handle( $mh, $this->sessions[$i] );
    		
    		do
    			$mrc = curl_multi_exec( $mh, $active );
    		while ( $mrc == CURLM_CALL_MULTI_PERFORM );
    		
    		while ( $active && $mrc == CURLM_OK )
    		{
    			if ( curl_multi_select( $mh ) != -1 )
    			{
    				do
    					$mrc = curl_multi_exec( $mh, $active );
    				while ( $mrc == CURLM_CALL_MULTI_PERFORM );
    			}
    		}
    
    		if ( $mrc != CURLM_OK )
    			echo "Curl multi read error $mrc\n";
    		
    		#Get content foreach session, retry if applied
    		foreach ( $this->sessions as $i => $url )
    		{
    			$code = $this->info( $i, CURLINFO_HTTP_CODE );
    			if( $code[0] > 0 && $code[0] < 400 )
    				$res[] = curl_multi_getcontent( $this->sessions[$i] );
    			else
    			{
    				if( $this->retry > 0 )
    				{
    					$retry = $this->retry;
    					$this->retry -= 1;
    					$eRes = $this->execSingle( $i );
    					
    					if( $eRes )
    						$res[] = $eRes;
    					else
    						$res[] = false;
    						
    					$this->retry = $retry;
    					echo '1';
    				}
    				else
    					$res[] = false;
    			}
    
    			curl_multi_remove_handle( $mh, $this->sessions[$i] );
    		}
    
    		curl_multi_close( $mh );
    		
    		return $res;
    	}
    	
    	/**
    	* Closes cURL sessions
    	* @param $key int, optional session to close
    	*/
    	public function close( $key = false )
    	{
    		if( $key === false )
    		{
    			foreach( $this->sessions as $session )
    				curl_close( $session );
    		}
    		else
    			curl_close( $this->sessions[$key] );
    	}
    	
    	/**
    	* Remove all cURL sessions
    	*/
    	public function clear()
    	{
    		foreach( $this->sessions as $session )
    			curl_close( $session );
    		unset( $this->sessions );
    	}
    	
    	/**
    	* Returns an array of session information
    	* @param $key int, optional session key to return info on
    	* @param $opt constant, optional option to return
    	*/
    	public function info( $key = false, $opt = false )
    	{
    		if( $key === false )
    		{
    			foreach( $this->sessions as $key => $session )
    			{
    				if( $opt )
    					$info[] = curl_getinfo( $this->sessions[$key], $opt );
    				else
    					$info[] = curl_getinfo( $this->sessions[$key] );
    			}
    		}
    		else
    		{
    			if( $opt )
    				$info[] = curl_getinfo( $this->sessions[$key], $opt );
    			else
    				$info[] = curl_getinfo( $this->sessions[$key] );
    		}
    		
    		return $info;
    	}
    	
    	/**
    	* Returns an array of errors
    	* @param $key int, optional session key to retun error on
    	* @return array of error messages
    	*/
    	public function error( $key = false )
    	{
    		if( $key === false )
    		{
    			foreach( $this->sessions as $session )
    				$errors[] = curl_error( $session );
    		}
    		else
    			$errors[] = curl_error( $this->sessions[$key] );
    			
    		return $errors;
    	}
    	
    	/**
    	* Returns an array of session error numbers
    	* @param $key int, optional session key to retun error on
    	* @return array of error codes
    	*/
    	public function errorNo( $key = false )
    	{
    		if( $key === false )
    		{
    			foreach( $this->sessions as $session )
    				$errors[] = curl_errno( $session );
    		}
    		else
    			$errors[] = curl_errno( $this->sessions[$key] );
    			
    		return $errors;
    	}
    	
    }
    
    ?>
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Apr 09, 2010 at 6:40 a.m. EDT
  • ComNinjaboardControllerPost
    <?php
    class ComNinjaboardControllerPost extends ComNinjaboardControllerDefault
    {	
    	public function setAttachments()
    	{
    		$context		= $this->getCommandChain()->getContext();
    		$data			= $context['result'];
    		$err			= null;
    		$errors			= array();
    		$identifier		= $this->getIdentifier();
    		$destination	= JPATH_ROOT.'/media/'.$identifier->type.'_'.$identifier->package.'/attachments/';
    		$attachments	= array();
    		
    		require_once JPATH_ROOT.'/components/com_media/helpers/media.php';
    
    		$files = KRequest::get('files.attachments.name', 'raw', array());
    		foreach ($files as $i => $file)
    		{
    			foreach (KRequest::get('files.attachments', 'raw') as $key => $values)
    			{
    				$attachment[$key] = KRequest::get('files.attachments.'.$key.'.'.$i, 'raw');
    			}
    			if(MediaHelper::canUpload($attachment, &$err)) $attachments[] = $attachment;
    			else $errors[] = array_merge($attachment, array('error' => $err));
    		}
    		
    		foreach ($attachments as $attachment)
    		{
    			$upload = JFile::makeSafe(uniqid(time())).'.'.JFile::getExt($attachment['name']);
    	
    			JFile::upload($attachment['tmp_name'], $destination.$upload);
    			KFactory::tmp('site::com.ninjaboard.model.attachments')
    				->post($data->id)
    				->getItem()
    				->setData(array('post_id' => $data->id, 'file' => $upload, 'name' => $attachment['name']))
    				->save();
    		}
    		
    		foreach ($errors as $error)
    		{
    			JError::raiseWarning(21, sprintf(JText::_("%s couldn't upload because %s"), $error['name'], lcfirst($error['error'])));
    		}
    		
    		foreach (KRequest::get('post.attachments', 'int', array()) as $attachment)
    		{
    			$item = KFactory::tmp('site::com.ninjaboard.model.attachments')
    					->id($attachment)
    					->getItem();
    
    			if(JFile::exists($destination.$item->file)) JFile::delete($destination.$item->file);
    			$item->delete();
    		}		
    	}
    }
    ?>
    
    <? /** $Id: form.php 393 2010-03-30 23:41:07Z stian $ */ ?>
    <? defined( 'KOOWA' ) or die( 'Restricted access' ) ?>
    
    <? @$js('/jquery.pack.js') ?>
    
    <script type="text/javascript">
    	jQuery.noConflict();
    	(function($){
    		$(document).ready(function(){
    			$("#addFile").click(function () {
    				$("#attachments")
    					.append('<li><a class="remove" href="#" title="<?= @text('Remove') ?>">&#10006; <?= @text('Remove') ?></a><input type="file" name="attachments[]" /></li>')
    					.find('.remove')
    					.click(function(){
    						$(this).parent().remove();
    						return false;
    					});
    				return false;
    			});
    		});
    	})(jQuery);
    </script>
    
    <form action="<?= @route('topic='.@$topic->id.'&forum='.@$topic->forum_id.'&id='.@$post->id) ?>" method="post" id="<?= @$helper('formid') ?>" class="ninjaboard" enctype="multipart/form-data">
    	<fieldset class="adminform ninja-form">
    		<div class="element">
    			<span class="key"><?= @text('Attachments') ?></span>
    			<div class="value">
    				<a href="#" class="button" id="addFile"><?= @text('Add File') ?></a>
    				<ul id="attachments">
    					<? foreach (@$attachments as $attachment) : ?>
    					<li>
    						<label for="<?= $id = @$helper('formid', 'attachments-'.$attachment->id) ?>" title="<?= @text('Remove') ?>" ><?= @text('Remove') ?><input type="checkbox" name="attachments[]" value="<?= $attachment->id ?>" id="<?= $id ?>"></label>
    						<?= $attachment->file ?>
    					</li>
    					<? endforeach ?>
    				</ul>
    			</div>
    		</div>
    	</fieldset>
    </form>
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Mar 31, 2010 at 9:01 a.m. EDT
  • ComProfilesHelperMedia
    <?php 
    /**
     * @version		$Id: media.php 386 2010-02-26 01:38:06Z stian $
     * @category	Koowa
     * @package		Koowa_Template
     * @subpackage	Helper
     * @copyright	Copyright (C) 2007 - 2009 Johan Janssens and Mathias Verraes. All rights reserved.
     * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
     * @link     	http://www.koowa.org
     */
     
    /**
     * Template Media Helper
     *
     * Used for loading assets like javascript, stylesheets, images and 
     * other things you find in the extensions' media folder.
     * The assets are overridable in joomla templates,
     * and have a koowa fallback.
     *
     * When Koowa itself use this helper to load assets, 
     * then the extension can easily override things like the fw javascripts.
     * Useful if you're in for using jQuery for instance.
     *
     * @author		Stian Didriksen <stian@ninjaforge.com>
     * @category	Koowa
     * @package		Koowa_Template
     * @subpackage	Helper
     */
    class ComProfilesHelperMedia extends KObject
    {
    	/**
    	 * Get the full image path from a relative image path.
    	 * 
    	 * If the image don't exist, return a negative boolean so we can use it in conditional statements.
    	 *
    	 * This utility is on purpose not returning an image element, just the path.
    	 * The usage examples show why this is.
    	 *
    	 * <code>
    	 *
    	 * // Used for an image element
    	 * <img src="<?= @helper('media.img', '/logo.png') ?>" alt="App icon" />
    	 * // May result in
    	 * <img src="/media/com_profiles/images/logo.png" alt="App icon" />
    	 *
    	 * // Used in css, conditionally
    	 * <style type="text/css">
    	 * .icon-48-generic {
    	 * <? if ( $img = @helper('media.img', '/logo.png') ) : ?>
    	 *     background-url: url(<?= $img ?>);
    	 * <? else : ?>
    	 *     background-url: url(<?= KRequest::base() ?>/templates/khepri/images/header/icon-48-generic.png);
    	 * <? endif ?>
    	 * }
    	 *
    	 * </style>
    	 *
    	 * </code>
    	 *
    	 * @author	Stian Didriksen <stian@ninjaforge.com>
    	 * @param	string $src
    	 * @return	string | boolean
    	 */
    	public function img($src)
    	{
    		return self::_getAsset('images', $src);
    	}
    	
    	/**
    	 * Utility for adding internal stylesheets that are 3-step overridable (koowa, extension, joomla tempalte),
    	 * adding remote stylesheets or by absolute urls,
    	 * and for adding styledeclarations.
    	 * 
    	 * If you're adding an internal stylesheets, in other words by relative path,
    	 * if the stylesheets turns out to not exist it'll return an boolean.
    	 *
    	 * You don't have to define wether you're passing an declaration, relative or absolute path.
    	 * There's just one argument, and what you're passing to it is figured out by koowa auto-magically.
    	 *
    	 * <code>
    	 *
    	 * // External stylesheet
    	 * <?= @helper('media.css', 'http://example.com/style.css') ?>
    	 * // results in the following added to your document head
    	 * <link rel="stylesheet" href="http://example.com/style.css" />
    	 *
    	 * // Internal stylesheet, with 3 potential results in com_foo
    	 * <?= @helper('media.css', '/toolbar.css') ?>
    	 * // 1. Overriden by template
    	 * <link rel="stylesheet" href="/administrator/templates/khepri/css/com_foo/toolbar.css" />
    	 * // 2. The component has it
    	 * <link rel="stylesheet" href="/media/com_foo/css/toolbar.css" />
    	 * // 3. Fallback to koowa
    	 * <link rel="stylesheet" href="/media/plg_koowa/css/toolbar.css" />
    	 *
    	 * // Inline declaration
    	 * <?= @helper('media.css', "
    	 * // Removing firefox's ugly dotted border
    	 * .toolbar a:focus { outline: none }
    	 * ") ?>
    	 * //Results in
    	 * <style type="text/css">
    	 * // Removing firefox's ugly dotted border
    	 * .toolbar a:focus { outline: none }
    	 * </style>
    	 *
    	 * </code>
    	 *
    	 * @author	Stian Didriksen <stian@ninjaforge.com>
    	 * @param	string $href
    	 * @return	string | boolean
    	 */
    	public function css($href = false)
    	{
    		$document = KFactory::get('lib.koowa.document');
    		if	( KFactory::get('lib.koowa.filter.url')->validate($href) )
    		{
    			$document->addStylesheet($href);
    		}
    		else if	( strpos( $href, '{' ) )
    		{
    			$document->addStyleDeclaration($href);
    		}
    		else if	( $href = self::_getAsset('css', $href) )
    		{
    			$document->addStylesheet($href);
    		}
    		else
    		{
    			return false;
    		}
    
    		return $href;
    	}
    	
    	/**
    	 * Adds scripts the same way the css method does css.
    	 *
    	 * In addition to the 3-step flow the css helper got, the javascript helper got one extra step that makes it able to switch mode based on the current active js framework.
    	 * Meaning you can have multiple versions of a script.
    	 * Or you could have a special jQuery version of the toolbar js in Koowa, and only override Koowas when jQuery is active and much more!
    	 * 
    	 * If you're adding an internal scripts, in other words by relative path,
    	 * if the stylesheets turns out to not exist it'll return an negative boolean.
    	 *
    	 * You don't have to define wether you're passing an declaration, relative or absolute path.
    	 * There's just one argument, and what you're passing to it is figured out by koowa auto-magically.
    	 *
    	 * The current active js framework is fetched from the behavior.framework call.
    	 * You can change the current framework by calling the following in your template layout:
    	 * <code><? @helper('behavior.framework', 'jquery') ?></code>
    	 * or this in your regular php
    	 * KTemplate::loadHelper('behavior.framework', 'jquery');
    	 *
    	 * <code>
    	 *
    	 * // External script
    	 * <?= @helper('media.js', 'http://example.com/app.js') ?>
    	 * // results in the following added to your document head
    	 * <script type="text/javascript" src="http://example.com/app.js"></script>
    	 *
    	 * // Internal script, with 5 potential results in com_foo
    	 * <?= @helper('media.js', '/toolbar.js') ?>
    	 * // 1. Overriden by template when jquery is active
    	 * <script type="text/javascript" src="/administrator/templates/khepri/js/com_foo/jquery/toolbar.js"></script>
    	 * // 2. Overriden by extension when jquery is active
    	 * <script type="text/javascript" src="/media/com_foo/js/jquery/toolbar.js"></script>
    	 * // 3. Overriden by template when the js isn't in a framework specific folder
    	 * <script type="text/javascript" src="/administrator/templates/khepri/js/com_foo/toolbar.js"></script>
    	 * // 4. The component has it but not in a framework specific folder
    	 * <script type="text/javascript" src="/media/com_foo/js/toolbar.js"></script>
    	 * // 5. Fallback to koowa
    	 * <script type="text/javascript" src="/media/plg_koowa/js/toolbar.js"></script>
    	 *
    	 *
    	 * // Inline declaration
    	 * <?= @helper('media.js', "window.addEvent('domready', function(){ $('ice-cream').mixin(); });") ?>
    	 * //Results in
    	 * <script type="text/javascript">window.addEvent('domready', function(){ $('ice-cream').mixin(); });</script>
    	 *
    	 * </code>
    	 *
    	 * @author	Stian Didriksen <stian@ninjaforge.com>
    	 * @param	string $href
    	 * @return	string | boolean
    	 */
    	public function js($href = false)
    	{
    		$document = KFactory::get('lib.koowa.document');
    		if(KFactory::get('lib.koowa.filter.url')->validate($href))
    		{
    			$document->addScript($href);
    		}
    		elseif(strpos($href, '(') || strpos($href, 'var') === 0)
    		{
    			$document->addScriptDeclaration($href);
    		}
    		elseif($src = self::_getAsset('js', '/'.KTemplate::loadHelper('behavior.framework').$href))
    		{
    			$document->addScript($href = $src);
    		}
    		elseif($href = self::_getAsset('js', $href))
    		{
    			$document->addScript($href);
    		}
    		else
    		{
    			return false;
    		}
    
    		return $href;		
    	}
    	
    	/**
    	 * Internal function used for getting assets paths for internal files.
    	 *
    	 * 3-step fallback. Joomla template => current extension => koowa.
    	 * The asset argument can be a path, 
    	 * as seen in the js method for giving overridability to framework specific js.
    	 *
    	 * @author	Stian Didriksen <stian@ninjaforge.com>
    	 * @param	string $asset
    	 * @param	string $url
    	 * @return	string | boolean
    	 */
    	protected function _getAsset($asset, $url)
    	{
    		$extension = KRequest::get('get.option', 'cmd');
    		$template  = KFactory::get('lib.koowa.application')->getTemplate();
    		$framework = '/media/plg_koowa/'.$asset.$url;
    		$default   = '/media/'.$extension.'/'.$asset.$url;
    		$overriden = '/templates/'.$template.'/'.$extension.'/'.$asset.$url;
    
    		if(file_exists(JPATH_BASE.$overriden))		return KRequest::base().$overriden;
    		elseif(file_exists(JPATH_ROOT.$default))	return KRequest::root().$default;
    		elseif(file_exists(JPATH_ROOT.$framework))	return KRequest::root().$framework;
            
    		return false;
    	}
    	
    	/**
    	 * Magic method for loading other assets.
    	 *
    	 * Got the same 3-step fallback as images got.
    	 * Can be very useful if you got a fonts folder, or have an upload api with progress bars using flash.
    	 *
    	 * <code>
    	 *
    	 * // Getting a flash player in com_player, got the same 3-step fallback as images, css and js got.
    	 * <?= @helper('media.js', 'yt.setConfig(' . json_encode( array('SWF_URL' => @helper('media.swf', '/player.swf') ) ) . ');') ?>
    	 * //results in
    	 * <script type="text/javascript">
    	 *		yt.setConfig({"SWF_URL":"/media/com_player/swf/player.swf"});
    	 * </script>
    	 *
    	 * </code>
    	 *
    	 * @author	Stian Didriksen <stian@ninjaforge.com>
    	 * @param	string $asset
    	 * @param	string $url
    	 * @return	string | boolean
    	 */
    	public function __call($m, $a) 
    	{
    		return self::_getAsset($m, $a[0]);
    	}
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 26, 2010 at 8:24 a.m. EST
  • Example component xml manifest
    <?xml version="1.0" encoding="utf-8"?>
    <install type="component" version="1.5.0" method="upgrade">
    	<name>Foo</name>
    	<author>John Doe</author>
    	<creationDate>2012-12-21 00:00</creationDate>
    	<copyright>(C) 2009-2010 ACME inc. All rights reserved.</copyright>
    	<license>GNU/GPL</license>
    	<authoremail>john@example.com</authoremail>
    	<authorurl>example.com</authorurl>
    	<version status="Beta">1.0.0</version>
    	<revision>279</revision>
    	<description>Lorem ipsum dolor sit amet.</description>
    </install>
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 24, 2010 at 9:59 a.m. EST
  • Ninjaboard basic xml manifest (only showing the metadata part)
    <?xml version="1.0" encoding="utf-8"?>
    <install type="component" version="1.5.0" method="upgrade" mootools="1.2">
    	<name>Ninjaboard</name>
    	<author>NinjaForge</author>
    	<creationDate>2009-02-21</creationDate>
    	<copyright>(C) 2007-2010 Ninja Media Group. All rights reserved.</copyright>
    	<license>GNU/GPL</license>
    	<csslicense>CC-BY</csslicense>
    	<jslicense>MIT</jslicense>
    	<authoremail>support@ninjaforge.com</authoremail>
    	<authorurl>ninjaforge.com</authorurl>
    	<version status="Alpha3" color="red">1.0.0</version>
    	<revision>279</revision>
    	<description>The sharpest user forum</description>
    </install>
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 23, 2010 at 6:30 p.m. EST
  • SetRevisionTask for Phing
    <?php
    /*
     * $Id: SetRevisionTask.php 89 2010-01-27 14:33:53Z stian $
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     * This software consists of voluntary contributions made by many individuals
     * and is licensed under the LGPL. For more information please see
     * <http://phing.info>.
     */
    require_once 'phing/Task.php';
    
     /**
      * SetRevisionTask
      *
      * Updates an xml manifest with the revision number from the supplied property
      *
      * @author      Stian Didriksen <stian@ninjaforge.com>
      * @version     $Id: SetRevisionTask.php 89 2010-01-27 14:33:53Z stian $
      * @package     napi.phing.tasks
      */
    class SetRevisionTask extends Task
    {
        /**
         * Property for File
         * @var PhingFile file
         */
        private $file;
    
        /**
         * Property to be set
         * @var string $property
         */
        private $property;
    
        /**
         * Set Property for File containing versioninformation
         * @param PhingFile $file
         */
        public function setFile($file)
        {
            $this->file = $file;
        }
        
        /**
         * Set
         * @param $property
         * @return
         */
        public function setProperty($property)
        {
            $this->property = $property;
        }
    
        /**
         * Main-Method for the Task
         *
         * @return  void
         * @throws  BuildException
         */
        public function main()
        {
            // check supplied attributes
            $this->checkFile();
            $this->checkProperty();
    
            // load file
            $xml = simplexml_load_file($this->file);
    
            // set new version, overwriting the old one
            $xml = $this->setRevision($xml);
    
            // write the new xml to the old xml file
            $xml->asXML($this->file);
        }
    
        /**
         * Sets the new revision number
         *
         * @param SimpleXMLElement $xml
         * @return SimpleXMLElement
         */
        private function setRevision($xml)
        {
        	$xml->revision = $this->property;
    
            return $xml;
        }
    
        /**
         * checks file attribute
         * @return void
         * @throws BuildException
         */
        private function checkFile()
        {
            // check File
            if ($this->file === null ||
            strlen($this->file) == 0) {
                throw new BuildException('You must specify an xml file containing the <revision> tag.', $this->location);
            }
    
            $content = file_get_contents($this->file);
            if (strlen($content) == 0) {
                throw new BuildException(sprintf('Supplied file %s is empty', $this->file), $this->location);
            }
    
        }
    
        /**
         * checks property attribute
         * @return void
         * @throws BuildException
         */
        private function checkProperty()
        {
            if (is_null($this->property) ||
                strlen($this->property) === 0) {
                throw new BuildException('Property for revision number is not set', $this->location);
            }
        }
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 23, 2010 at 6:28 p.m. EST
  • GetVersionTask for Phing
    <?php
    /*
     * $Id: GetVersionTask.php 88 2010-01-27 14:32:06Z stian $
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     * This software consists of voluntary contributions made by many individuals
     * and is licensed under the LGPL. For more information please see
     * <http://phing.info>.
     */
    require_once 'phing/Task.php';
    
     /**
      * GetVersionTask
      *
      * Reads an Xml manifest and retrieves the version string
      * Resulting version number is also published under supplied property.
      *
      * Based on VersionTask by Mike Wittje <mw@mike.wittje.de>
      *
      * @author      Stian Didriksen <stian@ninjaforge.com>
      * @version     $Id: GetVersionTask.php 88 2010-01-27 14:32:06Z stian $
      * @package     napi.phing.tasks
      */
    class GetVersionTask extends Task
    {
        /**
         * Property for File
         * @var PhingFile file
         */
        private $file;
    
        /**
         * Property to be set
         * @var string $property
         */
        private $property;
    
        /**
         * Set Property for File containing versioninformation
         * @param PhingFile $file
         */
        public function setFile($file)
        {
            $this->file = $file;
        }
    
        /**
         * Set
         * @param $property
         * @return
         */
        public function setProperty($property)
        {
            $this->property = $property;
        }
    
        /**
         * Main-Method for the Task
         *
         * @return  void
         * @throws  BuildException
         */
        public function main()
        {
            // check supplied attributes
            $this->checkFile();
            $this->checkProperty();
    
            // load file
            $xml = simplexml_load_file($this->file);
    
            // get new version
            $newVersion = $this->getVersion($xml);
    
            // publish new version number as property
            $this->project->setProperty($this->property, $newVersion);
    
        }
    
        /**
         * Returns new version number
         *
         * @param SimpleXMLElement $xml
         * @return string
         */
        private function getVersion($xml)
        {
            // Extract version
            $newVersion = (string) $xml->version;
            
            // Append status, if the status attribute exists
            if(isset($xml->version['status'])) $newVersion .= (string) $xml->version['status'];
    
            return $newVersion;
        }
    
        /**
         * checks file attribute
         * @return void
         * @throws BuildException
         */
        private function checkFile()
        {
            // check File
            if ($this->file === null ||
            strlen($this->file) == 0) {
                throw new BuildException('You must specify an xml file containing the version number', $this->location);
            }
    
            $content = file_get_contents($this->file);
            if (strlen($content) == 0) {
                throw new BuildException(sprintf('Supplied file %s is empty', $this->file), $this->location);
            }
    
        }
    
        /**
         * checks property attribute
         * @return void
         * @throws BuildException
         */
        private function checkProperty()
        {
            if (is_null($this->property) ||
                strlen($this->property) === 0) {
                throw new BuildException('Property for publishing version number is not set', $this->location);
            }
        }
    }
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 23, 2010 at 6:27 p.m. EST
  • Phing script using GetVersionTask and SetRevisionTask
    <?xml version="1.0" ?>  
    <project name="Example" basedir=".." default="build">
    
    	<taskdef name="getversion" classname="GetVersionTask" classpath="scripts/tasks" />
    	<taskdef name="setrevision" classname="SetRevisionTask" classpath="scripts/tasks" />
    
    	<target name="prepare">
    	
    		<svnlastrevision workingcopy="." propertyname="svn.lastrevision" />
    		<setrevision file="code/administrator/components/com_foo/foo.xml" property="${svn.lastrevision}" />
    	
    		<delete dir="tmp" includeemptydirs="true" />
    		
    		<copy todir="tmp" >
    		  <fileset dir="code">
    		  	<exclude name=".**" />
    		  </fileset>
    		</copy>
    		
    		<move file="tmp/administrator/components/com_foo/foo.xml" tofile="tmp/foo.xml" />
    		<copy todir="tmp/install">
    			<fileset dir="tmp/administrator/components/com_foo/install/">
    			    <exclude name=".**" />
    			  </fileset>
    		</copy>
    		
    	</target>
    	<target name="build">
    		<phingcall target="prepare" />
    		
    		<svnlastrevision workingcopy="." propertyname="svn.lastrevision" />
    		<getversion file="tmp/foo.xml" property="ext.version" />
    		
    		<mkdir dir="packages" /> 
    				
    		<tar destfile="packages/com_foo_v${ext.version}_rev${svn.lastrevision}.tar">
    			<fileset dir="tmp" />
    		</tar>
    		
    		<delete dir="tmp" includeemptydirs="true" />
    		
    	</target>
    	
    </project>
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 23, 2010 at 6:26 p.m. EST
  • Phing script for updating koowa snapshot
    <?xml version="1.0" ?>  
    <project name="Update Koowa snapshot" basedir=".." default="build">
    
    	<target name="build">
    
    		<!-- Get the koowa plugin -->
    		<svnexport username="" password="" repositoryurl="https://nooku-framework.svn.sourceforge.net/svnroot/nooku-framework/trunk/code/" todir="code" nocache="true" force="true" />
    		<move file="code/koowa.xml" tofile="code/plugins/system/koowa.xml" overwrite="true"/>
    
    	</target>
    
    </project>
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 23, 2010 at 6:01 p.m. EST
  • KTabs with Cookies for MooTools 1.12
    /**
     * @version		$Id: koowa.js 1051 2009-07-13 22:08:57Z Johan $
     * @category    Koowa
     * @package     Koowa_Media
     * @subpackage  Javascript
     * @copyright	Copyright (C) 2007 - 2009 Johan Janssens and Mathias Verraes. All rights reserved.
     * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
     * @link     	http://www.koowa.org
     */
     
    /**
     * Tabs behavior
     *
     * @package     Koowa_Media
     * @subpackage	Javascript
     */
    var KTabs = new Class({
    
        options: {
        
            display: 	0,
            
            height:		null,
    
            onActive: function(title, description){
                description.setStyle('display', 'block');
                title.removeClass('open').addClass('closed');
            },
    
            onBackground: function(title, description){
            	for(i=0; i<title.length; i++){
            		description[i].setStyle('display', 'none');
            		title[i].addClass('open').removeClass('closed');
            	}
            }
        },
    
        initialize: function(dlist, options)
        {
            this.dlist = $(dlist);
            this.setOptions(options);
            this.titles = this.dlist.getElements('dt');
            this.descriptions = this.dlist.getElements('dd');
            this.content = new Element('div').injectAfter(this.dlist).addClass('current');
              
            if(this.options.height) {
            	this.content.setStyle('height', this.options.height);
            }
    
            for (var i = 0, l = this.titles.length; i < l; i++)
            {
                var title = this.titles[i];
                title.setStyle('cursor', 'pointer');
                title.addEvent('click', this.display.bind(this, i));
            }
            this.descriptions.injectInside(this.content);
    		
    		if(Cookie.get('ktabs.' + dlist)) this.options.display = Cookie.get('ktabs.' + dlist);
            if ($chk(this.options.display)) this.display(this.options.display);
    
            if (this.options.initialize) this.options.initialize.call(this);
        },
    
        hideAllBut: function(but)
        {
            this.fireEvent('onBackground', [this.titles.filter(function(e, index){ return index !== but; }), this.descriptions.filter(function(e, index){ return index !== but; })]);
        },
        
        display: function(i)
        {
        	Cookie.set('ktabs.' + this.dlist.getProperty('id'), i);
            this.hideAllBut(i);
            this.fireEvent('onActive', [this.titles[i], this.descriptions[i]])
        }
    });
    
    KTabs.implement(new Events, new Options);
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 17, 2010 at 4:04 p.m. EST
  • String.Extras.js and String.Slugify.js backported to M1.11
    /*
    ---
    
    script: String.Extras.js
    
    description: Extends the String native object with a couple of useful utilities; Like a slugify method, useful for url slugs.
    
    license: MIT-style license
    
    authors: Stian Didriksen
    
    requires:
    - core:1.11/String
    - core:1.11/Array
    
    provides: [String.Extras]
    
    ...
    */
    
    (function(){
    
    var special = ['À','à','Á','á','Â','â','Ã','ã','Ä','ä','Å','å','?','?','?','?','?','?','?','?','Ç','ç', '?','?','?','?', 'È','è','É','é','Ê','ê','Ë','ë','?','?','?','?', '?','?','Ì','ì','Í','í','Î','î','Ï','ï', '?','?','?','?','?','?', 'Ñ','ñ','?','?','?','?','Ò','ò','Ó','ó','Ô','ô','Õ','õ','Ö','ö','Ø','ø','?','?','?','?','?','Š','š','?','?','?','?', '?','?','?','?','?','?','Ù','ù','Ú','ú','Û','û','Ü','ü','?','?', 'Ÿ','ÿ','ý','Ý','Ž','ž','?','?','?','?', 'Þ','þ','Ð','ð','ß','Œ','œ','Æ','æ','µ'];
    
    var standard = ['A','a','A','a','A','a','A','a','Ae','ae','A','a','A','a','A','a','C','c','C','c','C','c','D','d','D','d', 'E','e','E','e','E','e','E','e','E','e','E','e','G','g','I','i','I','i','I','i','I','i','L','l','L','l','L','l', 'N','n','N','n','N','n', 'O','o','O','o','O','o','O','o','Oe','oe','O','o','o', 'R','r','R','r', 'S','s','S','s','S','s','T','t','T','t','T','t', 'U','u','U','u','U','u','Ue','ue','U','u','Y','y','Y','y','Z','z','Z','z','Z','z','TH','th','DH','dh','ss','OE','oe','AE','ae','u'];
    
    var tidymap = {
    	"[\xa0\u2002\u2003\u2009]": " ",
    	"\xb7": "*",
    	"[\u2018\u2019]": "'",
    	"[\u201c\u201d]": '"',
    	"\u2026": "...",
    	"\u2013": "-",
    	"\u2014": "--",
    	"\uFFFD": "&raquo;"
    };
    
    String.extend({
    
    	standardize: function(){
    		var text = this;
    		special.each(function(ch, i){
    			text = text.replace(new RegExp(ch, 'g'), standard[i]);
    		});
    		return text;
    	},
    
    	tidy: function(){
    		var txt = this.toString();
    		$each(tidymap, function(value, key){
    			txt = txt.replace(new RegExp(key, 'g'), value);
    		});
    		return txt;
    	},
    
    	slugify: function(){
    
    		var txt = this.toString().tidy().standardize().replace(/\s+/g,'-').toLowerCase().replace(/[^a-z0-9\-]/g,'');
    		
    		return txt;
    	}
    
    });
    
    })();
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 15, 2010 at 12:23 p.m. EST
  • alias generator mootools 1.2
    window.addEvent('domready', function(){
    		var aliasvalidator = function(){
    			this.value = this.value.replace(/&(.)[^;]*;/, '$1').replace(/ /g, '-').toLowerCase();
    		};
    		var titlevalidator = function(){
    			if(!$('alias').defaultValue) $('alias').value = this.value.replace(/&(.)[^;]*;/, '$1').replace(/ /g, '-').toLowerCase(); 
    		};
    		
    		$('title').addEvents({'keyup': titlevalidator, 'keydown': titlevalidator, 'blur': titlevalidator});
    		$('alias').addEvents({'blur': aliasvalidator});
    		
    	});
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 15, 2010 at 3:10 a.m. EST
  • using mamp in the os x terminal
    export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php5/bin/:/opt/local/bin:/opt/local/sbin:$PATH
    

    copy | embed

    0 comments - tagged in  posted by stipsan on Feb 09, 2010 at 5:48 a.m. EST
Sign up to create your own snipts, or login.