javascript Class Reference

Cette classe construit les appel js. More...

List of all members.

Public Member Functions

Public Attributes

Private Member Functions


Detailed Description

Cette classe construit les appel js.

Elle accepte des script en standalone

Si un framework est déclaré, alors les script ne necessite que des info mini

Definition at line 17 of file page.javascript.php.


Constructor & Destructor Documentation

javascript::__construct (  ) 

Definition at line 34 of file page.javascript.php.

00034                         {
00035     global $page;
00036 //     $this->framework
00037     $this->script=array();
00038   }


Member Function Documentation

javascript::add_framework ( name,
opt = '' 
)

Ajout d'un framework, comme maitre des scripts.

Les script enfant doivent ere nommé prefix_script.name script.js

Parameters:
$name 
$opt 

Definition at line 58 of file page.javascript.php.

Referenced by add_multi().

00058                                                {
00059     $dir= dirname($name);
00060     $file=basename($name);
00061     $opt=(!is_array($opt))? array() : $opt ;
00062     $this->framework['name']=$file;
00063     $this->framework['path']=$dir.'/';
00064     $this->framework=array_merge($this->framework, $opt);
00065     $this->framework['prefix_script']=(isset($option['prefix_script']))?$option['prefix_script']: '';
00066     /*
00067       @param option[mode] (ponctuel, permanent)
00068       Cette option charge le framework systhematiquement, ou sur demande
00069     */
00070     $this->framework['mode']=(isset($option['mode']))?$option['mode']: 'ponctuel';
00071   }

javascript::add_init_header ( array  )  [private]

Add pile des init.

Parameters:
$array 

Definition at line 156 of file page.javascript.php.

Referenced by add_multi().

00156                                           {
00157     $this->init[]=$array;
00158   }

javascript::add_multi ( def  ) 

Definition via le retour des options de plugins.

Parameters:
$def 

Definition at line 165 of file page.javascript.php.

00165                           {
00166     global $page;
00167     if (!is_array($def)) return false;
00168     reset($def);
00169     while($r=each($def)) {
00170       $type=(isset($r['value']['type'])) ? $r['value']['type'] : 'script';
00171       switch($type){
00172         case 'framework':
00173            $this->add_framework($r['value']['file'], $r['value']);
00174         break;
00175         case 'function':
00176            $this->add_init_header($r['value']);
00177         break;
00178         case 'del_script':
00179            $this->del_script($r['value']['file']);
00180         break;
00181         case 'script':
00182         default:
00183           if (isset($r['value']['file']) && is_array($r['value']['file'])){
00184             foreach($r['value']['file'] as $key=>$value){
00185               if(isset($r['value']['place']) && $r['value']['place']=='footer') $page->add_file_footer($value,array('sort'=>$r['value']['sort']));
00186               elseif(!isset($r['value']['place']) || $r['value']['place']=='header')  $this->add_script($value, array('sort'=>$r['value']['sort']) );
00187             }
00188           }
00189       }
00190       unset($r);
00191     }
00192 
00193   }

javascript::add_script ( script,
opt = '' 
)

Ajout de script (lib/file) au chargeur.

Parameters:
$script string
$opt array

Definition at line 79 of file page.javascript.php.

Referenced by add_multi(), and replace_script().

00079                                               {
00080     $dir= dirname($script);
00081     $file=basename($script);
00082     $opt=(!is_array($opt))? array() : $opt ;
00083 
00084     if (!isset($this->script[$file])){
00085       $this->script[$file]['path']=$dir.'/';
00086       $this->script[$file]['file']=$file;
00087       $this->script[$file]=array_merge($this->script[$file], $opt);
00088       return true;
00089     }
00090     else return false;
00091   }

javascript::add_script_src ( array,
opt = '' 
)

add src inline, but load in header

Parameters:
$script file or key
$opt array

Definition at line 99 of file page.javascript.php.

