Actualizado el 14-01-2007
versión para imprimir

¿ Plugins en php ?

PHP es uno de los muchos lenguajes de programación que puedes usar para tus plugins. La forma mas sencilla de empezar es realizar algun plugin sencillo con el Plugins Generator y utilizar la opción de grabar el código generado en lenguaje PHP.

El Plugins Generator es capaz de reescribir en PHP todas las funciones que incluye en su libreria (abrir un archivo o url en la ventana del navegador, buscar y reemplazar, etc.)

A continuación, la traslación a php de algunas otras funciones disponibles:

__InputWizard_GetData __PluginDataRead __PluginDataWrite __UI_GetFileName __MessageWindowClearAll __MessageWindowAdd __InputWizard_Show __OpenBrowser __ShellExecute


<?php
function __InputWizard_GetData($sVariableName)
{
  
$sResult '';
  
$v = new HKPCore;
  
$v->hkp_FuncOpen$v->hkp_f_InputWizard );
  
$v->hkp_DataAddInt'FUNC_PARAM1'2);
  
$v->hkp_DataAdd'FUNC_PARAM2'$sVariableName);
  if( 
$v->hkp_FuncRun() )
  {
    if(
$v->hkp_DataGetInt'FUNC_PARAM1'0))
    {
      
$sResult $v->hkp_DataGetStr'FUNC_PARAM2''' );
    }
  }
  
$v->hkp_FuncClose();
  
$v->hkp_Quit();
  return 
$sResult;
}

?>

<?php
function __PluginDataRead($sPluginID$sKey$sDefValue)<br>
{
  
$sResult "";
  
  
$v = new HKPCore;
  
$v->hkp_FuncOpen$v->hkp_f_PluginDataRead );
  
$v->hkp_DataAdd'FUNC_PARAM1'$sPluginID);
  
$v->hkp_DataAdd'FUNC_PARAM2'$sKey);
  
$v->hkp_DataAdd'FUNC_PARAM3'$sDefValue);
  if( 
$v->hkp_FuncRun() )
  {
    
$v->hkp_DataGet'FUNC_PARAM1'$sResult);
   
  }
  
$v->hkp_FuncClose();
  
$v->hkp_Quit();
  return 
$sResult;
}


?>

<?php
function __PluginDataWrite($sPluginID$sKey$sValue)<br>
{
  
$nResult "";
  
  
$v = new HKPCore;
  
$v->hkp_FuncOpen$v->hkp_f_PluginDataWrite );
  
$v->hkp_DataAdd'FUNC_PARAM1'$sPluginID);
  
$v->hkp_DataAdd'FUNC_PARAM2'$sKey);
  
$v->hkp_DataAdd'FUNC_PARAM3'$sValue);
  if( 
$v->hkp_FuncRun() )
  {
    
$nResult 1;
    
  }
  
$v->hkp_FuncClose();
  
$v->hkp_Quit();
  return 
$nResult;
}
?>

<?php
function __UI_GetFileName($sTitle$sPrompt$sFilter$sDefExt$sDefFileName) {
  
$sResult "";
  
$v = new HKPCore;
  
$v->hkp_FuncOpen$v->hkp_f_UI_GetFileName );
  
$v->hkp_DataAddInt'FUNC_PARAM1'0);
  
$v->hkp_DataAdd'FUNC_PARAM2'$sDefFileName);
  
$v->hkp_DataAdd'FUNC_PARAM3'$sTitle);
  
$v->hkp_DataAdd'FUNC_PARAM4'$sPrompt);
  
$v->hkp_DataAdd'FUNC_PARAM5'$sFilter);
  
$v->hkp_DataAdd'FUNC_PARAM6'$sDefExt);
   
    if( 
$v->hkp_FuncRun() ) {
        if(
$v->hkp_DataGetInt'FUNC_PARAM1'0)) {
        
$sFileName "";
        
$sResult $v->hkp_DataGetStr'FUNC_PARAM2''' );
                if(
$v->hkp_DataGetInt'FUNC_PARAM2', &$sFileName)) {
                
$sResult $sFileName;
                }       
        }
    }
