Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
spasticdonkey
Newbie
Newbie



Joined: Sep 05, 2007
Posts: 78

PostPosted: Tue Aug 02, 2011 11:34 pm Reply with quote

*** Edited by montego: I split this post out from this thread here
http://montegoscripts.com/ftopict-409.html
*** and of edit.

I realize this conversation has spanned a couple of sites now, but wanted to pick your brain once more about another area of TON we have had to hardcode the shortened URL. The nukeSEO SB code... This is a little harder since you have URL's such as
Code:

http://www.diigo.com/post?url=http%3A%2F%2Fwww.rtsforce.com%2Fmodules.php%3Fname%3DNews%26file%3Darticle%26sid%3D16&title=DLC+-+The+Manhattan+Project+Pack


not sure I expect an easy answer here, but you have surprised me before Smile

the SB code
Code:
function getBookmarkHTML($mynukeurl, $mynuketitle, $separator = " ", $imgsize = "small")
{
###############################################################################
# Comment out, add and / or resort the $bookmarks array as desired.  Bookmark
# sites will be displayed in the order they appear in the $bookmarks array and
# all bookmarking sites in the array will be displayed.
###############################################################################
$bookmarks = array ();
$bookmarks["google"] = array (
               "siteurl"   => "http://www.google.com/bookmarks/mark?op=edit&bkmk={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Google Bookmarks] body=[Bookmark and share this link with Google Bookmarks]",
               "imgclass"   => "google"
            );
$bookmarks["yahoo"] = array (
               "siteurl"   => "http://myweb2.search.yahoo.com/myresults/bookmarklet?u={MYNUKEURL}&t={MYNUKETITLE}",
               "imgalt"   => "header=[Yahoo! My Web] body=[Bookmark and share this link with Yahoo! My Web]",
               "imgclass"   => "yahoo"
            );
$bookmarks["del.icio.us"] = array (
               "siteurl"   => "http://del.icio.us/post?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[del.icio.us] body=[Bookmark and share this link with Delicious.com]",
               "imgclass"   => "delicious"
            );
$bookmarks["digg"] = array (
               "siteurl"   => "http://digg.com/submit?phase=2&url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Digg] body=[Bookmark and share this link with Digg]",
               "imgclass"   => "digg"
            );
$bookmarks["stumbleupon"] = array (
               "siteurl"   => "http://www.stumbleupon.com/submit?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Stumbleupon] body=[Share this link with your friends at Stumbleupon]",
               "imgclass"   => "stumbleupon"
            );
$bookmarks["myspace"] = array (
               "siteurl"   => "http://www.myspace.com/Modules/PostTo/Pages/?u=check+this+out:+{MYNUKEURL}",
               "imgalt"   => "header=[Myspace] body=[Share this link with your friends on Myspace]",
               "imgclass"   => "myspace"
            );
$bookmarks["reddit"] = array (
               "siteurl"   => "http://reddit.com/submit?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Reddit] body=[Bookmark and share this link with Reddit]",
               "imgclass"   => "reddit"
            );
$bookmarks["technorati"] = array (
               "siteurl"   => "http://technorati.com/cosmos/search.html?url={MYNUKEURL}",
               "imgalt"   => "header=[Technorati] body=[Search this link with Technorati]",
               "imgclass"   => "technorati"
            );
$bookmarks["facebook"] = array(
               "siteurl"   => "http://www.facebook.com/sharer.php?u={MYNUKEURL}",
               "imgalt"   => "header=[Facebook] body=[Share this link with your friends on Facebook]",
               "imgclass"   => "facebook"
            );
$bookmarks["twitter"] = array(
               "siteurl"   => "http://twitter.com/home?status=check+this+out:+{MYNUKEURL}",
               "imgalt"   => "header=[Twitter] body=[Share this link with your friends on Twitter]",
               "imgclass"   => "twitter"
            );
$bookmarks["windowslive"] = array(
               "siteurl"   => "https://favorites.live.com/quickadd.aspx?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Windows Live] body=[Share this link with your friends on Windows Live]",
               "imgclass"   => "windowslive"
            );
$bookmarks["ask"] = array(
               "siteurl"   => "http://myjeeves.ask.com/mysearch/BookmarkIt?v=1.2&t=webpages&url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Ask.com] body=[Share this link with Jeeves on Ask.com]",
               "imgclass"   => "ask"
            );
$bookmarks["squidoo"] = array(
               "siteurl"   => "http://www.squidoo.com/lensmaster/bookmark?{MYNUKEURL}",
               "imgalt"   => "header=[Squidoo] body=[Someone, somewhere, wants to know what you think, Squidoo!]",
               "imgclass"   => "squidoo"
            );
$bookmarks["slashdot"] = array(
               "siteurl"   => "http://slashdot.org/bookmark.pl?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[slashdot] body=[Share on slashdot, news for nerds, stuff that matters]",
               "imgclass"   => "slashdot"
            );
$bookmarks["blinklist"] = array(
               "siteurl"   => "http://blinklist.com/index.php?Action=Blink/addblink.php&Url={MYNUKEURL}&Title={MYNUKETITLE}",
               "imgalt"   => "header=[Blinklist] body=[Help others Discover and Learn, Share on Blinklist]",
               "imgclass"   => "blinklist"
            );
$bookmarks["newsvine"] = array(
               "siteurl"   => "http://www.newsvine.com/_wine/save?u={MYNUKEURL}&h={MYNUKETITLE}",
               "imgalt"   => "header=[Newsvine] body=[Help others Get Smarter, share this story on Newsvine]",
               "imgclass"   => "newsvine"
            );
$bookmarks["fark"] = array(
               "siteurl"   => "http://cgi.fark.com/cgi/fark/submit.pl?new_url={MYNUKEURL}&new_comment={MYNUKETITLE}&linktype=cool",
               "imgalt"   => "header=[Fark] body=[It's not News, it's Fark!]",
               "imgclass"   => "fark"
            );
$bookmarks["diigo"] = array(
               "siteurl"   => "http://www.diigo.com/post?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Diigo] body=[Research, Share, Collaborate this story on Diigo]",
               "imgclass"   => "diigo"
            );
$bookmarks["dzone"] = array(
               "siteurl"   => "http://www.dzone.com/links/add.html?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[dzone] body=[share on dzone - fresh links for developers]",
               "imgclass"   => "dzone"
            );
$bookmarks["swik"] = array(
               "siteurl"   => "http://stories.swik.net/?submitUrl&url={MYNUKEURL}",
               "imgalt"   => "header=[SWiK] body=[Share on SWiK - a community driven resource for open source software]",
               "imgclass"   => "swik"
            );
$bookmarks["faves"] = array(
               "siteurl"   => "http://faves.com/Authoring.aspx?u={MYNUKEURL}&t={MYNUKETITLE}",
               "imgalt"   => "header=[Faves] body=[Share on Faves - sites you love from people like you]",
               "imgclass"   => "faves"
            );
$bookmarks["simpy"] = array(
               "siteurl"   => "http://www.simpy.com/simpy/LinkAdd.do?href={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Simpy] body=[Save, tag, search and share this story on Simpy]",
               "imgclass"   => "simpy"
            );
$bookmarks["blogmarks"] = array(
               "siteurl"   => "http://blogmarks.net/my/new.php?mini=1&simple=1&url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Blogmarks] body=[Share this story on Blogmarks, and join the social bookmarking revolution]",
               "imgclass"   => "blogmarks"
            );
$bookmarks["spurl"] = array(
               "siteurl"   => "http://www.spurl.net/spurl.php?url={MYNUKEURL}&title={MYNUKETITLE}",
               "imgalt"   => "header=[Spurl] body=[Share this story on Spurl, online bookmarks with so much more..]",
               "imgclass"   => "spurl"
            );
###############################################################################
# You do not need to modify anything below this line
###############################################################################
   $bookmarkHTML = '';
   $mynukeurl = str_replace('&', '&', $mynukeurl);
   $mynukeurl = htmlentities(urlencode($mynukeurl));
   $mynuketitle = str_replace('&', '&', $mynuketitle);
   $mynuketitle = urlencode($mynuketitle);
   $numBookmarks = count($bookmarks);
   $numkey = 0;
   foreach ($bookmarks as $sitename => $sitedetails)
   {
      $siteurl = $sitedetails['siteurl'];
      $siteurl = str_replace("{MYNUKEURL}", $mynukeurl, $siteurl);
      $siteurl = str_replace("{MYNUKETITLE}", $mynuketitle, $siteurl);
      $imgalt = $sitedetails['imgalt'];
      $imgclass = $sitedetails['imgclass'];
      $bookmarkHTML .= "<a href=\"$siteurl\" title=\"$imgalt\" target=\"_blank\" class=\"donkeytopic\">";
      $siteimg = 'modules/News/css/images/transparent.gif';
      if ($imgsize == "text") {
         $bookmarkHTML .= "$sitename";
      } else {
         # XHTML fix courtesy of Guardian - http://code-authors.com
         $bookmarkHTML .= "<img alt=\"\" border=\"0\" class=\"sbicon $imgclass\" src=\"$siteimg\" style=\"opacity:0.4;filter:alpha(opacity=40)\" onmouseover=\"this.style.opacity=1;this.filters.alpha.opacity=100\" onmouseout=\"this.style.opacity=0.4;this.filters.alpha.opacity=40\" />";
      }
      $bookmarkHTML .= "</a>";
      $numkey = $numkey + 1;
      //if ($numkey < $numBookmarks) $bookmarkHTML .= "$separator";
   }
   return $bookmarkHTML;
}
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Wed Aug 03, 2011 12:52 am Reply with quote

My question on these is why do you want/need to "tap" these as they are supposed to be "hardcoded" out to the other social/share sites? Which links are internal to your site that you need/want tapped that you are not able to?

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
spasticdonkey
Newbie
Newbie



Joined: Sep 05, 2007
Posts: 78

PostPosted: Wed Aug 03, 2011 11:59 am Reply with quote

my thought was, if you are using shortlinks why allow users to promote your site using the long url. depending on where/how it was shared you may get some seo benefit from SB, and search engines may end up following those links to untapped pages as well.

For the purposes of TON, when building the URL to be bookmarked, we are either using the goo.gl short url, the shortlink url if enabled, else the longurl.

Code:
   //determine what links to use for SB
   if (isset($googlapi) AND ($usegooglsb)) {
      $articleurl = $goourl;
      }elseif (defined('TNSL_USE_SHORTLINKS')){
      $articleurl = $nukeurl.'/article'.$sid.'.html';
      }else{
      $articleurl = $nukeurl.'/modules.php?name='.$module_name.'&file=article&sid='.$sid;
   }
   $articletitle = $title;
   $socialbookmarkHTML = getBookmarkHTML( $articleurl, $articletitle, " ", "small");


TON also includes kguske's SB blocks which go about building links like so:

Code:
$_SERVER['FULL_URL'] = 'http';
$_SERVER['FULL_URL'] .=  '://';
if($_SERVER['SERVER_PORT']!='80')
  $_SERVER['FULL_URL'] .=  $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
else
  $_SERVER['FULL_URL'] .=  $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if($_SERVER['QUERY_STRING']>' ')
{
  $_SERVER['FULL_URL'] .=  '?'.$_SERVER['QUERY_STRING'];
}


Guess I'm looking for a shortlink aware method for building these urls... and my apologies, not sure why I posted in this thread.. could have sworn it was named something else..
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Wed Aug 03, 2011 5:06 pm Reply with quote

I'm a dope. You're talking about {MYNUKEURL}. Sorry.

I'll take a look. Smile

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Aug 06, 2011 11:19 am Reply with quote

I split out the thread...

And, am looking at the alternatives here.

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Sat Aug 06, 2011 11:37 am Reply with quote

The problem with these links is they are embedded within other "links". In order to keep SL from messing up various things within JavaScript code, I have had to be more selective on what I tap. Therefore, this isn't going to be as easy as I would have hoped.

I can think of two options - that would have to come with a functional release, not a patch release - either:

1) Add a function to shortlinks.php that can be called from the nukeSEO SB code (or ANY other code anywhere) to "auto-tap" a link based upon a passed in URL string, or

2) Add another GTZ-PageTap.php like feature if enabled, would allow one to basically apply ANY preg_replace() of choice that would be executed at the very last step (i.e., after all other replacements have been made).

I actually like both of these options and may provide both in a 1.4.0 release.

Thoughts?

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
spasticdonkey
Newbie
Newbie



Joined: Sep 05, 2007
Posts: 78

PostPosted: Sat Aug 06, 2011 12:08 pm Reply with quote

Yes both sound excellent. For the time being we will continue to hard code the shorturl, but look forward to 1.4.0 Smile
 
View user's profile Send private message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 397

PostPosted: Mon Sep 05, 2011 4:46 am Reply with quote

All these various taps and associated problems (JS issues) are getting a bit complicated IMHO. We really need some sort of master URL handler Class (API) like the Zend/CI Frameworks use.
Maybe it's possible to write taps (I suppose they would be redirects technically) to htaccess or use the DB to store them.
It's something I have been meaning to look at for a while, along with caching whole pages (the rendered HTML being cached so no DB access is required) for Anon users.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1399

PostPosted: Mon Sep 05, 2011 10:41 pm Reply with quote

G-man, I've actually discussed some thoughts around leveraging Kguske's DH design as a potential SL replacement. For each module, he's already making available within the object some of the key data. I would like to extend this a bit... See this here which was carved out from another thread:

http://nukeseo.com/modules.php?name=Forums&file=viewtopic&t=499

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©