[RESOLU] Problème de création de plugiciel

MantisBT forum for users who prefer to ask and answer questions in French.

Moderators: Developer, Contributor

Post Reply
sham73
Posts: 10
Joined: 03 May 2013, 08:34

[RESOLU] Problème de création de plugiciel

Post by sham73 »

Bonjour à tous.
Je suis en train de créer un nouveau plugiciel sur Mantis mais l'erreur suivante apparait : "APPLICATION ERROR #2500
Le plugiciel n'est pas enrégisté avec MantisBT." Je bloque completement, si vous pourriez m'aider svp
Voici mon code :
-Example.php

Code: Select all

<?php
class ExamplePlugin extends MantisPlugin {
    function register() {
        $this->name = 'Example';    # Proper name of plugin
        $this->description = 'Il sagit dun test';    # Short description of the plugin
        $this->page = '';           # Default plugin page

        $this->version = '1.0';     # Plugin version string
        $this->requires = array(    # Plugin dependencies, array of basename => version pairs
            'MantisCore' => '1.2.0, <= 1.2.0',  #   Should always depend on an appropriate version of MantisBT
            );

        $this->author = 'Cécile Favre';         # Author/team name
        $this->contact = '';        # Author/team e-mail address
        $this->url = '';            # Support webpage
    }

     function config() {
        return array(
            'foo_or_bar' => 'foo',
        );
    }

    function events() {
        return array(
            'EVENT_EXAMPLE_FOO' => EVENT_TYPE_EXECUTE,
            'EVENT_EXAMPLE_BAR' => EVENT_TYPE_CHAIN,
        );
    }

    function hooks() {
        return array(
            'EVENT_EXAMPLE_FOO' => 'foo',
            'EVENT_EXAMPLE_BAR' => 'bar',
        );
    }


    function foo( $p_event ) {
      return array( '<a href="' . plugin_page( 'foo' ) . '">' . plugin_lang_get( 'foo' ) . '</a>', );
    }

    function bar( $p_event, $p_chained_param ) {
        return $p_chained_param;
    }
}
-foo.php :

Code: Select all

<?php
echo '<p>Here is a link to <a href="', plugin_page( 'foo' ), '">page foo</a>.</p>';
echo '<link rel="stylesheet" type="text/css" href="', plugin_file( 'foo.css' ), '"/>',
     '<p class="foo">This is red text.</p>';

     event_signal( 'EVENT_EXAMPLE_FOO' );

$t_string = 'A sentence with the word "foo" in it.';
$t_new_string = event_signal( 'EVENT_EXAMPLE_BAR', array( $t_string ) );

echo $t_new_string, '</p>';
Il s'agit du code donné par Mantis pour apprendre à créer un plugiciel ... http://www.mantisbt.org/docs/master/en/ ... lding.html

Merci d'avance pour votre aide :)
Last edited by Lapinkiller on 29 Jul 2013, 13:22, edited 1 time in total.
Reason: tag [RESOLU] ajouté/added
Lapinkiller
Posts: 408
Joined: 28 Jan 2011, 18:47
Location: France
Contact:

Re: Problème de création de plugiciel

Post by Lapinkiller »

Bonjour

Tu as bien été dans l'administration Mantis et tu as fait "installer le plugin" ?

Tu as cette erreur quand ? dès que tu affiche une page de Mantis ?

sinon pour t'aider voici un des plugin que j'ai développé pour mantis : https://github.com/Jguilbaud/mantispluginPiwik
Lapinkiller,
French PHP developer
New look for your mantis : http://www.mantisbt.org/forums/viewtopi ... =4&t=20055
sham73
Posts: 10
Joined: 03 May 2013, 08:34

Re: Problème de création de plugiciel

Post by sham73 »

Merci pour la réponse ! Et merci pour le fichier je vais aller voir :)

Alors en fait non je n'est pas installé le plugin car la couleur des dépendances de mon plugin siginifie " Dépendances périmées". Je ne sais pas comment faire pour changer ce problème..
Et non l'erreur se produit uniquement quand je vais dans la page plugin.php?page=Example/foo (le dossier se nomme "Example" et le fichier "foo")
sham73
Posts: 10
Joined: 03 May 2013, 08:34

Re: Problème de création de plugiciel

Post by sham73 »

En fait il fallait tout simplement modifier cette ligne :

Code: Select all

$this->requires = array(   
            'MantisCore' => '1.2.0',  => '1.2.0' [code]
par [code]$this->requires = array(   
            'MantisCore' => '1.2.0',   
Lapinkiller
Posts: 408
Joined: 28 Jan 2011, 18:47
Location: France
Contact:

Re: Problème de création de plugiciel

Post by Lapinkiller »

Le message d'erreur est donc normal vu que le plugin n'est pas installé il fallait donc effectivement voir du côté de tes problèmes de dépendances de version. :)
Lapinkiller,
French PHP developer
New look for your mantis : http://www.mantisbt.org/forums/viewtopi ... =4&t=20055
Post Reply