$v->hkp_FuncClose();
$v->hkp_Quit();
return 
$sResult;
}
?>

<?php
function __MessageWindowClearAll() {
    
    
$nResult "";
    
$v = new HKPCore;
    
$v->hkp_FuncOpen$v->hkp_f_msgwinClearAll );

    if( 
$v->hkp_FuncRun() ) {
    
$nResult 1;
    }
    
$v->hkp_FuncClose();
    
$v->hkp_Quit();
    return 
$nResult;
}
?>

<?php
function __MessageWindowAdd($nRow$nCol$sType$sMsg$nLen$sFN) {
    
    
$nResult "";
    
$v = new HKPCore;
    
$v->hkp_FuncOpen$v->hkp_f_msgwinAdd );
    
$v->hkp_DataAddInt'FUNC_PARAM1'$nRow);
    
$v->hkp_DataAddInt'FUNC_PARAM2'$nCol);
    
$v->hkp_DataAdd   'FUNC_PARAM3'$sType);
    
$v->hkp_DataAdd   'FUNC_PARAM4'$sMsg);
    
$v->hkp_DataAddInt'FUNC_PARAM5'$nLen);
    
$v->hkp_DataAdd   'FUNC_PARAM6'$sFN);
  
  
    if( 
$v->hkp_FuncRun() ) {
    
$nResult 1;
    }
    
$v->hkp_FuncClose();
    
$v->hkp_Quit();
    return 
$nResult;
}

?>

<?php
function __InputWizard_Show($sTitle$sDesc$sInputFields$bPreviewShow$sPreviewCode)
{
  
$sResult '';
  
$v = new HKPCore;

  
$v->hkp_FuncOpen$v->hkp_f_InputWizard );
  
$v->hkp_DataAddInt'FUNC_PARAM1');
  
$v->hkp_DataAdd'FUNC_PARAM2'$sTitle );
  
$v->hkp_DataAdd'FUNC_PARAM3'$sDesc );
  
$v->hkp_DataAdd'FUNC_PARAM4'$sInputFields );
  
$v->hkp_DataAddInt'FUNC_PARAM5'$bPreviewShow );
  
$v->hkp_DataAdd'FUNC_PARAM6'$sPreviewCode );
  if( 
$v->hkp_FuncRun() )
  {
    if(
$v->hkp_DataGetInt'FUNC_PARAM1'0))
    {
      
$sResult $v->hkp_DataGetStr'FUNC_PARAM2''' );
    }
  }
  
$v->hkp_FuncClose();

  
$v->hkp_Quit();

  return 
$sResult;
}
?>

<?php
function __OpenBrowser$sURL )
{
  
$nResult 0;
  
$v = new HKPCore;

  
$v->hkp_FuncOpen$v->hkp_f_OpenBrowser );
  
$v->hkp_DataAdd'FUNC_PARAM1'$sURL );
  
$v->hkp_DataAdd'FUNC_PARAM2''' );
  if( 
$v->hkp_FuncRun() )
  {
    
$nResult 1;
  }
  
$v->hkp_FuncClose();

  
$v->hkp_Quit();

  return 
$nResult;
}

?>

<?php
function __ShellExecute$sOperation$sFile$sParams$sPath )
{
  
$nResult 0;
  
$v = new HKPCore;

  
$v->hkp_FuncOpen$v->hkp_f_ShellExecute );
  
$v->hkp_DataAdd'FUNC_PARAM1'$sOperation );
  
$v->hkp_DataAdd'FUNC_PARAM2'$sFile );
  
$v->hkp_DataAdd'FUNC_PARAM3'$sParams );
  
$v->hkp_DataAdd'FUNC_PARAM4'$sPath );
  
$v->hkp_DataAdd'FUNC_PARAM5''1' );
  if( 
$v->hkp_FuncRun() )
  {
    
$nResult 1;
  }
  
$v->hkp_FuncClose();

  
$v->hkp_Quit();

  return 
$nResult;
}
?>
This site powered by Phorum.