00099                                                  {
00100     $file=$array['file'];
00101     $script= $array['script'];
00102     $opt=(!is_array($opt))? array() : $opt ;
00103 
00104     if (!isset($this->script[$file])){
00105       $this->script[$file]['script']=$script;
00106       $this->script[$file]=array_merge($this->script[$file], $opt);
00107       return true;
00108     }
00109     else return false;
00110   }

javascript::call_back (  ) 

Definition at line 246 of file page.javascript.php.

00246                       {
00247   }

javascript::cstr_footer (  ) 

Definition at line 243 of file page.javascript.php.

00243                         {
00244   }

javascript::cstr_header (  ) 

Appel dans la function draw_header du constructeur de page Fabrication des liens, et des contenu print.

Appel element ACA get_header_js

Definition at line 200 of file page.javascript.php.

00200                         {
00201     global $page;
00202 
00203     if (isset($this->framework['name'])) $page->add_file_header($this->framework['path'].$this->framework['name'],array('sort'=>3));
00204 
00206     if( ($name=$page->the_type()) && ($page->return_object($name) !=false) ) {
00207       $class=$page->return_object($name);
00208       if(method_exists($class, 'get_header_js' )) $class->get_header_js();
00209     }
00210 
00211     while ($e=each($this->script)){
00212       if(isset($e['value']['file']))  {
00213         $s=(isset($e['value']['sort']))? $e['value']['sort'] : 5;
00214         if(!isset($e['value']['place']) || $e['value']['place']=='header') $page->add_file_header($e['value']['path'].$e['value']['file'],array('sort'=>$s));
00215         elseif(isset($e['value']['place']) && $e['value']['place']=='footer') $page->add_file_footer($e['value']['path'].$e['value']['file'],array('sort'=>$s));
00216       }
00217      else print unhtmlentities($e['value']['script']);
00218 
00219     }
00220   }

javascript::cstr_inline (  ) 

Definition at line 240 of file page.javascript.php.

00240                         {
00241   }

javascript::del_script ( script,
opt = '' 
)

Supp d'un script du chargeur.

Parameters:
$script 
$opt 

Definition at line 119 of file page.javascript.php.

Referenced by add_multi().

00119                                               {
00120     $dir= dirname($script);
00121     $file=basename($script);
00122     $opt=(!is_array($opt))? array() : $opt ;
00123 
00124     if (isset($this->script[$file])) {
00125       unset($this->script[$file]);
00126       return true;
00127     }
00128     else return false;
00129   }

javascript::etat_charge (  )  [private]

Stock l'etat des chargement de la page, pour bloquer les doublons.

Definition at line 43 of file page.javascript.php.

00043                                 {
00044 
00045   }

javascript::init_prepa (  ) 

Definition at line 224 of file page.javascript.php.

00224                               {
00225     if (!isset($this->init) || !is_array( $this->init)) return false;
00226     $sorti='';
00227     while($e=each( $this->init)){
00228       if ($e['value']['type']=='function')eval("\$sorti .=".$e['value']['code_exe']."();");
00229 //             elseif ($e['value']['type']=='include'){
00230 //               ob_start();
00231 //                 include('');
00232 //               ob_get_contents();
00233 //             }
00234     }
00235 
00236     return $sorti;
00237   }

javascript::replace_script ( script,
new_script,
opt = '' 
)

replace d'un script du chargeur

Parameters:
$script 
$new_script 
$opt 

Definition at line 138 of file page.javascript.php.

00138                                                                {
00139     $dir= dirname($script);
00140     $file=basename($script);
00141     $opt=(!is_array($opt))? array() : $opt ;
00142 
00143     if (isset($this->script[$file])) {
00144       unset($this->script[$file]);
00145       $this->add_script($new_script, $opt);
00146       return true;
00147     }
00148     else return false;
00149   }


Member Data Documentation

javascript::$framework

Definition at line 23 of file page.javascript.php.

javascript::$script

Definition at line 29 of file page.javascript.php.

Referenced by add_script(), add_script_src(), del_script(), and replace_script().


The documentation for this class was generated from the following file: