[Résolu] Installer un plugin sur son site

Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
#1
Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~
#~ Cms Version: 1.10.3
#~ Installed Modules:
#~ CMSMailer: 2.0.2
#~ CMSPrinting: 1.0
#~ FileManager: 1.2.0
#~ MenuManager: 1.7.7
#~ MicroTiny: 1.1.1
#~ ModuleManager: 1.5.3
#~ News: 2.12.3
#~ Search: 1.7
#~ ThemeManager: 1.1.4
#~ TinyMCE: 2.9.6
#~ Gallery: 1.5.3
#~ FormBuilder: 0.7.2
#~ CGExtensions: 1.29
#~ FrontEndUsers: 1.17.5
#~ CustomContent: 1.8.2
#~ Config Information:
#~ php_memory_limit:
#~ process_whole_template: false
#~ output_compression: false
#~ max_upload_size: 64000000
#~ default_upload_permission: 664
#~ url_rewriting: none
#~ page_extension:
#~ query_var: page
#~ image_manipulation_prog: GD
#~ auto_alias_content: true
#~ locale:
#~ default_encoding: utf-8
#~ admin_encoding: utf-8
#~ set_names: true
#~ Php Information:
#~ phpversion: 5.2.17
#~ md5_function: On (Vrai)
#~ gd_version: 2
#~ tempnam_function: On (Vrai)
#~ magic_quotes_runtime: Off (Faux)
#~ E_STRICT: 0
#~ memory_limit: 128M
#~ max_execution_time: 120
#~ output_buffering: On
#~ safe_mode: Off (Faux)
#~ file_uploads: On (Vrai)
#~ post_max_size: 64M
#~ upload_max_filesize: 64M
#~ session_save_path: /tmp (1777)
#~ session_use_cookies: On (Vrai)
#~ xml_function: On (Vrai)
#~ Server Information:
#~ Server Api: cgi
#~ Server Db Type: MySQL (mysql)
#~ Server Db Version: 5.1.49
#~~~~~ FIN BLOC A NE PAS SUPPRIMER ~~~~~


Bonjour,

Quelqu'un peut il m'expliquer comment installer un Plugin?

Voici le code associé:
Code :
[== PHP ==]
<?php
#CMS Made Simple
#Plugin: {multiple_random_image}
#(c)2006-2007 by Alberto Benati (alby) <cms@xme.it>
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; version 2 of the License
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#DEFAULT VALUE. EDIT HERE ONLY
function _config_multiple_random_image( ) {
    $value['folder'] = 'uploads/images/';
    $value['number'] = 1;
    $value['maxdepth'] = 0;
    $value['allowextension'] = 'jpg,jpeg,gif,png';
    $value['includeprefix'] = '';
    $value['excludeprefix'] = 'thumb';
    $value['url'] = false;
    $value['separator'] = '';
    return $value;
}



function _multiple_random_image( $path, $url, $maxdepth=0, $allowextension='', $includeprefix='', $excludeprefix='', $d=0 )
{
    $len = strlen(DIRECTORY_SEPARATOR);
    if(substr($path, strlen($path)-$len) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR;
    if(substr($url, strlen($url)-1) != '/') $url .= '/';
    $dirlist=array();

    if($handle = opendir($path))
    {
        while(false !== ($file=readdir($handle)))
        {
            if($file != '.' && $file != '..')
            {
                $fullpath = $path.$file;
                $fullurl = str_replace('/ /', '%2F', $url.$file);
                if(! is_dir($fullpath))
                {
                    $entry = pathinfo($fullpath);
                    $basename = $entry['basename'];
                    $extension = $entry['extension'];
                    $allowit=1;
                    $includeit=1;
                    $excludeit=0;

                    if($allowextension != '')
                    {
                        $allowit=0;
                        $prefixes = explode(',', $allowextension);
                        foreach($prefixes as $oneprefix)
                        {
                            if(strpos($extension, trim($oneprefix)) !== FALSE)
                            {
                                $allowit = 1;
                                break;
                            }
                        }
                    }
                    if($includeprefix != '')
                    {
                        $includeit=0;
                        $prefixes = explode(',', $includeprefix);
                        foreach($prefixes as $oneprefix)
                        {
                            if(strpos($basename, trim($oneprefix)) !== FALSE)
                            {
                                $includeit = 1;
                                break;
                            }
                        }
                    }
                    if($excludeprefix != '')
                    {
                        $prefixes = explode(',', $excludeprefix);
                        foreach($prefixes as $oneprefix)
                        {
                            if(strpos($basename, trim($oneprefix)) !== FALSE)
                            {
                                $excludeit = 1;
                                break;
                            }
                        }
                    }

                    if($allowit && $includeit && !$excludeit) $dirlist[] = $fullurl;
                }
                elseif($d >= 0 && ($d < $maxdepth || $maxdepth < 0))
                {
                    $result = _multiple_random_image($fullpath, $fullurl, $maxdepth, $allowextension, $includeprefix, $excludeprefix, $d+1);
                    $dirlist = array_merge($dirlist, $result);
                }
            }
        }
        closedir($handle);
    }
    return $dirlist;
}

function _check_multiple_random_image( $n, $max, $min=0 )
{
    $value=array();
    if ($max <= $min) return $value;
    for ($i=0; $i<$n; $i++) {
        do {$num = rand($min,$max-1);} while (in_array($num,$value) && count($value)<$max-$min);
        $value[$i] = $num;
    }
    return $value;
}

function smarty_cms_function_multiple_random_image($params, &$smarty)
{
    #Get mandatory defaults value
    $value = _config_multiple_random_image();

    #Check if user has specified an image folder
    $folder = $value['folder'];
    if(isset($params['folder']))
    {
        if(substr($params['folder'],-1) != '/')
        {
            $params['folder'] .= '/';
        }
        $folder = $params['folder'];
    }
    $folder_path = realpath($folder);

    #Check if user has specified an maximum display file number
    $number = $value['number'];
    if(isset($params['number'])) $number = intval(trim($params['number']));

    #Check if user has specified an recursive maximum depth
    $maxdepth = $value['maxdepth'];
    if(isset($params['maxdepth'])) $maxdepth = intval(trim($params['maxdepth']));

    #Check if user has specified an allow extensions, include/exclude prefix for files
    $allowextension = $value['allowextension'];
    if(isset($params['allowextension'])) $allowextension = strtolower(trim($params['allowextension']));
    $includeprefix = $value['includeprefix'];
    if(isset($params['includeprefix'])) $includeprefix = trim($params['includeprefix']);
    $excludeprefix = $value['excludeprefix'];
    if(isset($params['excludeprefix'])) $excludeprefix = trim($params['excludeprefix']);

    #Check if user has specified separator tags
    $separator = $value['separator'];
    if(isset($params['separator'])) $separator = $params['separator'];

    #Check if user has specified a url image
    if(isset($params['url']))
    {
        $url = $params['url'];
        if(isset($params['url_class'])) $url_class = 'class="'.$params['url_class'].'"';
        if(isset($params['url_target'])) $url_target = 'target="'.$params['url_target'].'"';
    }
    else
    {
        $url = $value['url'];
        $url_class = '';
        $url_target = '';
    }


    ##Check if user has specified ALT-tag, default image file name
    $alt = false;
    if(isset($params['alt'])) $alt = ' alt="'.$params['alt'].'"';

    ##Check if user has specified title, default same ALT-tag
    $title = false;
    if(isset($params['title'])) $title = ' title="'.$params['title'].'"';

    #Check if user has specified image width
    $width = '';
    if(isset($params['width'])) $width = ' width="'.$params['width'].'"';

    #Check if user has specified image height
    $height = '';
    if(isset($params['height'])) $height = ' height="'.$params['height'].'"';

    #Check if user has specified class for image
    $class = '';
    if(isset($params['class'])) $class = ' class="'.$params['class'].'"';

    #Check if user has specified image alignment
    $align = '';
    if(isset($params['align'])) $align = ' align="'.$params['align'].'"';

    #Check if user has specified image border
    $border = '';
    if(isset($params['border'])) $border = ' border="'.$params['border'].'"';

    #Check if user has specified horizontal space
    $hspace = '';
    if(isset($params['hspace'])) $hspace = ' hspace="'.$params['hspace'].'"';

    #Check if user has specified vertical space
    $vspace = '';
    if(isset($params['vspace'])) $vspace = ' vspace="'.$params['vspace'].'"';


    #Check directory
    if(is_dir($folder_path))
    {
        $fileList = _multiple_random_image($folder_path, $folder, $maxdepth, $allowextension, $includeprefix, $excludeprefix);
        $countfileList = count($fileList);

        if(isset($params['debug']))
        {
            $_out  = "<!-- MULTIPLE RANDOM IMAGE DEBUG:\n";
            $_out .= "Relative folder path: $folder\n";
            $_out .= "Absolute folder path: $folder_path\n";
            $_out .= "$countfileList images found in folder (display image number is $number)";
            if($countfileList > 0) $_out .= ":\n" . implode(', ', $fileList);
            return $_out . "\n -->";
        }

        if($countfileList > 0)
        {
            shuffle($fileList);
            if(! empty($number)) $fileList = array_slice($fileList, 0, $number);

            $img=array();
            foreach($fileList as $imgList)
            {
                $base = basename($imgList);
                if(! $alt) $base_alt = ' alt="'.$base.'"';
                else $base_alt = $alt;
                if(! $title) $base_title = ' title="'.$base.'"';
                else $base_title = $title;
                $_params = $base_alt.$base_title.$width.$height.$class.$align.$border.$hspace.$vspace;

                $_out = "<img src=\"". $imgList ."\" $_params />";
                if($url)
                {
                    $_arr  = explode('.', $base);
                    $_ext  = array_pop($_arr);
                    $_int  = array_pop($_arr);
                    $_base = basename($base, ".$_int.$_ext");
                    if(! is_numeric($_int)) return "Check sintax: $_base - $_int - $_ext";
                    $_base = str_replace('_', '/', $_base);
                    $_out = "<a href=\"$_base\" $url_class $url_target>". $_out ."</a>";
                }
                $img[] = $_out;
            }
            return implode($separator, $img);
        }
    }
    if(isset($params['debug'])) return "<!-- Trouble folder or no images in: $folder - Absolute folder is: $folder_path -->";
    return '';
}

function smarty_cms_help_function_multiple_random_image( )
{
?>


Et le tag
{multiple_random_image}

Je ne comprends pas comment on s'en sert...

Un coup de main?
Merci,
Pierre
#1
Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~
#~ Cms Version: 1.10.3
#~ Installed Modules:
#~ CMSMailer: 2.0.2
#~ CMSPrinting: 1.0
#~ FileManager: 1.2.0
#~ MenuManager: 1.7.7
#~ MicroTiny: 1.1.1
#~ ModuleManager: 1.5.3
#~ News: 2.12.3
#~ Search: 1.7
#~ ThemeManager: 1.1.4
#~ TinyMCE: 2.9.6
#~ Gallery: 1.5.3
#~ FormBuilder: 0.7.2
#~ CGExtensions: 1.29
#~ FrontEndUsers: 1.17.5
#~ CustomContent: 1.8.2
#~ Config Information:
#~ php_memory_limit:
#~ process_whole_template: false
#~ output_compression: false
#~ max_upload_size: 64000000
#~ default_upload_permission: 664
#~ url_rewriting: none
#~ page_extension:
#~ query_var: page
#~ image_manipulation_prog: GD
#~ auto_alias_content: true
#~ locale:
#~ default_encoding: utf-8
#~ admin_encoding: utf-8
#~ set_names: true
#~ Php Information:
#~ phpversion: 5.2.17
#~ md5_function: On (Vrai)
#~ gd_version: 2
#~ tempnam_function: On (Vrai)
#~ magic_quotes_runtime: Off (Faux)
#~ E_STRICT: 0
#~ memory_limit: 128M
#~ max_execution_time: 120
#~ output_buffering: On
#~ safe_mode: Off (Faux)
#~ file_uploads: On (Vrai)
#~ post_max_size: 64M
#~ upload_max_filesize: 64M
#~ session_save_path: /tmp (1777)
#~ session_use_cookies: On (Vrai)
#~ xml_function: On (Vrai)
#~ Server Information:
#~ Server Api: cgi
#~ Server Db Type: MySQL (mysql)
#~ Server Db Version: 5.1.49
#~~~~~ FIN BLOC A NE PAS SUPPRIMER ~~~~~


Bonjour,

Quelqu'un peut il m'expliquer comment installer un Plugin?

Voici le code associé:
Code :
[== PHP ==]
<?php
#CMS Made Simple
#Plugin: {multiple_random_image}
#(c)2006-2007 by Alberto Benati (alby) <cms@xme.it>
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; version 2 of the License
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#DEFAULT VALUE. EDIT HERE ONLY
function _config_multiple_random_image( ) {
    $value['folder'] = 'uploads/images/';
    $value['number'] = 1;
    $value['maxdepth'] = 0;
    $value['allowextension'] = 'jpg,jpeg,gif,png';
    $value['includeprefix'] = '';
    $value['excludeprefix'] = 'thumb';
    $value['url'] = false;
    $value['separator'] = '';
    return $value;
}



function _multiple_random_image( $path, $url, $maxdepth=0, $allowextension='', $includeprefix='', $excludeprefix='', $d=0 )
{
    $len = strlen(DIRECTORY_SEPARATOR);
    if(substr($path, strlen($path)-$len) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR;
    if(substr($url, strlen($url)-1) != '/') $url .= '/';
    $dirlist=array();

    if($handle = opendir($path))
    {
        while(false !== ($file=readdir($handle)))
        {
            if($file != '.' && $file != '..')
            {
                $fullpath = $path.$file;
                $fullurl = str_replace('/ /', '%2F', $url.$file);
                if(! is_dir($fullpath))
                {
                    $entry = pathinfo($fullpath);
                    $basename = $entry['basename'];
                    $extension = $entry['extension'];
                    $allowit=1;
                    $includeit=1;
                    $excludeit=0;

                    if($allowextension != '')
                    {
                        $allowit=0;
                        $prefixes = explode(',', $allowextension);
                        foreach($prefixes as $oneprefix)
                        {
                            if(strpos($extension, trim($oneprefix)) !== FALSE)
                            {
                                $allowit = 1;
                                break;
                            }
                        }
                    }
                    if($includeprefix != '')
                    {
                        $includeit=0;
                        $prefixes = explode(',', $includeprefix);
                        foreach($prefixes as $oneprefix)
                        {
                            if(strpos($basename, trim($oneprefix)) !== FALSE)
                            {
                                $includeit = 1;
                                break;
                            }
                        }
                    }
                    if($excludeprefix != '')
                    {
                        $prefixes = explode(',', $excludeprefix);
                        foreach($prefixes as $oneprefix)
                        {
                            if(strpos($basename, trim($oneprefix)) !== FALSE)
                            {
                                $excludeit = 1;
                                break;
                            }
                        }
                    }

                    if($allowit && $includeit && !$excludeit) $dirlist[] = $fullurl;
                }
                elseif($d >= 0 && ($d < $maxdepth || $maxdepth < 0))
                {
                    $result = _multiple_random_image($fullpath, $fullurl, $maxdepth, $allowextension, $includeprefix, $excludeprefix, $d+1);
                    $dirlist = array_merge($dirlist, $result);
                }
            }
        }
        closedir($handle);
    }
    return $dirlist;
}

function _check_multiple_random_image( $n, $max, $min=0 )
{
    $value=array();
    if ($max <= $min) return $value;
    for ($i=0; $i<$n; $i++) {
        do {$num = rand($min,$max-1);} while (in_array($num,$value) && count($value)<$max-$min);
        $value[$i] = $num;
    }
    return $value;
}

function smarty_cms_function_multiple_random_image($params, &$smarty)
{
    #Get mandatory defaults value
    $value = _config_multiple_random_image();

    #Check if user has specified an image folder
    $folder = $value['folder'];
    if(isset($params['folder']))
    {
        if(substr($params['folder'],-1) != '/')
        {
            $params['folder'] .= '/';
        }
        $folder = $params['folder'];
    }
    $folder_path = realpath($folder);

    #Check if user has specified an maximum display file number
    $number = $value['number'];
    if(isset($params['number'])) $number = intval(trim($params['number']));

    #Check if user has specified an recursive maximum depth
    $maxdepth = $value['maxdepth'];
    if(isset($params['maxdepth'])) $maxdepth = intval(trim($params['maxdepth']));

    #Check if user has specified an allow extensions, include/exclude prefix for files
    $allowextension = $value['allowextension'];
    if(isset($params['allowextension'])) $allowextension = strtolower(trim($params['allowextension']));
    $includeprefix = $value['includeprefix'];
    if(isset($params['includeprefix'])) $includeprefix = trim($params['includeprefix']);
    $excludeprefix = $value['excludeprefix'];
    if(isset($params['excludeprefix'])) $excludeprefix = trim($params['excludeprefix']);

    #Check if user has specified separator tags
    $separator = $value['separator'];
    if(isset($params['separator'])) $separator = $params['separator'];

    #Check if user has specified a url image
    if(isset($params['url']))
    {
        $url = $params['url'];
        if(isset($params['url_class'])) $url_class = 'class="'.$params['url_class'].'"';
        if(isset($params['url_target'])) $url_target = 'target="'.$params['url_target'].'"';
    }
    else
    {
        $url = $value['url'];
        $url_class = '';
        $url_target = '';
    }


    ##Check if user has specified ALT-tag, default image file name
    $alt = false;
    if(isset($params['alt'])) $alt = ' alt="'.$params['alt'].'"';

    ##Check if user has specified title, default same ALT-tag
    $title = false;
    if(isset($params['title'])) $title = ' title="'.$params['title'].'"';

    #Check if user has specified image width
    $width = '';
    if(isset($params['width'])) $width = ' width="'.$params['width'].'"';

    #Check if user has specified image height
    $height = '';
    if(isset($params['height'])) $height = ' height="'.$params['height'].'"';

    #Check if user has specified class for image
    $class = '';
    if(isset($params['class'])) $class = ' class="'.$params['class'].'"';

    #Check if user has specified image alignment
    $align = '';
    if(isset($params['align'])) $align = ' align="'.$params['align'].'"';

    #Check if user has specified image border
    $border = '';
    if(isset($params['border'])) $border = ' border="'.$params['border'].'"';

    #Check if user has specified horizontal space
    $hspace = '';
    if(isset($params['hspace'])) $hspace = ' hspace="'.$params['hspace'].'"';

    #Check if user has specified vertical space
    $vspace = '';
    if(isset($params['vspace'])) $vspace = ' vspace="'.$params['vspace'].'"';


    #Check directory
    if(is_dir($folder_path))
    {
        $fileList = _multiple_random_image($folder_path, $folder, $maxdepth, $allowextension, $includeprefix, $excludeprefix);
        $countfileList = count($fileList);

        if(isset($params['debug']))
        {
            $_out  = "<!-- MULTIPLE RANDOM IMAGE DEBUG:\n";
            $_out .= "Relative folder path: $folder\n";
            $_out .= "Absolute folder path: $folder_path\n";
            $_out .= "$countfileList images found in folder (display image number is $number)";
            if($countfileList > 0) $_out .= ":\n" . implode(', ', $fileList);
            return $_out . "\n -->";
        }

        if($countfileList > 0)
        {
            shuffle($fileList);
            if(! empty($number)) $fileList = array_slice($fileList, 0, $number);

            $img=array();
            foreach($fileList as $imgList)
            {
                $base = basename($imgList);
                if(! $alt) $base_alt = ' alt="'.$base.'"';
                else $base_alt = $alt;
                if(! $title) $base_title = ' title="'.$base.'"';
                else $base_title = $title;
                $_params = $base_alt.$base_title.$width.$height.$class.$align.$border.$hspace.$vspace;

                $_out = "<img src=\"". $imgList ."\" $_params />";
                if($url)
                {
                    $_arr  = explode('.', $base);
                    $_ext  = array_pop($_arr);
                    $_int  = array_pop($_arr);
                    $_base = basename($base, ".$_int.$_ext");
                    if(! is_numeric($_int)) return "Check sintax: $_base - $_int - $_ext";
                    $_base = str_replace('_', '/', $_base);
                    $_out = "<a href=\"$_base\" $url_class $url_target>". $_out ."</a>";
                }
                $img[] = $_out;
            }
            return implode($separator, $img);
        }
    }
    if(isset($params['debug'])) return "<!-- Trouble folder or no images in: $folder - Absolute folder is: $folder_path -->";
    return '';
}

function smarty_cms_help_function_multiple_random_image( )
{
?>


Et le tag
{multiple_random_image}

Je ne comprends pas comment on s'en sert...

Un coup de main?
Merci,
Pierre
#2
C/C le fichier qu'on t'as donné dans /plugins de ton installation

le plugin est utilisable de suite dans cmsmadesimple

l'aide du plugin installé est dispo dans l'adminisitration, menu extention > plugins
#2
C/C le fichier qu'on t'as donné dans /plugins de ton installation

le plugin est utilisable de suite dans cmsmadesimple

l'aide du plugin installé est dispo dans l'adminisitration, menu extention > plugins
#3
Grand Merci !
#3
Grand Merci !


Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)