PEAR like, php-csl, code library - anyone doing this?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • juglesh

    PEAR like, php-csl, code library - anyone doing this?

    howdy, I am using this code library thing:
    Download PHP Code Snippet Library for free. PHP Code Snippet Library. PHP-CSL is designed to let you store all your favourite code snippets, functions and classes.



    and had an idea. I was thinking about keeping a bunch of functions in
    the root dir of my server, so I can re-use my code from any of my
    websites without having to copy each func or code into the current
    site that i’m working on. So, It’d be kinda like PEAR, you’d just go:

    Code:
    include "/home/library/thefunction.php ;
    $var = thefunction();

    That php-csl that i linked to would have to be modified, cuz it stores
    the snippets in *.s files. No biggie. Also, it would be cool to have
    the code you need for including the func be in a text area that could
    have a copy to clipboard button.

    Anyone doing such a thing? Have any security concerns? Other
    thoughts?

    thanks,
    juglesh

    --
    Posted using the http://www.dbforumz.com interface, at author's request
    Articles individually checked for conformance to usenet standards
    Topic URL: http://www.dbforumz.com/PHP-PEAR-csl...ict241484.html
    Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=839478
  • Colin McKinnon

    #2
    Re: PEAR like, php-csl, code library - anyone doing this?

    juglesh wrote:
    [color=blue]
    > howdy, I am using this code library thing:
    > http://sourceforge.net/projects/php-csl/
    >
    > http://www.php-csl.com/snippets/[/color]

    Hmmm, interesting.
    [color=blue]
    > and had an idea. I was thinking about keeping a bunch of functions in
    > the root dir of my server,[/color]

    This is a really bad place to put things.
    [color=blue]
    > so I can re-use my code from any of my
    > websites without having to copy each func or code into the current
    > site that i’m working on. So, It’d be kinda like PEAR, you’d just go:
    >
    > Code:
    > include "/home/library/thefunction.php ;
    > $var = thefunction();
    >
    > That php-csl that i linked to would have to be modified, cuz it stores
    > the snippets in *.s files. No biggie. Also, it would be cool to have
    > the code you need for including the func be in a text area that could
    > have a copy to clipboard button.
    >[/color]

    I'm guessing the '.s' files are some sort of composite of the PHP code, the
    documentation and meta-data? Wouldn't it be a lot simpler to just write
    your own wrapper for extracting the PHP code from the .s file? That way you
    don't have to maintain 2 seperate repositories. e.g.

    require_once "http://localhost/snippets_archiv e.php?snip=some ref";

    (make sure you know about code injection, safe_mode and open_basedir before
    you try this at home kids).

    C.

    Comment

    • juglesh

      #3
      Re: PEAR like, php-csl, code library - anyone doing this?


      Colin McKinnon wrote:[color=blue]
      > juglesh wrote:
      >[color=green]
      > > howdy, I am using this code library thing:
      > > http://sourceforge.net/projects/php-csl/
      > >
      > > http://www.php-csl.com/snippets/[/color]
      >
      > Hmmm, interesting.
      >[color=green]
      > > and had an idea. I was thinking about keeping a bunch of functions in
      > > the root dir of my server,[/color]
      >
      > This is a really bad place to put things.[/color]

      how come? actually, I was going to put them in the same dir as my
      cpanel 'users'. In a sub domain.[color=blue]
      >[color=green]
      > > so I can re-use my code from any of my
      > > websites without having to copy each func or code into the current
      > > site that i'm working on. So, It'd be kinda like PEAR, you'd just go:
      > >
      > > Code:
      > > include "/home/library/thefunction.php ;
      > > $var = thefunction();
      > >
      > > That php-csl that i linked to would have to be modified, cuz it stores
      > > the snippets in *.s files. No biggie. Also, it would be cool to have
      > > the code you need for including the func be in a text area that could
      > > have a copy to clipboard button.[/color][/color]

      got that clipboard part going, too.[color=blue]
      >
      > I'm guessing the '.s' files are some sort of composite of the PHP code, the
      > documentation and meta-data? Wouldn't it be a lot simpler to just write
      > your own wrapper for extracting the PHP code from the .s file? That way you
      > don't have to maintain 2 seperate repositories. e.g.[/color]

      Yeah, I just rewrote the thing, mine just reads php files.
      [color=blue]
      >
      > require_once "http://localhost/snippets_archiv e.php?snip=some ref";
      >
      > (make sure you know about code injection, safe_mode and open_basedir before
      > you try this at home kids).[/color]

      It doesnt include the snip, it just reads it and echos it.

      Comment

      Working...