Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. Modifica al codice di un plugin

Modifica al codice di un plugin

Pianificato Fissato Bloccato Spostato Coding
8 Post 3 Autori 842 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • B
    B
    bill152
    scritto su ultima modifica di
    User Attivo 0
    #1
    Modifica al codice di un plugin

    Ciao a tutti, avrei un problema con il codice di un plugin inserito sul mio sito
    che permette all'utente di copiare un codice html da poter incollare sul proprio blog o sito per inserire una breve citazione dell'articolo.
    Potete vederne un esempio qui cliccando sul link quot this article alla fine dell'articolo.
    Il problema come potete vedere è che per mostrare il codice occorre cliccare sul link, mentre io vorrei che questo fosse sempre visibile. Sapreste dirmi come modificare il codice affinchè il codice da copiare o incollare venga reso sempre visibile? Posto di seguito il codice del plugin:

    <?php
    /**
     * @version        $Id: quothis.php 10094 2008-06-03  $
     * @package        QuotThis
     * @copyright    Copyright (C) 2008 - Bernard Gilly. All rights reserved.
     * @license        GNU/GPL
     * @Website     http://www.alphaplug.com
     */
    
    // Check to ensure this file is included in Joomla!
    defined( '_JEXEC' ) or die( 'Restricted access' );
    
    jimport( 'joomla.plugin.plugin' );
    
    class plgContentQuotethis extends JPlugin
    {
    
        function plgContentQuotethis( &$subject, $params )
        {
            parent::__construct( $subject, $params );
        }
    
        function onPrepareContent( &$article, &$params, $limitstart )
        {
            global $mainframe;
            
            $document    = & JFactory::getDocument();
            $view        = JRequest::getCmd('view');
            
            if ( $view != 'article' ) return;        
    
            // Get plugin info
            $plugin              =& JPluginHelper::getPlugin('content', 'quotethis');
            $pluginParams        = new JParameter( $plugin->params );
            $excludeSectionID    = $pluginParams->get( 'excludeSectionID',  '' );        
            $excludeCategoryID   = $pluginParams->get( 'excludeCategoryID', '' );
            $excludeID           = $pluginParams->get( 'excludeID',         '' );        
            $listexcludeSection  = @explode ( ",",  $excludeSectionID );    
            $listexcludeCategory = @explode ( ",", $excludeCategoryID );    
            $listexclude          = @explode ( ",",         $excludeID );        
            
            if ( $params->get( 'intro_only' ) || in_array ( $article->id, $listexclude ) || in_array ( $article->sectionid, $listexcludeSection ) || in_array ( $article->catid, $listexcludeCategory ) ) return;    
            
            JPlugin::loadLanguage( 'plg_quotethis', JPATH_ADMINISTRATOR );
            
            $loadMootools     = $pluginParams->def( 'loadMootools',           1 );
            $preview            = $pluginParams->def( 'preview',                1 );
            $txtcols         = $pluginParams->def( 'txtcols',               54 );
            $txtrows         = $pluginParams->def( 'txtrows',                7 );    
            $rowtitle        = $pluginParams->def( 'title',            'title' );        
            $intro           = $pluginParams->def( 'intro',                '0' );
            $limitcharintro  = $pluginParams->def( 'limitcharintro',     '150' );
            $showfirstimage  = $pluginParams->def( 'showfirstimage',       '0' );
            $widthimage         = $pluginParams->def( 'widthimage',         '120' );        
            $copyright       = $pluginParams->def( 'copyright',            '1' );
            $showdate        = $pluginParams->def( 'showdate',             '1' );    
            $width           = $pluginParams->def( 'width',                400 );
            $colorborder     = $pluginParams->def( 'colorborder',     '456B8F' );
            $backgroundcolor = $pluginParams->def( 'backgroundcolor', 'FFFFFF' );
            $fontsizetitle   = $pluginParams->def( 'fontsizetitle',       '13' );
            $colortitle      = $pluginParams->def( 'colortitle',      '003399' );
            $colortitlehover = $pluginParams->def( 'colortitlehover', 'FF9900' );
            $fontsize        = $pluginParams->def( 'fontsize',            '10' );
            $fontcolor       = $pluginParams->def( 'fontcolor',       '222222' );            
            
            //unset($document->_scripts[JURI::base(true) . '/media/system/js/mootools.js']);
            //unset($document->_scripts[JURI::base(true) . '/media/system/js/mootools-uncompressed.js']);
            //$document->addScript(JURI::base(true) . '/media/system/js/mootools.js');        
            if ( $loadMootools ) $document->addScript(JURI::base(true).'/plugins/content/quotethis/js/mootools.js');                
            
            $uri             =& JURI::getInstance();
            $base            = $uri->toString( array('scheme', 'host', 'port'));        
            $thequote        = $base.JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));        
    
            $copyNow         = date('Y');
            $title           = stripslashes( $article->$rowtitle );
            $copyright       = ( $copyright ) ? "&copy; " . $copyNow . " - " : "" ;
            $thedate         = ( $showdate )  ? "<br />" . JHTML::_( 'date', $article->created, JText::_('DATE_FORMAT_LC')) : "" ;
            $introtext         = ( $intro )     ? "<br />" . plgContentQuotethis::prepareIntroQuoteThis( $article->text, $limitcharintro, "" ) : "" ;
            $image              = "";
            
            if ( $showfirstimage ) {
                $image = plgContentQuotethis::findIMGquotethis( $article->text );
                $image = "<img src=\"" . $image . "\" width=\"" . $widthimage . "\" alt=\"\" />";
                $image = "<div style=\"float:left;padding:5px;\">" . $image . "</div>";
            }
            
            $style4quote = "<style type=\"text/css\"><!--"
            .".quote {width:".$width."px; padding: 6px; border: solid 1px #".$colorborder."; font: ".$fontsize."px helvetica, verdana, sans-serif; color: #".$fontcolor."; background-color: #".$backgroundcolor."}"
            .".quote a {font: ".$fontsizetitle."px arial, serif; color: #".$colortitle."; text-decoration: underline}"
            .".quote a:hover {color: #".$colortitlehover."; }"
            ."//--></style>";
    
            $javascript = "\n<script language=\"JavaScript\" type=\"text/javascript\">\n<!--\n"
                ."window.addEvent('domready', function(){\n"
                ."var mySlide = new Fx.Slide('quotethisexpand').hide();    \n"
                ."$('toggle').addEvent('click', function(e){\n"
                ."e = new Event(e);\n"
                ."mySlide.toggle();\n"
                ."e.stop();\n"
                ."});\n"
                ."}); \n//-->"
                ."</script>\n";
                
            if ( $preview ) $document->addCustomTag( $style4quote );
                
            $html  = $javascript;        
            $html .= "<a id=\"toggle\" href=\"#\">" . JText::_('QUOTETHISARTICLEONYOURSITE') . "</a>";
            $html .= "<br /><div id=\"quotethisexpand\"><br />";
            $html .= "<strong>".JText::_('CREATELINKTOWARDSTHISARTICLE')."</strong>";
            $html .= "<br /><br />";        
            $html .= "<textarea name=\"textarea\" cols=\"$txtcols\" rows=\"$txtrows\">".$style4quote.$image."<div class=\"quote\">"
            ."<a href=\"" . $thequote ."\" target=\"_blank\">" . $title . "</a>" . $thedate . $introtext
            ."<div align=\"right\" style=\"width:".$width."px\"><p style=\"text-align:right;\">".$copyright."<a href=\"".JURI::base()."\" target=\"_blank\">".$mainframe->getCfg('sitename')."</a></p></div></div></textarea>";
            $html .= "<br /><br />";
            
            if ( $preview ) {
                $html .= JText::_('PREVIEWQUOTE');
                $html .= "<br /><br />";
                $html .= $style4quote;
                $html .= $image . "<div class=\"quote\">\n<a href=\"$thequote\" target=\"_blank\">$title</a>"
                .$thedate.$introtext
                ."\n<div align=\"right\" style=\"width:".$width."px\"><p style=\"text-align:right;\">$copyright<a href=\"".JURI::base()."\" target=\"_blank\">".$mainframe->getCfg('sitename')."</a></p></div></div>";
                $html .= "<br />";        
            }
            $html .= "<div class=\"small\" align=\"center\">";
            // This software is copyrighted: don't remove the copyright notice
            $html .= "Powered by <a href=\"http://www.alphaplug.com\">QuoteThis</a> &copy; 2008";
            $html .= "</div>";
            $html .= "</div>";
                
            $article->text = $article->text . $html;
    
        }
        
        function prepareIntroQuoteThis( $text, $length=150, $tags='' ) {
            // strips tags won't remove the actual jscript
            $text = preg_replace( "'<script[^>]*>.*?</script>'si", "", $text );
            $text = preg_replace( '/{.+?}/', '', $text);
            // replace line breaking tags with whitespace
            $text = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text );
        
            return html_entity_decode(plgContentQuotethis::smartSubstrQuoteThis( strip_tags( $text, $tags ), $length ));
        }
        
        function smartSubstrQuoteThis($text, $length=150) {
            if ( strlen($text) > $length ) {     
                $text = substr( $text, 0, $length );
                $blankpos = strrpos( $text, ' ' );    
                $text = substr( $text, 0, $blankpos );    
                $text .= "...";
            }  
            return $text;  
        }
        
        function findIMGquotethis( $contenttext ) {    
            $image = "";
            if ( preg_match_all('#src="(.*)"#Uis', $contenttext, $match ) ) {
                if ( count($match) ) {
                    $image = $match[1][0];
                }
            }
            return $image;
        }    
    }
    ?>
    
    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • S
      S
      sups
      scritto su ultima modifica di
      User Attivo 5
      #2

      Così a prima vista direi di commentare in questo modo lo script:

      /* $javascript = "\n<script language=\"JavaScript\" type=\"text/javascript\">\n<!--\n"
          ."window.addEvent('domready', function(){\n"
          ."var mySlide = new Fx.Slide('quotethisexpand').hide();    \n"
          ."$('toggle').addEvent('click', function(e){\n"
          ."e = new Event(e);\n"
          ."mySlide.toggle();\n"
          ."e.stop();\n"
          ."});\n"
          ."}); \n//-->"
          ."</script>\n"; */
          
      //$html  = $javascript;        
      //$html .= "<a id=\"toggle\" href=...";
      $html = "<a id=\"toggle\" href=...";
      

      Ciao!

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • B
        B
        bill152
        scritto su ultima modifica di
        User Attivo 0
        #3

        Ciao sups e grazie mille per il suggerimento, sono riuscito nel mio intento
        A presto!

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0
        • B
          B
          bill152
          scritto su ultima modifica di
          User Attivo 0
          #4

          Scusa un'altra cosa? C'è qualche problema nell'inserire l'attributo rel="nofollow" in un link nel codice mostrato, perchè facendolo il sito non mi sia apre più correttamente (carica una pagina bianca)

          1 Risposta Ultima Risposta
          Miglior risposta 0
          0
          • S
            S
            sydarex
            scritto su ultima modifica di
            User 0
            #5

            Puoi spiegarti maglio? Non ho capito il problema.

            1 Risposta Ultima Risposta
            Miglior risposta 0
            0
            • B
              B
              bill152
              scritto su ultima modifica di
              User Attivo 0
              #6

              Alla riga 264 al posto di
              $html .= "Powered by <a href="http://www.alphaplug.com">QuoteThis</a> © 2008";

              ho messo

              $html .= "Powered by <a href="http://www.alphaplug.com"rel="nofollow">QuoteThis</a> © 2008";

              Con tale modifica però il sito non si carica più correttamente.

              1 Risposta Ultima Risposta
              Miglior risposta 0
              0
              • S
                S
                sydarex
                scritto su ultima modifica di
                User 0
                #7

                E' normale, devi fare l'escape dei " nella stringa:

                $html .= "Powered by <a href=\"non_sono_premium\"rel=[B]\"nofollow\">[/B]QuoteThis</a> &copy; 2008";
                
                1 Risposta Ultima Risposta
                Miglior risposta 0
                0
                • B
                  B
                  bill152
                  scritto su ultima modifica di
                  User Attivo 0
                  #8

                  Risolto.
                  Grazie mille dell'aiuto sydarex

                  1 Risposta Ultima Risposta
                  Miglior risposta 0
                  0

                  Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

                  Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

                  Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

                  Registrati Accedi
                  Rispondi
                  • Risposta alla discussione
                  Effettua l'accesso per rispondere
                  • Da Vecchi a Nuovi
                  • Da Nuovi a Vecchi
                  • Più Voti


                  • Accedi

                  • Non hai un account? Registrati

                  • Accedi o registrati per effettuare la ricerca.
                  • Primo post
                    Ultimo post
                  Home Accedi Registrati
                  Menu
                  • CATEGORIES
                  • La Community Connect.gt
                  • Presentati alla Community
                  • News Ufficiali da Connect.gt
                  • Internet News
                  • A Scuola Di
                  • Digital Marketing
                  • Intelligenza Artificiale
                  • SEO & GEO
                  • Web Marketing e Content
                  • Google Analytics e Web Analytics
                  • Google Ads & Advertising
                  • YouTube
                  • TikTok, Instagram e altri Social
                  • Google Adsense, Affiliazioni e Guadagno
                  • E-Commerce
                  • Coding e Sistemistica
                  • Help Center: consigli per il tuo progetto
                  • Hosting e Cloud
                  • Coding
                  • CMS & Piattaforme Self-Hosted
                  • Annunci e Collaborazioni
                  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
                  • Collaborazioni WEB e Lavoro: offro e cerco
                  • Impresa, Fisco e Leggi
                  • Consulenza Legale e Professioni Web
                  • Consulenza Fiscale, Imprese, Startup e P.Iva
                  • Gli Off Topic
                  • PC, Smartphone e altri Hardware
                  • Tutti i Software
                  • GT Fetish Cafè
                  • Discussioni
                  • Non letti 0
                  • Recenti
                  • Hashtag
                  • Popolare
                  • Utenti
                  • Privacy
                  • Termini e condizioni
                  • © 2026 Search On Media Group S.r.l.