Posts by: fly06

Posts: 263
Post: 6647
Topic: [Site Map] Allow Plugin Contribution

Wouldn't be nice to integrate plugins internal links to the site map?

Below is the modified version of the special_map.php file that supports this feature:

<?php
defined('is_running') or die('Not an entry point...');


class special_map{
    function special_map(){
        global $page,$langmessage,$config;


        /*
        An xml site map will not show any of the pages from dynamic add-ons
        ... which is precisely what the regular sitemap shows
        */

        if( isset($_GET['xml']) ){
            $this->xml();
            return;
        }

        $this->MultiSiteData();

        echo '<div class="sitemap_xml">';
        echo common::Link('Special_Site_Map','XML','xml');
        echo '</div>';
        echo '<h2>';
        echo gpOutput::ReturnText('site_map');
        echo '</h2>';

        //gpOutput::GetFullMenu();
        $this->GetSiteMap();

    }

    function GetSiteMap() {

        global $gp_menu, $gp_index, $gp_titles, $config, $dataDir;

        $addons = $config['addons'];

        echo '<ul>';

        $prev_level = 0;
        $i = 0;
        foreach ($gp_menu as $key => $val){
            $level = $val['level'];
            $title = array_search($key, $gp_index);
            $label = common::GetLabel($title, false);
            $type = common::SpecialOrAdmin($title);
            if ($level > $prev_level) {
                $i = 0;
                echo '<ul>';
            } elseif ($level < $prev_level) {
                $i = 0;
                echo '</ul>';
            }
            $class = 'class="li_'.$i.'"';
            echo '<li '.$class.'>'.common::Link($title, $label, '').'</li>';
            if (($type == 'special') && isset($gp_titles[$key]['addon'])) {
                $folder = $addons[$gp_titles[$key]['addon']]['code_folder_part'];
                $file = $dataDir.$folder.'/Site_Map.php';        
                if (file_exists($file)) {
                    $site_map = include($file);
                    $this->makeAddonSiteMap($site_map);
                }
            }
            $prev_level = $level;
            $i++;
        }

        echo '</ul>';

    }

    function MultiSiteData(){
        global $page, $config;

        $page->head .= '<meta name="mdu" content="'.substr(md5($config['gpuniq']),0,20).'" />';

        if( defined('multi_site_unique') ){
            $page->head .= '<meta name="multi_site_unique" content="'.multi_site_unique.'" />';
        }
        if( defined('service_provider_id') && is_numeric(service_provider_id) ){
            $page->head .= '<meta name="service_provider_id" content="'.service_provider_id.'" />';
        }
    }


    /*
    <url>
        <loc>http://www.example.com/</loc>
        <lastmod>2005-01-01</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    */
    function xml(){
        //global $gp_menu;
        global $gp_menu, $gp_index, $gp_titles, $config, $dataDir;

        $addons = $config['addons'];

        header('Content-Type: text/xml; charset=UTF-8');
        echo '<?xml version="1.0" encoding="UTF-8"?>';
        echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';


        foreach($gp_menu as $key => $info){

            $title = common::IndexToTitle($key);
            $type = common::SpecialOrAdmin($title);

            if( isset($info['level']) ){
                echo "\n";
                echo '<url>';
                echo '<loc>';
                echo 'http://';
                echo $_SERVER['SERVER_NAME'];
                //echo common::GetUrl(urlencode($title));
                echo common::GetUrl($title);
                echo '</loc>';
                echo '</url>';
            }

            // Addons
            if (($type == 'special') && isset($gp_titles[$key]['addon'])) {
                $folder = $addons[$gp_titles[$key]['addon']]['code_folder_part'];
                $file = $dataDir.$folder.'/Site_Map.php';        
                if (file_exists($file)) {
                    $site_map = include($file);
                    $this->makeAddonSiteMapXml($site_map);
                }
            }            
            
        }

        echo '</urlset>';

        die();
    }

Edited: 6 years ago
Post: 6643
Topic: Forward Slash Encoded Twice in the XML Site Map

As a result Google references the same page twice.

In the xml() method of the special_map class, replace:

echo common::GetUrl(urlencode($title));

by:

echo common::GetUrl($title);

Since GetUrl is already performing some url encoding.

 

Edited: 6 years ago
Post: 6642
Topic: rel attribute in menu links

Thanks to the W3C Validator, I just found that 'Robots Visibility' parameters are added both in the:

  1. Page head (meta robots)
  2. Menu links (rel attributes)

If the first addition is, of course, correct, the second is not I think.

I have commented these lines out in the OutputMenu() method of the gpOutput class to pass the W3C validator:

                if( !empty($gp_titles[$menu_key]['rel']) ){
                    $attributes_a['rel'] = $gp_titles[$menu_key]['rel'];
                }

 

 

6 years ago
Post: 6640
Topic: Agent Type

Hi Stano,

How does Site Counter determine the Agent Type?

So far all my visitors have Unknown as Agent Type value.

Thanks,

-Fly06

6 years ago
Post: 6638
Topic: [New EasyNewsLetter Plugin] Beta Testers Welcome

Can you make an example.

Sure.

Html (Subscribe_Tmpl.php file)

<?php defined('is_running') or die('Not an entry point...'); ?>

<?php global $addonRelativeCode, $linkPrefix, $page; ?>

<h3><?php echo gpOutput::SelectText('Newsletter'); ?></h3>

<form action="<?php echo $linkPrefix; ?>/EasyNewsLetter" id="EasyNewsLetter_Subscribe" class="EasyNewsLetter_Subscribe" method="post">

<p><?php echo gpOutput::SelectText('If you\'d like to get our newsletter, please enter your e-mail-address here:'); ?></p>

<label for="nl_email">
<p><input class="input text" type="text" maxlength="254" name="nl_email" value="" size="15"/></p>
</label>

<input type="hidden" name="cmd" value="subscribe" />
<input type="hidden" name="nl_redirect" value="<?php echo $page->title; ?>" />
<input type="hidden" name="newsletter_nonce" value="<?php echo htmlspecialchars(common::new_nonce('newsletter_post',true)); ?>" />

<p><input type="submit" class="submit" name="aaa" value="<?php echo gpOutput::SelectText('Subscribe'); ?>" /></p>

</form>

Css (Plugin Config)

.EasyNewsLetter_Subscribe input {
    width:210px;
    border-radius: 10px 0px 10px 0px;
    color:#777;
    background:#fff;
    margin:7px 1px;
    padding:10px 5px;
    border: none;
}

.EasyNewsLetter_Subscribe input.submit {
    color: #FFFFFF;
    text-transform:uppercase;
    background: #064C8A;
    font-family: 'Armata', sans-serif;
    font-size: 15px;
    font-weight: normal;
    width:160px;
    cursor:pointer;
    margin:12px 10px 12px 0;
}

Js  (Plugin Config)

$(document).ready(function(){
    if (!$("input[name='nl_email']").val()) $("input[name='nl_email']").val('[email protected]')
    $("input[name='nl_email']").focus(function() {
        if(this.value=='[email protected]'){this.value=''}; 
    });
    $("input[name='nl_email']").blur(function() {
        if(this.value==''){this.value='[email protected]'};
    });
});

Hope this helps.

 

 

 

 

 

6 years ago
Post: 6636
Topic: [New EasyNewsLetter Plugin] Beta Testers Welcome

I have added the plugin to the gpEasy repository.

https://gpeasy.com/Plugins/258_EasyNewsLetter

6 years ago
Post: 6628
Topic: [New EasyNewsLetter Plugin] Beta Testers Welcome

Done.

Thanks for the screenshots.

6 years ago
Post: 6626
Topic: [New EasyNewsLetter Plugin] Beta Testers Welcome

I have added an import form in the 'Email List' admin page to import subscribers (emails) from the Newsletter plugin if it is installed.

See my (updated) first post for details.

6 years ago
Post: 6622
Topic: [New EasyNewsLetter Plugin] Beta Testers Welcome

Hi feniweb,

Thanks a lot for your feedback.

Please, see my comments below.

1 Navigation to the sections in each window.

Sorry but I am not sure to understand what you mean.

2 It would be nice if you could store multiple mailing form and assign evetuel even individual emails via a category.

I agree it would be nice to have such a feature but it would also require a lot of extra coding...

Thanks again for testing the plugin.

 

6 years ago
Post: 6621
Topic: jQuery Book?

Thanks for the link jogai.

The website content looks really great but it's not what I am looking for (a real book).

Have ordered the Flanagan's book on Amazon.

 

6 years ago

News

Typesetter 5.1
8/12/2017

Typesetter 5.0.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

Over 8 Times Faster Than Wordpress
5/3/2016

We've known for a long time that Typesetter is fast. It's something we take pride ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register