Dev Notch
Tuesday, 4 October 2016
Hot Kiss
Lisa Haydon announces her wedding with a HOT KISS – view pic!
Lisa Haydon announces her wedding with a HOT KISS – view pic!
And yet another Bollywood celebrity is going to get hitched! After Mandana Karimi announced her engagement in a unique way, Bollywood actress Lisa Haydon has now announced her wedding with this hot pic! She took to Instagram to share a picture with her would-be-husband which has her sharing an intimate kiss with him! Lisa is seen kissing him at the airport and Captioned it as “Gonna marry him (sic).” Whoa! Now this is big news! She hasn’t tagged her loverboy but we do know that its none other than her longtime boyfriend Dino Lalvani. There have been rumours of them dating and the couple were even out on a romantic holiday in Greece recently.
The actress has been in a stable relationship with Dino, who is a 41-year-old UK-based businessman for almost a year now. All that we know about him is that he is the son of Pakistani entrepreneur Gullu Lavlani. It was in October last year that Lisa made her first official appearance with Dino when the two posed for the cameras on the red carpet at a charity gala to raise funds for Syrian children and exactly a year later, Dino and Lisa have decided to take their relationship to the next level. Awesome! (ALSO READ: Lisa Haydon REPLACES Diana Penty in Athithi in London!)
During the IIFA (International Indian Film Academy) Awards in Madrid, Spain this year, Lisa referred to Dino as ‘my boo’ and that statement was enough for us to believe in their relationship rumours.. Well, now that Lisa has made it official by posting a picture on Instagram, we so wish to know much more about them and how it all started..We just cannot wait for Lisa to spill the beans!
Lisa was last seen in Housefull 3 along with Jacqueline Fernandez, Akshay Kumar, Nargis Fakhri, Riteish Deshmukh and Abhishek Bachchan. Although she did quite a few Bollywood films earlier, she got recognition after Queen which also starred Kangana Ranaut. She will next be seen in Ajay Devgn’s Baadshaho.
Ad will auto hide after 5 OR Skip Ad after 5 seconds Skip
Lisa Haydon with boyfriend in Greece
Bollywood actress Lisa is currently holidayin with boyfriend in Greece.
Image credit: Instagram
Lisa Haydon snapped at beach in Greece
Lisa looks so hot as she enjoys at beach during her recent vacation.
Image credit: Instagram
Lisa Haydon snapped in bikini at resort in Greece
Lisa looks happy during her short trip to Greece with boyfriend.
Image credit: Instagram
Lisa Haydon snapped in swimwear at a beach in Greece
Lisa did this super hot red swimwear during her recent Greece vacation.
Image credit: Instagram
Lisa Haydon with boyfriend in her Greece resort
Lisa looks sun kissed as she returns from beach in evening to her resort.
Image credit: Instagram
Lisa Haydon shares picture from her resort
She is addicted to beaches and bikini is her favorite outfit, then how could she resist going to this one.
Image credit: Instagram
Lisa Haydon shares a picture from Greece
Lisa was off for this short trip to Greece 4 days back and now she is all refreshed again.
Image credit: Instagram
Latest of Jacqueline Fernandez
View More Ranbir Kapoor BITCHES out bestie Arjun Kapoor! After breaking up with Katrina Kaif, is Ranbir Kapoor trying to hook up with Jacqueline Fernandez? Not Katrina Kaif but this hottie has become the face of Salman Khan's Being Human Jewellery!
Latest from News & Gossip
View More Fawad Khan NEVER said 'Bollywood Kisika Baap Nahi Hai' and we have SOLID PROOF! 5 records Sushant Singh Rajput broke with MS Dhoni: The Untold Story! Rana Daggubati recent makeover proves Baahubali 2 just got bigger! Are Katrina Kaif and Aditya Roy Kapur's DATING rumours really true? Find out here! All is well between Ranveer Singh and Deepika Padukone - here's proof! Aishwarya Rai Bachchan DEMANDED for a bold role in Ae Dil Hai Mushkil!
Watch: Priyanka Chopra’s LEAKED love-making scene from ‘Quantico 2’
The second season of Priyanka Chopra starrer Americal thriller series ‘Quantico’ came up with a bang. It got rave reviews from the viewers and every one has been going gaga over Priyanka’s classy appearance and powerful performance as a CIA agent.
While everyone wants to have more and more of her chic style, it has been revealed that PeeCee will be having some sensuous love-making scenes on the show. In fact, a video of her love-making scene from ‘Quantico 2’ have been leaked and is going viral.
In this video, PeeCee, who plays the role of Alex Parish, is seen getting intimate Jake McLaughlin, who portrays Ryan Booth on the show.
It was earlier reported that Alex Parish will have a love story this time and will be romantically involved with Ryan Booth. In fact, their hot kiss in the first episode did set the screen on fire.
The leaked intimate scene between Alex and Ryan have made it clear that ‘Quantico 2’ is lot more than a mere crime mystery.
Besides, several new faces will also be seen in the second season of the American series, including Russel Tovey, Pearl Thusi, Blair Underworld, David Call, etc.
The actress has indeed been ecstatic about the show and has been constantly sharing pictures from the sets of ‘Quantico 2’ on her Instagram account.
Hot Kiss Announces Licensing Agreement with Wildseed to Produce the Hot Kiss Fashion Smart Skin.
Business Editors/High-Tech Writers
CTIA Wireless IT and Entertainment 2003
LOS ANGELES--(BUSINESS WIRE)--Oct. 20, 2003
New Smart Skin(TM) intelligent accessories bring stylish options to
wireless phones with the Hot Kiss label for young, fashion forward
female consumers
Hot Kiss, the Los Angeles-based junior apparel manufacturer and Wildseed Ltd., a software company pioneering Smart Skin intelligent accessories, announced today an exclusive licensing agreement for Wildseed to produce the Hot Kiss fashion Smart Skin. The Wildseed Smart Skin intelligently stylizes both the inside and outside of a Smart Skin capable wireless phone. Software loaded onto a tiny chip built into the accessory creates a dynamic user interface that gives wireless consumers the ultimate integrated fashion and entertainment experience.
The Hot Kiss branded Smart Skin will deliver fashion industry information, music, ring tones, video clips, pictures, and Hot Kiss Web site access through dynamic network-driven data applications related to the theme of the skin. For example, the phone's screens and custom applications will morph to match the exterior design and color of the Smart Skin featuring Hot Kiss. The phone will be launched by Curitel, a handset manufacturer, in early 2004. Smart Skins will be initially available at carrier stores where the phone is sold.
"Hot Kiss customers were practically born with a mobile phone in their hands," says Moshe Tsabag, owner of Hot Kiss. "These ladies are incredibly savvy about everything from technology to fashion so partnering with Wildseed enables us to be on the verge of cutting edge lifestyle trends along with our customer."
Hot Kiss apparel customers are women who want fashion that easily transitions from school wear to street wear to club wear. Since its inception in 1996, Hot Kiss has become a driving force in the junior sportswear industry with more than $50 million dollars in annual sales. Hot Kiss apparel is available at stores nationwide, including Nordstroms, Gadzook's and Macy's. The brand is regularly featured in Cosmo Girl, Cosmopolitan, Elle Girl, Lucky, Marie Claire, Seventeen, Teen People and Teen Vogue.
What this means for Hot Kiss and other forward-thinking companies looking to extend their brand, is that a Smart Skin is another mechanism to merchandise content and product for customer use. Recently, Hot Kiss and Entertainment Tonight teamed up on a joint advertising and marketing campaign featuring Maria Menounos, who reports on film, television, music and fashion, for "Entertainment Tonight" and the weekly teen entertainment show "ET on MTV."
Wildseed research indicates that female teens and young adults crave fashion for their wireless phones. Brands have become such an integral component to their daily life that intersecting them across everything they do, wear and use is critical. Stylish Smart Skins are what fashionable young women want. This research shows that girls are really into not only features on the phone, but all things interactive like getting fashion updates, ability to change the style of the phone with new Smart Skins to match their mood and fashion look on any given day.
"The Hot Kiss label is fashion forward and fun, so combining that with stylish Smart Skins makes sense for our target market," explains Cindy Smith, vice president of marketing for Wildseed. "Every chic, young woman wants to be a part of the latest trends, and having a Hot Kiss fashion Smart Skin in her hand lets her have the most current Hot Kiss trends at her fingertips."
Wildseed will be demonstrating Smart Skin intelligent accessories at CTIA Wireless I.T. tradeshow from October 21st to 23rd, 2003 in Las Vegas. Wildseed's booth can be found in the M-tertainment pavilion 1133-A. G. Eric Engstrom, CEO for Wildseed will be participating on the "Multimedia" panel discussion on Wednesday October 22nd from 3:00 to 4:30pm in room 205.
About Hot Kiss, Inc.
HOT KISS is a Los Angeles-based manufacturer of junior sportswear, denim, sweaters and dresses. The company has assigned licensees to produce footwear, handbags, small leather goods, belts, shoes, swimwear, lingerie, socks, children's wear and a Canadian collection under the HOT KISS label. Principal and owner, Moshe Tsabag, formerly of Yes Clothing Co., launched this trend-setting collection in 1996. Today HOT KISS can be found in 4000 doors at national junior specialty chains like Gadzooks, Rampage and Wet Seal, and major department stores such as Macy's, Dillard's, Nordstrom, Burdines, Parisian, and Rich's, and hundreds of specialty stores nationwide. Retail price points range from $20-$50.
About Wildseed Ltd.
Wildseed is an innovative software company pioneering the world's first intelligent accessories for wireless phones. Smart Skin(TM) intelligent accessories stylize both the outside and inside of the phone for an integrated fashion and entertainment experience. These accessories package dynamic and static applications for phones giving carriers a way to merchandise content for consumer use. Smart Skins deliver music, ringtones, video clips, pictures, games and screen themes, plus dynamic network-driven data applications related to the theme of the skin. To maximize the experience, the software resident on the phone supports a Dynamic User Interface (DUI). Wildseed's DUI is called Smart Screens(TM) application framework and it provides the software that makes the phone's screens and custom applications morph to match the exterior design of the changeable Smart Skin on the phone. Smart Skins deliver a new source of recurring revenue for wireless carriers, handset manufacturers, media companies and retailers.
The first Smart Skin capable phone is GSM/GPRS and will be launched by Curitel in early 2004.
Wildseed's software is based on Linux and is licensed for use in specially designed handsets supporting GSM GPRS and Qualcomm's CDMA 1XRTT. Smart Screens software is also compatible with Symbian, Microsoft Stinger and Qualcomm's BREW.
Wildseed has offices in Kirkland, Washington and London, England.
Wildseed, the Wildseed logo, Smart Skin, and Smart Screen are trademarks of Wildseed Ltd.
For more information, please visit www.Wildseed.com.
Family Sex
Middle aged woman DO have better sex, study finds
Getty Miroslav Georgijevic
Sometimes it can feel that the cut off point for 'great sex' is somewhere in our thirties. After that, the picture painted makes it seem like it's all just holding hands and watching Bargain Hunt re-runs together.
But a new study has found that your sex life gets better with age because with age comes experience and the knowledge of what makes us tick.
Researchers at the University of Pittsburgh interviewed 20 women between the ages of 45 and 60 and the results may surprise you.
Advertisement - Continue Reading Below
The answers showed that while older women may be more likely to experience a lower sex drive, they also found it easier to communicate in bed and knew themselves a lot better than they did at a younger age.
Related Gallery
10 things to remove from your bedroom immediately
Holly Thomas MD, the study's lead author, will present the findings at The North American Menopause Society tomorrow. There, she will also explain that her and the study's co-researcher decided to interview the women rather than collect data on sexual frequency because it 'allowed women to speak their own words regarding their experiences' and made it easier to 'capture nuances and individual variations in women's lived experiences of sexual function during midlife'.
Holly explained to The Independent that: 'One of the most enlightening findings of this study was the large number of women who had successfully adapted to any negative changes by modifying their expectations regarding sexual activity, putting more emphasis on the emotional and intimacy aspects of sex, or adapting the sex acts themselves.'
Related Article
10 ways to have the best orgasm of your life
Many of the women interviewed attributed this to self-confidence and better communication – in particular when it came to asking partners to take prescription drugs for erectile dysfunction.
Professor Thomas, from Pittsburg University, also said that one of the most 'enlightening findings' from the research was the amount of women who had 'successfully adapted to any negative changes by modifying their expectations regarding sexual activity, putting more emphasis on the emotional and intimacy aspects of sex, or adapting the sex acts themselves.'
In short, we adapt to our changing sex life and take matters into our own hands so that though it's frequency may drop our satisfaction levels were higher.
This is fab news when you consider that previous research suggests sex helps us to live longer!
More on Prima.co.uk….
My husband and I had sex every day for a year — here's how we're doing now
More than one in four women will only have sex with the lights off
Consensus: Clinton wins debate – but Trump is far from finished
The most-watched presidential debate in history knocked Donald Trump sideways, but not out of the race for the White House, after he was tripped up by a well-drilled Hillary Clinton.
Riled by needling from Clinton about his family, the flamboyant Republican was forced on the defensive for much of their 90-minute showdown at Hofstra University, and swiftly saw some signs of faltering support among voters.
Opinion polls, which still suggest a 45% chance of Trump winning in November, will take days to fully measure the impact of Monday night’s debate, but bookmakers indicated a four-point bounce for Clinton by the morning, a trend supported by focus groups and a survey of those watching.
Yet if the unpredictable 2016 race has confirmed anything, it is that Trump’s bluster has frequently confounded pundits and resonated with voters. Unconventional outbursts during his first one-on-one debate at times rendered both opponent and moderator speechless.
“That makes me smart,” Trump told a shocked-looking Clinton when she accused him of paying no federal income tax.
“She doesn’t have the look. She doesn’t have the stamina,” he retorted when challenged over sexism toward the Democrat’s first woman nominee.
Briefly, some of Trump’s policy punches landed too: on “stolen” jobs, and an appeal to the electorate’s anti-establishment mood over trade. “Hillary, I’d just ask you this. You’ve been doing this for 30 years. Why are you just thinking about these solutions right now?” he said.
However, there was wide consensus the morning after the debate that it was Clinton who had shown more stamina and discipline, getting under her opponent’s skin within minutes of their opening pleasantries.
“Donald was very fortunate in his life, and that’s all to his benefit. He started his business with $14m, borrowed from his father, and he really believes that the more you help wealthy people, the better off we’ll be,” said the former secretary of state, in what appeared a carefully prepared tactic to undermine his blue-collar appeal and goad the businessman who has a reputation for being thin-skinned when criticised.
When Trump obliged by deviating down a meandering defence of business practices she claimed had “stiffed thousands of people”, Clinton next painted him as sleazy bigot.
“This is a man who has called women pigs, slobs and dogs, and someone who has said pregnancy is an inconvenience to employers,” she said, before one of the night’s few new lines of attack: “One of the worst things he said was about a woman in a beauty contest. He loves beauty contests, supporting them and hanging around them. And he called this woman ‘Miss Piggy’. Then he called her ‘Miss Housekeeping’, because she was Latina. Donald, she has a name.
“Her name is Alicia Machado. And she has become a US citizen and you can bet she is going to vote this November.”
Clinton also accused her opponent of building his political career on a “racist lie that our first black president was not an American citizen”.
By the end of their bruisingly one-way encounter, in which Trump barely mentioned his signature immigration policy or Obamacare, he fell back on crude hints about Clinton’s health and criticising her from taking time away from the campaign trail to study.
“I think Donald just criticized me for preparing for this debate. And yes, I did. And you know what else I prepared for? I prepared to be president. And I think that’s a good thing,” replied Clinton.
“Look, it’s all words, it’s all soundbites. I built an unbelievable company,” said a rattled-sounding Trump.
“Words matter. Words matter when you run for president. And they really matter when you are president,” responded Clinton.
Briefly, a compelling Trump painted vivid images, before appearing to lose himself in his own answers.
“She’s saying Russia, Russia, Russia,” he began an answer about cybersecurity and the hacking of Democratic headquarters. “It also could be somebody sitting on their bed that weighs 400lbs, OK?
“I have a son. He’s 10 years old. He has computers. He is so good with these computers, it’s unbelievable,” he digressed.
Clinton hits back after Trump attacks her ‘stamina’ at debate
Aboard her plane on Tuesday, Clinton projected confidence as she spoke to reporters – not a common election year occurrence – about her debate performance while taking a shot at Trump for alleging he had a defective microphone.
“Anyone who complains about the microphone is not having a good night,” Clinton told reporters.
The debate, she added, underscored questions about Trump’s fitness to be president. “Well, I think his demeanor, his temperament, his behavior on the stage can be seen by everybody,” she said.
“People can draw their own conclusions. I thought on several occasions he was making charges and claims that were demonstrably untrue, offering opinions that I think a lot of people would find offensive.”
Asked about Trump’s insistence that he had shown restraint by holding back on personal issues pertaining to Bill Clinton’s history of infidelity, she simply noted Trump “can run his campaign however he chooses” .
“I will continue to talk about what I want to do for the American people, lay out specific plans with very clear goals in mind to help us deal with all the challenges we face,” she said.
Speaking at a rally in North Carolina on Tuesday, she chided Trump’s performance by noting there was “a lot of work for fact-checkers last night,” before zeroing in on the Republican nominee’s continued refusal to release his tax returns even when pressed during the debate. “He actually bragged about gaming the system to get out of paying his fair share of taxes,” Clinton said.
While it is too early to tell how the first debate might impact the trajectory of the race, the positive mood within Clinton’s campaign was palpable the morning after. Staff could be heard cheering and applauding the Democratic nominee as she boarded her plane for a rally in Raleigh, North Carolina.
John Podesta, Clinton’s campaign chairman, said Trump’s persistent efforts to talk over the top of Clinton were revealing.
“I think his constant interruption of her probably was reminiscent of the way a lot of women feel about bullies in their lives,” Podesta said in a conversation with reporters at the back of the campaign plane.
“I thought it was kind of unbecoming and he couldn’t stop himself.”
But Trump dug in further on Tuesday, telling Fox News he had pulled his punches over Clinton family sex scandals, while his allies hit out at the debate’s moderator, Lester Holt.
“If I were Donald Trump I wouldn’t participate in another debate unless I was promised that the journalist would act like a journalist and not an incorrect, ignorant fact-checker,” said former New York mayor Rudy Giuliani.
Clinton responded that she looked forward to her next two encounters with Trump – whether he chose to attend the debates or not.
“Well, I’m going to show up. He gets to decide what he’s going to do,” she said. “If I’m the only person on stage, I’m the only person on stage.”
Authorities investigate possible family sex crime
“We received a report of possible sexual contact between a 14-year-old male and a 10-year-old female relative,” Huron County Sheriff’s Chief Deputy Ted Patrick said. “They are Huron County residents.”
The suspected incident is only described as having happened recently. Deputies received the complaint about 8:15 p.m. Sunday.
“It was reported by a parent,” Patrick said.
After a brief investigation, the boy was transported to the Seneca County Youth Center. Patrick said the juvenile was charged with delinquency and is being held in custody pending further hearings in Huron County Juvenile Court.
“Huron County Children Service personnel and the Huron County Sheriff’s Office are continuing their investigation,” said Patrick, who declined to elaborate.
Watch recent article :
Gay Sex
Judges Who Are Elected Like Politicians Tend to Act Like Them :
The Gay Sex Photo Demonstrators for and against same-sex marriage gathered on Wednesday in front of the Montgomery courthouse as Chief Justice Roy S. Moore of the Alabama Supreme Court testified in the case against him. Credit Dustin Chambers for The New York Times WASHINGTON — “Judges are not politicians, even when they come to the bench by way of the ballot,” Chief Justice John G. Roberts Jr. wrote last year in a case from Florida that took a small step toward insulating elected judges from political pressure. Judges in 39 states face elections, and it is only natural that they might find it hard to take an unpopular position. But Chief Justice Roberts wrote that both appointed and elected judges must ignore public sentiment. “Politicians are expected to be appropriately responsive to the preferences of their supporters,” the chief justice wrote. “A judge instead must ‘observe the utmost fairness,’ striving to be ‘perfectly and completely independent.’” He was quoting Chief Justice John Marshall, and it is a fine aspiration. But any number of studies have found that elections can affect judicial behavior. One released last week, for instance, found that elected judges are less likely to support gay rights than are appointed ones. The effect was most pronounced in cases decided by judges who ran in partisan elections. That seemed the case on Friday, when Roy S. Moore, chief justice of the Alabama Supreme Court, was suspended for the rest of his term for ordering the state’s probate judges to defy federal court orders on same-sex marriage. Appointed judges who must face retention elections also have reason to be sensitive to public opinion. In 2010, voters in Iowa removed three State Supreme Court justices who had joined a unanimous opinion allowing same-sex marriages. Earlier studies have shown that judges facing re-election are more likely to impose harsh criminal sentences, including death sentences. “Proximity to re-election makes judges more punitive — more likely to impose longer sentences, affirm death sentences and even override life sentences to impose death,” a report from the Brennan Center for Justice at New York University School of Law concluded last year. It is not hard to see why. Most negative advertisements in judicial elections attack candidates as soft on crime. The new study was commissioned by Lambda Legal, which litigates cases on behalf of lesbians, gay men and bisexual and transgender people, and was conducted by Anthony Michael Kreis, a professor at Chicago-Kent College of Law, and two colleagues. They looked at 127 decisions from state Supreme Courts since 2003, when the United States Supreme Court struck down a Texas law that made gay sex a crime. That is not a particularly large number of decisions. They addressed various legal questions, and they gave answers at various times in a period of rapid change in public attitudes on gay rights. And methods of selecting judges are not evenly distributed around the nation. But the results lined up predictably: the more political the selection mechanism, the less support for gay rights. State Supreme Courts whose justices were elected in partisan elections supported gay rights 53 percent of the time. The number grew to 70 percent for nonpartisan elections, to 76 percent for retention elections and to 82 percent for appointed systems. The difference between systems that relied on partisan elections, where judges run as Republicans or Democrats, and all others was statistically significant, the study’s authors wrote. In an interview, Professor Kreis said the findings concerning partisan elections may reflect the added element of political primaries, which can reward candidates who take positions that are more attractive to a party’s base than to the general electorate. Timing matters, too. Other studies have shown that judges seeking re-election start ruling differently as Election Day approaches. They issue harsher sentences for serious crimes, studies in Pennsylvania and Washington State have found. “All judges, even the most punitive, increase their sentences as re-election nears,” Gregory A. Huber and Sanford C. Gordon wrote in the Pennsylvania study, finding that judges there added as many as 2,700 years of additional prison time, or 6 percent of total prison time, in aggravated assault, rape and robbery sentences over a 10-year period. In Alabama, where judges can override jury recommendations of life sentences in capital cases, they are more likely to do so in election years. “What could explain Alabama judges’ distinctive proclivity for imposing death sentences in cases where a jury has already rejected that penalty?” Justice Sonia Sotomayor asked in a 2013 dissent. “The only answer that is supported by empirical evidence,” she wrote, “is one that, in my view, casts a cloud of illegitimacy over the criminal justice system: Alabama judges, who are elected in partisan proceedings, appear to have succumbed to electoral pressures.” Judicial elections are essentially unknown in the rest of the world. In the federal system, judges are appointed for life, shielding them from political pressure. Electing state-court judges, on the other hand, ensures a measure of popular accountability. That is a conscious choice, rooted in Jacksonian populism. It does what it was intended to do: make judges more responsive to the will of the people. That choice has consequences that may be in tension with Chief Justice Roberts’s wish for “the utmost fairness.” Continue reading the main story What Is ‘Let’s Talk About Gay Sex & Drugs’? Patrick Cash writes candidly for PinkNews about bringing gay men together to talk about the real issues facing their community. Can you remember when you first hit puberty? I was ten-years-old and the other side of the world. Some of my Mum’s family had emigrated to Australia and, after my grandfather died, she’d taken us to visit. It was the end of their summer, and still very hot. We were advised to nap through the strong afternoon sun, and so I was put in a room with closed shutters, lying in a bed beneath mosquito nets. I couldn’t sleep. Whether it was the libido-enhancing sunshine, or if it was being thousands of miles away from home, a box inside my mind had been unlocked and a deluge of men had begun. Tanned, muscular, and all with that 90s ‘curtains’ haircut the Backstreet Boys popularised. I didn’t know how to wank, but rubbing against the mattress felt great, as I guiltily imagined the unzipping of blue jeans. To give credit to my rigidly Catholic upbringing, I valiantly tried to transform the men into beautiful women. Only then the rubbing didn’t feel as good. Over the next couple of years puberty would hit in with a cock-filled vengeance. It was a difficult mental health plateau to navigate for a child who had no concept of ‘gay’, other than the subject of laughter in the playground, and who had been brought up to fear God. I remember making a deal with my own mind that if I allowed myself to temporarily indulge these thoughts about David Beckham, then I would grow up to marry a woman. The idea of telling anybody was terrifying. Throughout the manic masturbation of my teens, and into the ‘wicked’ beginnings of my sex with men, I publicly performed an accepted lust for girls. Gay sex was intertwined with being ‘wrong’. I became extremely depressed. I’d walk into school with my head hanging down. At age fifteen I’d indulge in vivid, non-sexual fantasies about somebody turning up, maybe sitting down next to me on a park bench, and I’d be able to speak to them my truth. Because homophobia was absolute, widespread and socially normalised: for friends, gay was ‘disgusting’, at school it was invisible, and in family it was a sin. This ‘hiding away’ of the self during our most formative years is not uncommon for gay men. Sadly, even for gay children hitting puberty now, I fear it’s the normalised reaction against a societal expectation to be straight. It means growing up with vast amounts of trauma, from which mental health issues may arise: commonly, low self-worth, internalised homophobia, substance abuse, and an over-emphasis on the physical body. I am not trying to cast aspersions on all gay men. But I know I’ve been through a number of these issues myself in my twenties. I’ve felt bad about myself and so put other gay men down, in order to give myself an illusory boost of self-esteem. For years, I hated everything camp about gay culture. I’m still working out my alcohol intake. And when I was using substances for sex, they made what was ‘wrong’, right. Matthew Todd writes eloquently about these issues in his recent book Straight Jacket, and chemsex expert David Stuart has a number of enlightening clips on Youtube. If there are lingering issues with self-esteem from growing up feeling ‘wrong’, then it’s far easier to go to the gym, or buy the latest clothes, or fake tan, and make the outside beautiful, rather than try and untangle the web inside. Here lies the Peter Pan complex too. I went through my period of making the gym my church. It paid off and I’d go into clubs, whip off my top, and know that I’d pull. Yet I rarely saw those guys again, and I began to realise that my whole value to them was based in my body. My thoughts and fears and dreams were not necessary. And I feel that may be true across swathes of the gay scene, from chillouts to Heaven; that we often weigh each other’s worth upon how we look. That’s why we’ve set up a night devoted to simply speaking and listening within the gay community. It’s called Let’s Talk About Gay Sex & Drugs. It’s an open-mic where everyone who wants to speak gets five minutes, but nobody gets more than five minutes. And anybody is welcome to just listen. Ultimately it’s an opportunity to speak what’s inside, to celebrate our true worth, and connect over what we’ve shared. ‘Let’sTalk About Gay Sex & Drugs – Arts’ is on Thursday 6th October from 6.30pm at Ku Klub, 30 Lisle Street, WC2H 7BA, just above Leicester Square tube. Free entry, all welcome. Is Dr Ben Carson Right When He Says a Lot of Men Go into Prison Straight but Come out Gay? My answer to this question on Quora: No, endless studies done over many years have shown that it is impossible to turn truly gay men straight. Not only that, but after age 15, men cannot even be moved on the sexual orientation scale. So you can’t even turn a 10-90 gay man into a 20-80 gay man (first number is heterosexual response as a percentage of maximum and second number is maximum). Obviously if gay men cannot be turned straight, then the opposite is also true. If it works one way, it must work the other way. If gay men can’t turn straight, straight men can’t turn gay. This has been a lot harder to test out because men hardly ever show up in sex clinics wanting to turn from straight to gay. However, there is at least one case in the literature of a straight male college student who desperately wanted to turn gay but nothing was working, so he showed up for therapy. What is not known is if male sexual orientation can be changed before age 15. This would require studies on the sexuality of children, which as you can imagine might be pretty problematic. But science seems pretty clear now that male sexual orientation is fixed at least by age 15. Anecdotally, reports say that straight men who go into prison and have gay sex in prison abandon gay sex when they leave prison and go back to a straight lifestyle.
The Gay Sex Photo Demonstrators for and against same-sex marriage gathered on Wednesday in front of the Montgomery courthouse as Chief Justice Roy S. Moore of the Alabama Supreme Court testified in the case against him. Credit Dustin Chambers for The New York Times WASHINGTON — “Judges are not politicians, even when they come to the bench by way of the ballot,” Chief Justice John G. Roberts Jr. wrote last year in a case from Florida that took a small step toward insulating elected judges from political pressure. Judges in 39 states face elections, and it is only natural that they might find it hard to take an unpopular position. But Chief Justice Roberts wrote that both appointed and elected judges must ignore public sentiment. “Politicians are expected to be appropriately responsive to the preferences of their supporters,” the chief justice wrote. “A judge instead must ‘observe the utmost fairness,’ striving to be ‘perfectly and completely independent.’” He was quoting Chief Justice John Marshall, and it is a fine aspiration. But any number of studies have found that elections can affect judicial behavior. One released last week, for instance, found that elected judges are less likely to support gay rights than are appointed ones. The effect was most pronounced in cases decided by judges who ran in partisan elections. That seemed the case on Friday, when Roy S. Moore, chief justice of the Alabama Supreme Court, was suspended for the rest of his term for ordering the state’s probate judges to defy federal court orders on same-sex marriage. Appointed judges who must face retention elections also have reason to be sensitive to public opinion. In 2010, voters in Iowa removed three State Supreme Court justices who had joined a unanimous opinion allowing same-sex marriages. Earlier studies have shown that judges facing re-election are more likely to impose harsh criminal sentences, including death sentences. “Proximity to re-election makes judges more punitive — more likely to impose longer sentences, affirm death sentences and even override life sentences to impose death,” a report from the Brennan Center for Justice at New York University School of Law concluded last year. It is not hard to see why. Most negative advertisements in judicial elections attack candidates as soft on crime. The new study was commissioned by Lambda Legal, which litigates cases on behalf of lesbians, gay men and bisexual and transgender people, and was conducted by Anthony Michael Kreis, a professor at Chicago-Kent College of Law, and two colleagues. They looked at 127 decisions from state Supreme Courts since 2003, when the United States Supreme Court struck down a Texas law that made gay sex a crime. That is not a particularly large number of decisions. They addressed various legal questions, and they gave answers at various times in a period of rapid change in public attitudes on gay rights. And methods of selecting judges are not evenly distributed around the nation. But the results lined up predictably: the more political the selection mechanism, the less support for gay rights. State Supreme Courts whose justices were elected in partisan elections supported gay rights 53 percent of the time. The number grew to 70 percent for nonpartisan elections, to 76 percent for retention elections and to 82 percent for appointed systems. The difference between systems that relied on partisan elections, where judges run as Republicans or Democrats, and all others was statistically significant, the study’s authors wrote. In an interview, Professor Kreis said the findings concerning partisan elections may reflect the added element of political primaries, which can reward candidates who take positions that are more attractive to a party’s base than to the general electorate. Timing matters, too. Other studies have shown that judges seeking re-election start ruling differently as Election Day approaches. They issue harsher sentences for serious crimes, studies in Pennsylvania and Washington State have found. “All judges, even the most punitive, increase their sentences as re-election nears,” Gregory A. Huber and Sanford C. Gordon wrote in the Pennsylvania study, finding that judges there added as many as 2,700 years of additional prison time, or 6 percent of total prison time, in aggravated assault, rape and robbery sentences over a 10-year period. In Alabama, where judges can override jury recommendations of life sentences in capital cases, they are more likely to do so in election years. “What could explain Alabama judges’ distinctive proclivity for imposing death sentences in cases where a jury has already rejected that penalty?” Justice Sonia Sotomayor asked in a 2013 dissent. “The only answer that is supported by empirical evidence,” she wrote, “is one that, in my view, casts a cloud of illegitimacy over the criminal justice system: Alabama judges, who are elected in partisan proceedings, appear to have succumbed to electoral pressures.” Judicial elections are essentially unknown in the rest of the world. In the federal system, judges are appointed for life, shielding them from political pressure. Electing state-court judges, on the other hand, ensures a measure of popular accountability. That is a conscious choice, rooted in Jacksonian populism. It does what it was intended to do: make judges more responsive to the will of the people. That choice has consequences that may be in tension with Chief Justice Roberts’s wish for “the utmost fairness.” Continue reading the main story What Is ‘Let’s Talk About Gay Sex & Drugs’? Patrick Cash writes candidly for PinkNews about bringing gay men together to talk about the real issues facing their community. Can you remember when you first hit puberty? I was ten-years-old and the other side of the world. Some of my Mum’s family had emigrated to Australia and, after my grandfather died, she’d taken us to visit. It was the end of their summer, and still very hot. We were advised to nap through the strong afternoon sun, and so I was put in a room with closed shutters, lying in a bed beneath mosquito nets. I couldn’t sleep. Whether it was the libido-enhancing sunshine, or if it was being thousands of miles away from home, a box inside my mind had been unlocked and a deluge of men had begun. Tanned, muscular, and all with that 90s ‘curtains’ haircut the Backstreet Boys popularised. I didn’t know how to wank, but rubbing against the mattress felt great, as I guiltily imagined the unzipping of blue jeans. To give credit to my rigidly Catholic upbringing, I valiantly tried to transform the men into beautiful women. Only then the rubbing didn’t feel as good. Over the next couple of years puberty would hit in with a cock-filled vengeance. It was a difficult mental health plateau to navigate for a child who had no concept of ‘gay’, other than the subject of laughter in the playground, and who had been brought up to fear God. I remember making a deal with my own mind that if I allowed myself to temporarily indulge these thoughts about David Beckham, then I would grow up to marry a woman. The idea of telling anybody was terrifying. Throughout the manic masturbation of my teens, and into the ‘wicked’ beginnings of my sex with men, I publicly performed an accepted lust for girls. Gay sex was intertwined with being ‘wrong’. I became extremely depressed. I’d walk into school with my head hanging down. At age fifteen I’d indulge in vivid, non-sexual fantasies about somebody turning up, maybe sitting down next to me on a park bench, and I’d be able to speak to them my truth. Because homophobia was absolute, widespread and socially normalised: for friends, gay was ‘disgusting’, at school it was invisible, and in family it was a sin. This ‘hiding away’ of the self during our most formative years is not uncommon for gay men. Sadly, even for gay children hitting puberty now, I fear it’s the normalised reaction against a societal expectation to be straight. It means growing up with vast amounts of trauma, from which mental health issues may arise: commonly, low self-worth, internalised homophobia, substance abuse, and an over-emphasis on the physical body. I am not trying to cast aspersions on all gay men. But I know I’ve been through a number of these issues myself in my twenties. I’ve felt bad about myself and so put other gay men down, in order to give myself an illusory boost of self-esteem. For years, I hated everything camp about gay culture. I’m still working out my alcohol intake. And when I was using substances for sex, they made what was ‘wrong’, right. Matthew Todd writes eloquently about these issues in his recent book Straight Jacket, and chemsex expert David Stuart has a number of enlightening clips on Youtube. If there are lingering issues with self-esteem from growing up feeling ‘wrong’, then it’s far easier to go to the gym, or buy the latest clothes, or fake tan, and make the outside beautiful, rather than try and untangle the web inside. Here lies the Peter Pan complex too. I went through my period of making the gym my church. It paid off and I’d go into clubs, whip off my top, and know that I’d pull. Yet I rarely saw those guys again, and I began to realise that my whole value to them was based in my body. My thoughts and fears and dreams were not necessary. And I feel that may be true across swathes of the gay scene, from chillouts to Heaven; that we often weigh each other’s worth upon how we look. That’s why we’ve set up a night devoted to simply speaking and listening within the gay community. It’s called Let’s Talk About Gay Sex & Drugs. It’s an open-mic where everyone who wants to speak gets five minutes, but nobody gets more than five minutes. And anybody is welcome to just listen. Ultimately it’s an opportunity to speak what’s inside, to celebrate our true worth, and connect over what we’ve shared. ‘Let’sTalk About Gay Sex & Drugs – Arts’ is on Thursday 6th October from 6.30pm at Ku Klub, 30 Lisle Street, WC2H 7BA, just above Leicester Square tube. Free entry, all welcome. Is Dr Ben Carson Right When He Says a Lot of Men Go into Prison Straight but Come out Gay? My answer to this question on Quora: No, endless studies done over many years have shown that it is impossible to turn truly gay men straight. Not only that, but after age 15, men cannot even be moved on the sexual orientation scale. So you can’t even turn a 10-90 gay man into a 20-80 gay man (first number is heterosexual response as a percentage of maximum and second number is maximum). Obviously if gay men cannot be turned straight, then the opposite is also true. If it works one way, it must work the other way. If gay men can’t turn straight, straight men can’t turn gay. This has been a lot harder to test out because men hardly ever show up in sex clinics wanting to turn from straight to gay. However, there is at least one case in the literature of a straight male college student who desperately wanted to turn gay but nothing was working, so he showed up for therapy. What is not known is if male sexual orientation can be changed before age 15. This would require studies on the sexuality of children, which as you can imagine might be pretty problematic. But science seems pretty clear now that male sexual orientation is fixed at least by age 15. Anecdotally, reports say that straight men who go into prison and have gay sex in prison abandon gay sex when they leave prison and go back to a straight lifestyle.
Monday, 19 September 2016
Wednesday, 31 August 2016
Tuesday, 30 August 2016
Resolve Short URLs To Their Destination URL with PHP (such as T.co, bit.ly & tinyurl.com)
In a few projects I’ve worked on recently, I’ve had to resolve short URLs to their destination URL. This post will show you how to:
Resolve a single URL one level deep.
Resolve a URL in a PHP loop until we reach a page that we deem to be the destination.
Resolve multiple links obtained from a remote source.
Use our own API (with added Malware checks).
Update: An updated and far more user friendly version of this post is scheduled here. Like us on Facebook to be notified of when it’s published.
Keep in mind that we’re only able to determine the destination page if the redirect is provided in the HTTP header. There are other ways of providing a redirect, and this code doesn’t provide for those situation (for example, a JavaScript redirect).
This article should really be read in company with this post, titled “Determine the Status of a Remote Webpage and Retrieve the HTTP Status Code”. Using the header code is a more effective means of determining a redirect.
My requirement was very specific to one of my own little projects, so my rant on this page isn’t for everybody.
I had intended to provide usage details on a fairly comprehensive API but the post got too long. As such, I’ll provide details soon.
Resolving a Single Short URL
If you wanted to resolve a single short URL, you could just use my resolveShortURL() function as follows.
PHP 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Usage
PHP echo resolveShortURL('http://tinyurl.com/internoetics'); 1 echo resolveShortURL('http://tinyurl.com/internoetics');
The following usage will return http://www.internoetics.com/.
Information on the above function is included in the more detailed text below.
Batch Resolving Short URLs
What I’m about to show you is just one way of resolving multiple URLs returned from another source (web page, RSS feed, text file etc). For the purpose of the example, we’ll return an array or URL matches extracted from a Twitter Atom feed with a search term of aviation. For my example I’m using a Twitter feed simply because they’re full of truncated URLs.
Keep in mind that when you’re searching Twitter specifically, you can resolve URLs simply by including Tweet Entities in your JSON request. However, it defeats the purpose of what I’m showing you.
Read more about Twitter Media Entities Tweet Entities . From Twitter: Why Tweet Entities? Tweet text can potentially mention other users or lists, but also contain URLs, media, hashtags… Instead of parsing the text yourself to try to extract those entities, you can use the entities attribute that contains this parsed and structured data.
1. Retrieving the data
The first thing we’ll do is retrieve data from any source: RSS feed, webpage, text file etc.
PHP [:space:]]+[[:alnum:]#?\/&=+%_]/", $data, $match); $list = $match[0]; /* Wrap $list in pre tags print_r($list); 1 2 3 4 5 /* Find All Links in Tweets */ preg_match_all("/(http|https|ftp):\/\/[^<>[:space:]]+[[:alnum:]#?\/&=+%_]/", $data, $match); $list = $match[0]; /* Wrap $list in pre tags print_r($list); 3. Resolve the URL
The next step requires us to follow each short URL and determine where it takes us. First, the function:
PHP /* Resolve Short URL */ function resolveShortURL($url) { $ch = curl_init("$url"); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $yy = curl_exec($ch); curl_close($ch); $w = explode("\n",$yy); /* Want to print the header array? Uncomment below */ // print_r($w); $TheShortURL = in_array_wildcard('Location', $w); $url = $TheShortURL[0]; $url = str_replace("Location:", "", "$url"); $url = trim("$url"); return $url; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 /* Resolve Short URL */ function resolveShortURL($url) { $ch = curl_init("$url"); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $yy = curl_exec($ch); curl_close($ch); $w = explode("\n",$yy); /* Want to print the header array? Uncomment below */ // print_r($w); $TheShortURL = in_array_wildcard('Location', $w); $url = $TheShortURL[0]; $url = str_replace("Location:", "", "$url"); $url = trim("$url"); return $url; }
$w is the header array with redirect info.$TheShortURL returns an array with only the Location.* value.$url is the unshortened destination URL.
The problems with the returned header array ($w, in the example above) is that the URL value isn’t returned in a constant position within the array (in the example below the key is 2 but this can vary from server to server). For this reason, we have to build our own little function to return only the value that includes the (partial) Location value.
Array Location Value
Location URL in returned $w Array
To extract the correct value from the header array, we’ll build our own array wildcard search function.
Wildcard Search in Array
Using PHP’s preg_grep() function, we can match a pattern (i.e. one that includes Location) in the array and return only that match in a new array with a single value.
PHP /* Wildcard Array Search */ function in_array_wildcard ( $needle, $arr ) { return array_values( preg_grep( '/' . str_replace( '*', '.*', $needle ) . '/', $arr ) ); } 1 2 3 4 /* Wildcard Array Search */ function in_array_wildcard ( $needle, $arr ) { return array_values( preg_grep( '/' . str_replace( '*', '.*', $needle ) . '/', $arr ) ); }
We’ll obtain the Location: $url match by using our array wildcard function as follows.
PHP $MatchesArray = in_array_wildcard('Location', $w); 1 $MatchesArray = in_array_wildcard('Location', $w);
The Wildcard Array search is a worthy snippet in itself. It could be modified and used as an alternative to the problem I faced with my ‘administrative_area_level_1’ search function as described in my ‘Google State/City’ post.
If we were to print the newly returned $MatchesArray, it would return the following:
Array ( [0] => Location: http://bit.ly/OVxxxx )
In the same function that we made the cURL request, we simply use $url = trim(str_replace("Location:", "", "$url")); to remove Location: from the returned data, leaving us with just the URL. You could just as easily use an expression to find and return a URL match.
For my purposes, I only wanted to iterate over the returned URL matches ($list, from our Twitter search) only two levels deep (since a short URL can often send you to yet another short URL). If you wanted to follow truncated URLs indefinitely, you’d loop over the matches until you identified a URL that wasn’t deemed to be a short URL. If you chose this route you would want to make sure you added protection to avoid an infinite loop (by ceasing requests after ‘n’ attemps or on finding a repeated URL).
How do we know if the URL we’re sent to is a short URL?
There are a number of ways of doing this. First, we could read the header data from the remote page (using code provided here) and determine if it wants to send us somewhere else. Basically, any 3XX header code suggests some kind of redirect. What I’m personally doing personally is reading the header data for a redirect Location URL and comparing it against an array of top URL shorteners. Keep in mind that my application required this… you probably wouldn’t want to limit yourself to known services unless you had that specific need.
I’ve created an array for my own use that contains about 300 URL shorteners (available in the download). Here’s an example with just the better known truncating services.
PHP /* Array of top URL shorteners */ $urlArray = array("tiny.cc", "is.gd", "own.ly", "rubyurl.com", "bit.ly", "tinyurl.com", "moourl.com", "cli.gs", "ka.lm", "u.nu", "yep.it", "shrten.com", "miniurl.com", "snipurl.com", "short.ie", "idek.net", "w3t.org", "shiturl.com", "dwarfurl.com", "doiop.com", "smallurl.in", "notlong.com", "fyad.org", "safe.mn", "hex.io", "own.ly", "lnkd.in", "fb.me", "amzn.to", "goo.gl", "j.mp", "mcaf.ee", "lnk.ms", "youtu.be", "wp.me", "fwd4.me", "su.pr", "t.co", "snurl.com", "tr.im", "twurl.cc", "fat.ly"); 1 2 /* Array of top URL shorteners */ $urlArray = array("tiny.cc", "is.gd", "own.ly", "rubyurl.com", "bit.ly", "tinyurl.com", "moourl.com", "cli.gs", "ka.lm", "u.nu", "yep.it", "shrten.com", "miniurl.com", "snipurl.com", "short.ie", "idek.net", "w3t.org", "shiturl.com", "dwarfurl.com", "doiop.com", "smallurl.in", "notlong.com", "fyad.org", "safe.mn", "hex.io", "own.ly", "lnkd.in", "fb.me", "amzn.to", "goo.gl", "j.mp", "mcaf.ee", "lnk.ms", "youtu.be", "wp.me", "fwd4.me", "su.pr", "t.co", "snurl.com", "tr.im", "twurl.cc", "fat.ly");
To determine if the remote page will send us to another URL shortener, I’m using another function to get only the domain name from the full URL address that I compare to the values in the $urlArray.
PHP /* Find domain from URL */ function stripit ( $url ) { $url = trim($url); $url = preg_replace("/^(http:\/\/)*(www.)*/is", "", $url); $url = preg_replace("/\/.*$/is" , "" ,$url); return $url; } 1 2 3 4 5 6 7 /* Find domain from URL */ function stripit ( $url ) { $url = trim($url); $url = preg_replace("/^(http:\/\/)*(www.)*/is", "", $url); $url = preg_replace("/\/.*$/is" , "" ,$url); return $url; }
For example, http://bit.ly/OVxxxx becomes bit.ly. We then compare bit.ly with the $urlArray to determine if there’s a match. In this particular case, and since there’s a match in $urlArray, we’ll resolve the initial URL.
Important: In the case of Twitter, all their URLs are masked by their own t.co shortener. If you were resolving multiple URLs that included non-short URLs, you should compare every returned URL match against our short URL array so you didn’t try and resolve a normal web address (otherwise it’ll return nothing).
4. Iterate over the URL Matches
We now loop over all the returned URLs (from the $list array) and apply the function resolveShortURL() to determine where it takes us. For each URL, we’ll apply the stripit() function to return a raw URL, and then we’ll compare that value against our $urlArray. If the URL exists in our known list of shorteners, we’ll resolve that URL as well.
In my little example below I’ll print each URL as a link on a new line (with the raw URL as the link text).
PHP foreach ($list AS $url_id) { if (!isset($Turl[$url_id])) { $Turl[$url_id]=true; $url_id_1 = resolveShortURL($url_id); $url_id_1_s = stripit($url_id_1); if (in_array("$url_id_1_s", $urlArray)) { $url_id_2 = resolveShortURL($url_id_1); $url_id_2_s = stripit($url_id_2); echo "$url_id -> $url_id_1_s -> $url_id_2_s
"; } else { echo "$url_id -> $url_id_1_s
"; } } } ?> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 foreach ($list AS $url_id) { if (!isset($Turl[$url_id])) { $Turl[$url_id]=true; $url_id_1 = resolveShortURL($url_id); $url_id_1_s = stripit($url_id_1); if (in_array("$url_id_1_s", $urlArray)) { $url_id_2 = resolveShortURL($url_id_1); $url_id_2_s = stripit($url_id_2); echo "$url_id -> $url_id_1_s -> $url_id_2_s
"; } else { echo "$url_id -> $url_id_1_s
"; } } } ?> Of course, if you were searching a source other than a Twitter feed or a known list of truncated URLs, you should first confirm that the URL you’re following is indeed a short URL. Checking against our $urlArray or reading the destination page headers are two good ways of accomplishing this. It’s a fairly intensive process to resolve multiple addresses so you may want to consider putting a limit on the number of URLs you resolve. Resolving URLs in a Loop In my example above, I’ve only resolved the URL two levels deep. What about if you had multiple (inefficient) URLs bouncing around the web before you landed on the actual destination page? For example, if you follow this snipr short URL, it will redirect to shnk.me, ow.ly, bit.ly and, finally, tinyurl before it lands on this site. I use the following code in a function to resolve a short URL for as long as I need to (and as long as the short URL service used is in our $urlArray). Comment out line 13 if you don’t want to print the values on your screen. Again, I only compare against my own array of known shorteners because of the application I was involved with. In reality, you’d follow a link almos indefinitely based entirely on the header that’s provided. PHP "; $url = $resolvedURL; } else { $resolvedURL = $url; $i = false; } } ?> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 "; $url = $resolvedURL; } else { $resolvedURL = $url; $i = false; } } ?> This will create an array of all the redirects. To print the array: PHP /* Wrap in pre tags */ print_r($domArray); 1 2 /* Wrap in pre tags */ print_r($domArray); Returns: PHP Array ( [0] => http://snipr.com/24qhrj5 [1] => http://shnk.me/73553 [2] => http://ow.ly/d8WUp [3] => http://bit.ly/SlrMDl [4] => http://tinyurl.com/internoetics [5] => http://www.internoetics.com ) 1 2 3 4 5 6 7 8 9 Array ( [0] => http://snipr.com/24qhrj5 [1] => http://shnk.me/73553 [2] => http://ow.ly/d8WUp [3] => http://bit.ly/SlrMDl [4] => http://tinyurl.com/internoetics [5] => http://www.internoetics.com ) To get the destination URL, use: PHP echo end($domArray); 1 echo end($domArray); Returns: http://www.internoetics.com. Other Applications I mentioned that I’m using the feature to resolve short URLs on a few different projects – here’s just one. On a Usenet site I’ve mentioned a few times, it’s not uncommon for unscrupulous marketers or those with less than honourable intent to post malicious links. In their raw form, short URL’s don’t offer any protection against those that click on links from unknown sources. What I’ve done (in a new unreleased version of the site) is resolve all ‘known’ short URLs and print them partially to provide some idea of the destination. Short URLs were actually invented for Usenet; more specifically, a random unicycle newsgroup. They’re an intrinsic part of the Usenet experience because they eliminate long and messy URLs wrapping or breaking over multiple lines. In my case, I didn’t want to hijack the short URL but I did want to print the long URL in one form or another as a measure of protection. Using the function provided here I’ll break apart the destination URL into two halves once I’ve determined where it takes us. It means I can construct a link that retains the short URL as the link but replaces the actual link text with a semi-truncated URL. Since I parse all links into active HTML links on my other site, I’m not yet sure if I’ll provide the destination URL as a title tag (so it displays when you mouse over the link) or whether I’ll use the resolved URL (in a very truncated form) as the primary text but retain the link to the short URL. For example, consider this block of text: This is example text only. I’ll include a couple of links like this one http://fat.ly/flight4 and this one http://fat.ly/flight5 – both podcasts from Flight Podcast. Using the first technique I described, the above text would render on the screen like this (note the active link remains a short URL): This is example text only. I’ll include a couple of links like this one http://www.flightpodcast.com/episo…ehran and this one http://www.flightpodcast.com/episo…-king – both podcasts from Flight Podcast. Another option is to simply partially render the destination page in brackets alongside the URL. Either way, it offers some measure of link protection. Removing Linkrot I also want to remove dead or incorrect links on another site should those links no longer exists (or if they are deemed to include malicious code). Using techniques described on this page I can determine at various intervals if the page exists or not. If it doesn’t, I can replace it with plain text indicating why the link isn’t active. Long URL API Since I’m resolving short URLs on so many sites (for both myself and clients), I figured I should build a quick API for easy implementation. I wanted to include, at the very least, the following: Resolve short URL to a final destination, regardless of how many links we have to jump. Return the Long URL. Check the Long URL against the main malware databases – including Google’s constantly updated lists of suspected phishing and malware pages. I wanted to return a truncated long URL link but with the short URL as anchor text (a few people have asked for this). Return the title and, perhaps, other details from the destination page. Provide XML, JSON and text options. I’d ideally like to include a link to an image snapshot of the destination page… but that can wait (as can all the other funky stuff I’d like to include). I’ll post details another time. Shortt URL for this post: Front-End Author Listing And User Search For WordPress This article will guide you through the process of creating a front-end page in WordPress that lists your authors. We’ll discuss why you would want to do this, we’ll introduce the WP_User_Query class, and then we’ll put it it all together. User Engagement And WordPress Link At its core, WordPress is a rock-solid publishing platform. With a beautiful and easy to use interface, and support for custom post types and post formats, publishers have the flexibility to do what they do best: write content. However, WordPress is lacking in social interaction between content authors and readers. BuddyPress is trying to solve this, but I believe it’s going in the wrong direction by trying to be a full-fledged social network. A big phrase in the publishing world is “user engagement.” This is about getting readers to spend more time on the website, actively searching for content and even generating their own. While one could write a few books on the subject, here are a few things a WordPress publisher can do: Create a daily or weekly newsletter, with top stories from selected categories; Provide an editorial-driven open forum in which editors propose themes, stories and questions and readers comment on them; Continue the discussion of articles on social platforms; Encourage users to submit articles and images for contests; Highlight your authors. Listing Authors, And Why It’s A Good Thing Link user-listing1 If you’re a publisher, your authors are your biggest asset. They are the content creators. Their writing gets consumed by millions of people all over the world. Showcasing them exposes them for what they really are: authorities. Your authors will thank you for acknowledging them, and readers will get to see the human face behind the technology. Coding The Perfect Author Listing Link Here are the things we want to achieve with our page: Build it as a WordPress plugin so that we can reuse it more easily; Display the name, biography, number of posts and latest published post of all authors; Paginate the listing if we have many authors; Make the listing searchable. Introducing WP_User_Query And get_users Link The WP_User_Query2 class allows us to query the user database. Besides returning an array of users, WP_User_Query returns general information about the query and, most importantly, the total number of users (for pagination). One can use WP_User_Query by passing a series of arguments and listing the output. $my_authors = new WP_User_Query( array( 'blog_id' => $GLOBALS['blog_id'], 'role' => '', 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'include' => array(), 'exclude' => array(), 'search' => '', 'orderby' => 'login', 'order' => 'ASC', 'offset' => '', 'number' => '', 'count_total' => true, 'fields' => 'all', 'who' => '' )); We’ll focus on only a few arguments, rather than go through all of them: roleThis is the user’s role. In our example, we’ll query for author. offsetThe first n users to be skipped in the returned array. numberLimit the total number of users returned. We also have the get_users3 class, which (like WP_User_Query) returns a number of users based on the parameters set. The important difference between the two is that get_users only returns an array of users and their meta data, whereas WP_User_Query returns extra information such as the total number of users (which is useful when it comes time to paginate). Simple User Listing Using get_users() Link Before moving on with the full user listing, including pagination and search, let’s see get_users in action. If all you need is a simple list of authors, then you could just use wp_list_authors4, like so: wp_list_authors('show_fullname=1&optioncount=1&orderby=post_count&order=DESC&number=3'); Creating A Plugin And Shortcode With A Bit More Functionality Link A simple and straightforward way to build our user listing would be to create a shortcode that we could include on any page we like. Housing this type of functionality in a plugin is ideal, so that we don’t have to worry about migrating it when we change the theme. Let’s keep it simple. Our entire plugin will consist of just one file: simple-user-listing.php. '', "number" => '10' ), $atts)); $role = sanitize_text_field($role); $number = sanitize_text_field($number); // We're outputting a lot of HTML, and the easiest way // to do it is with output buffering from PHP. ob_start(); // Get the Search Term $search = ( isset($_GET["as"]) ) ? sanitize_text_field($_GET["as"]) : false ; // Get Query Var for pagination. This already exists in WordPress $page = (get_query_var('paged')) ? get_query_var('paged') : 1; // Calculate the offset (i.e. how many users we should skip) $offset = ($page - 1) * $number; if ($search){ // Generate the query based on search field $my_users = new WP_User_Query( array( 'role' => $role, 'search' => '*' . $search . '*' )); } else { // Generate the query $my_users = new WP_User_Query( array( 'role' => 'author', 'offset' => $offset , 'number' => $number )); } // Get the total number of authors. Based on this, offset and number // per page, we'll generate our pagination. $total_authors = $my_users->total_users; // Calculate the total number of pages for the pagination $total_pages = intval($total_authors / $number) + 1; // The authors object. $authors = $my_users->get_results(); ?>
Breaking Down The Code Link The top of our plugin’s main PHP file must contain the standard header of information. This header tells WordPress that our plugin exists, and it adds it to the plugin management screen so that it can be activated, loaded and run. /* Plugin Name: Simple User Listing Plugin URI: http://cozmoslabs.com Description: Create a simple shortcode to list our WordPress users. Author: Cristian Antohe Version: 0.1 Author URI: http://cozmoslabs.com */ Creating a Shortcode Link Adding a new shortcode in WordPress is rather easy. We find the function that returns the desired output (in our case, sul_user_listing), and then we add it using the add_shortcode WordPress function. function sul_user_listing($atts, $content = null) { // return our output } add_shortcode('userlisting', 'sul_user_listing'); We want to be able to list users based on their roles and to control how many users are displayed on the page. We do this through shortcode arguments. We’ll add the shortcode to our theme in this way: [userlisting role="author" number="15"]. This will allow us to reuse the plugin to list our subscribers as well. To do this, we need to use shortcode arguments: extract(shortcode_atts(array( "role" => '', "number" => '10' ), $atts)); The extract function imports variables into our function from an array. The WordPress function shortcode_atts basically returns an array with our arguments; and we’ll set up some defaults in case none are found. Note that the role default is an empty string, which would list all users regardless of their role. Shortcodes Should Never Echo Stuff Out Link The return value of a shortcode handler function gets inserted into the post content’s output in place of the shortcode. You should use return and not echo; anything that is echoed will be outputted to the browser but will probably appear above everything else. You would also probably get “headers already sent” type of errors. For simplicity, we’re buffering the output through ob_start(), so we put everything into an object and return it once we’re done. Setting Up Our Variables Link Now we can start building our listing of authors. First, we need to set up a few variables: $searchThis takes the GET parameter as if it exists. $pageThe get_query_var for the pagination. This already exists in WordPress. $offsetCalculate the offset (i.e. how many users to skip when paginating). $total_authorsGet the total number of authors. $total_pagesCalculate the total number of pages for the pagination. The Query Link We actually have two queries: the default listing and the search results. if ($search){ // Generate the query based on search field $my_users = new WP_User_Query( array( 'role' => $role, 'search' => '*' . $search . '*' )); } else { // Generate the query $my_users = new WP_User_Query( array( 'role' => 'author', 'offset' => $offset , 'number' => $number )); } WP_User_Query->total_users and WP_User_Query->get_results Link WP_User_Query provides us with two useful functions, among others: total_usersReturns the total number of authors. This, the offset and the number of users per page will generate our pagination. get_resultsReturns an object with the authors alone. This is similar to what get_users() returns. The Search Form Link For the search, we’re using a simple form. There’s nothing complex here.
User Data and Listing the Authors Link Looping through our results is fairly simple. However, getting information about users is a bit confusing in WordPress. You see, there are a lot of ways to get user data. We could get it directly from the returned query; we could use general functions such as get_userdata, get_user_meta, the_author_meta and get_the_author_meta; or we could even use dedicated functions such as the_author_link and the_author_posts. We’ll just use get_userdata plus two other functions: get_author_posts_url and get_avatar.
Final Thoughts Link We’ve discussed the code for an authors listing, but it has so many more uses: List your company’s employees; Showcase users who have won a competition (by listing users with the role of “winners”); Present your company’s departments, each with its respective team (based on user roles). If you allow users to register on your website, you could use more or less the same code to generate any listing of users based on your needs. If you require users to log in in order to comment (an effective way to stop automated spam), then listing users and their number of comments could increase engagement. Have you used something similar for a project? If so, let us know in the comments! (al) 1 https://www.smashingmagazine.com/wp-content/uploads/2012/05/user-listing1.jpg 2 http://codex.wordpress.org/Class_Reference/WP_User_Query 3 http://codex.wordpress.org/Function_Reference/get_users 4 http://codex.wordpress.org/Function_Reference/wp_list_authors ↑ Back to top Tweet itShare on Facebook Advertisement NHC Experimental Gridded Marine Forecasts The NHC/TAFB gridded marine forecasts are now available on an experimental basis in the National Digital Forecast Database (NDFD). Gridded forecasts of marine weather elements are available over the TAFB high seas forecast area of responsibility (AOR), which also includes the offshore waters forecast AOR. The gridded marine parameters include: surface (10-m) wind speeds with direction surface (10-m) wind gusts significant wave heights marine hazards These elements are available at a spatial resolution of 10 km for TAFB. The data have an initial temporal resolution of six (6) hours out to 144 hours or six (6) days. Plans are to eventually move toward a temporal resolution of 3 hours for all the marine centers contributing to the NDFD. The grids are produced by forecasters through the AWIPS Graphical Forecast Editor (GFE) and should be available by 0330, 0930, 1530, and 2130 UTC each day. With this implementation, forecasts for these elements are available from NDFD in the following standard methods: Gridded Binary Version 2 (GRIB2) files via Hypertext Transfer Protocol (HTTP) and File Transfer Protocol (FTP) Extensible Markup Language (XML) via Simple Object Access Protocol (SOAP) Graphics via web browser More details regarding this experimental service are available in the Product Description Document from the online catalog of experimental NWS products and services. Please see the public information statement for additional information. View Graphical Forecasts Click on a geographic location of interest to launch the interactive map. The marine forecast images are also available via the experimental NDFD graphical interface. Select the "Oceanic" option to view wind speed, wind gusts, significant wave heights, and hazards for the National Hurricane Center, Ocean Prediction Center, CONUS, Alaska, Hawaii, and Guam areas of responsibility. Access Gridded Data The NDFD oceanic domain covers the Atlantic, Pacific, and Arctic basins for the offices issuing offshore waters and high seas forecasts. The upper right lat, lon for this grid is: 79.99N, 10.71E. The lower left corner lies directly on an NCEP grid 204 point, which coincides with all other Pacific region NDFD grids. The lower left lat, lon for this grid is 30.42S, 129.91E. Specific information on the NDFD grid domains, including the oceanic domain, can be found at http://graphical.weather.gov/docs/ndfdSRS.htm. Technical information on accessing and using NDFD elements can be found at http://ndfd.weather.gov/technical.htm. The GRIB2 marine data on the NDFD oceanic domain can be downloaded at the following locations: Note: Areas of the NDFD oceanic domain that coincide with the NDFD CONUS domain are included in the CONUS grids as well. Use the NDFD technical page to find access to the CONUS GRIB2 files. Comments & Feedback The marine elements will remain experimental until the NWS assesses feedback and completes a technical analysis. At that time, the NWS will determine whether to move these experimental elements to operational status, discontinue them, or revise and extend the experimental feedback period. Comments and feedback on the experimental TAFB Offshore and High Seas NDFD elements, as well as the OPC Offshore elements, are welcome at:http://www.nws.noaa.gov/survey/nws-survey.php?code=EGOSWHSMF General feedback on NDFD GRIB2 service:http://www.weather.gov/survey/nws-survey.php?code=ndfd-grids General feedback on NDFD XML SOAP service:http://www.weather.gov/survey/nws-survey.php?code=xmlsoap General feedback on the experimental NDFD map viewer:http://www.weather.gov/survey/nws-survey.php?code=wxmap
"; } else { echo "$url_id -> $url_id_1_s
"; } } } ?> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 foreach ($list AS $url_id) { if (!isset($Turl[$url_id])) { $Turl[$url_id]=true; $url_id_1 = resolveShortURL($url_id); $url_id_1_s = stripit($url_id_1); if (in_array("$url_id_1_s", $urlArray)) { $url_id_2 = resolveShortURL($url_id_1); $url_id_2_s = stripit($url_id_2); echo "$url_id -> $url_id_1_s -> $url_id_2_s
"; } else { echo "$url_id -> $url_id_1_s
"; } } } ?> Of course, if you were searching a source other than a Twitter feed or a known list of truncated URLs, you should first confirm that the URL you’re following is indeed a short URL. Checking against our $urlArray or reading the destination page headers are two good ways of accomplishing this. It’s a fairly intensive process to resolve multiple addresses so you may want to consider putting a limit on the number of URLs you resolve. Resolving URLs in a Loop In my example above, I’ve only resolved the URL two levels deep. What about if you had multiple (inefficient) URLs bouncing around the web before you landed on the actual destination page? For example, if you follow this snipr short URL, it will redirect to shnk.me, ow.ly, bit.ly and, finally, tinyurl before it lands on this site. I use the following code in a function to resolve a short URL for as long as I need to (and as long as the short URL service used is in our $urlArray). Comment out line 13 if you don’t want to print the values on your screen. Again, I only compare against my own array of known shorteners because of the application I was involved with. In reality, you’d follow a link almos indefinitely based entirely on the header that’s provided. PHP "; $url = $resolvedURL; } else { $resolvedURL = $url; $i = false; } } ?> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 "; $url = $resolvedURL; } else { $resolvedURL = $url; $i = false; } } ?> This will create an array of all the redirects. To print the array: PHP /* Wrap in pre tags */ print_r($domArray); 1 2 /* Wrap in pre tags */ print_r($domArray); Returns: PHP Array ( [0] => http://snipr.com/24qhrj5 [1] => http://shnk.me/73553 [2] => http://ow.ly/d8WUp [3] => http://bit.ly/SlrMDl [4] => http://tinyurl.com/internoetics [5] => http://www.internoetics.com ) 1 2 3 4 5 6 7 8 9 Array ( [0] => http://snipr.com/24qhrj5 [1] => http://shnk.me/73553 [2] => http://ow.ly/d8WUp [3] => http://bit.ly/SlrMDl [4] => http://tinyurl.com/internoetics [5] => http://www.internoetics.com ) To get the destination URL, use: PHP echo end($domArray); 1 echo end($domArray); Returns: http://www.internoetics.com. Other Applications I mentioned that I’m using the feature to resolve short URLs on a few different projects – here’s just one. On a Usenet site I’ve mentioned a few times, it’s not uncommon for unscrupulous marketers or those with less than honourable intent to post malicious links. In their raw form, short URL’s don’t offer any protection against those that click on links from unknown sources. What I’ve done (in a new unreleased version of the site) is resolve all ‘known’ short URLs and print them partially to provide some idea of the destination. Short URLs were actually invented for Usenet; more specifically, a random unicycle newsgroup. They’re an intrinsic part of the Usenet experience because they eliminate long and messy URLs wrapping or breaking over multiple lines. In my case, I didn’t want to hijack the short URL but I did want to print the long URL in one form or another as a measure of protection. Using the function provided here I’ll break apart the destination URL into two halves once I’ve determined where it takes us. It means I can construct a link that retains the short URL as the link but replaces the actual link text with a semi-truncated URL. Since I parse all links into active HTML links on my other site, I’m not yet sure if I’ll provide the destination URL as a title tag (so it displays when you mouse over the link) or whether I’ll use the resolved URL (in a very truncated form) as the primary text but retain the link to the short URL. For example, consider this block of text: This is example text only. I’ll include a couple of links like this one http://fat.ly/flight4 and this one http://fat.ly/flight5 – both podcasts from Flight Podcast. Using the first technique I described, the above text would render on the screen like this (note the active link remains a short URL): This is example text only. I’ll include a couple of links like this one http://www.flightpodcast.com/episo…ehran and this one http://www.flightpodcast.com/episo…-king – both podcasts from Flight Podcast. Another option is to simply partially render the destination page in brackets alongside the URL. Either way, it offers some measure of link protection. Removing Linkrot I also want to remove dead or incorrect links on another site should those links no longer exists (or if they are deemed to include malicious code). Using techniques described on this page I can determine at various intervals if the page exists or not. If it doesn’t, I can replace it with plain text indicating why the link isn’t active. Long URL API Since I’m resolving short URLs on so many sites (for both myself and clients), I figured I should build a quick API for easy implementation. I wanted to include, at the very least, the following: Resolve short URL to a final destination, regardless of how many links we have to jump. Return the Long URL. Check the Long URL against the main malware databases – including Google’s constantly updated lists of suspected phishing and malware pages. I wanted to return a truncated long URL link but with the short URL as anchor text (a few people have asked for this). Return the title and, perhaps, other details from the destination page. Provide XML, JSON and text options. I’d ideally like to include a link to an image snapshot of the destination page… but that can wait (as can all the other funky stuff I’d like to include). I’ll post details another time. Shortt URL for this post: Front-End Author Listing And User Search For WordPress This article will guide you through the process of creating a front-end page in WordPress that lists your authors. We’ll discuss why you would want to do this, we’ll introduce the WP_User_Query class, and then we’ll put it it all together. User Engagement And WordPress Link At its core, WordPress is a rock-solid publishing platform. With a beautiful and easy to use interface, and support for custom post types and post formats, publishers have the flexibility to do what they do best: write content. However, WordPress is lacking in social interaction between content authors and readers. BuddyPress is trying to solve this, but I believe it’s going in the wrong direction by trying to be a full-fledged social network. A big phrase in the publishing world is “user engagement.” This is about getting readers to spend more time on the website, actively searching for content and even generating their own. While one could write a few books on the subject, here are a few things a WordPress publisher can do: Create a daily or weekly newsletter, with top stories from selected categories; Provide an editorial-driven open forum in which editors propose themes, stories and questions and readers comment on them; Continue the discussion of articles on social platforms; Encourage users to submit articles and images for contests; Highlight your authors. Listing Authors, And Why It’s A Good Thing Link user-listing1 If you’re a publisher, your authors are your biggest asset. They are the content creators. Their writing gets consumed by millions of people all over the world. Showcasing them exposes them for what they really are: authorities. Your authors will thank you for acknowledging them, and readers will get to see the human face behind the technology. Coding The Perfect Author Listing Link Here are the things we want to achieve with our page: Build it as a WordPress plugin so that we can reuse it more easily; Display the name, biography, number of posts and latest published post of all authors; Paginate the listing if we have many authors; Make the listing searchable. Introducing WP_User_Query And get_users Link The WP_User_Query2 class allows us to query the user database. Besides returning an array of users, WP_User_Query returns general information about the query and, most importantly, the total number of users (for pagination). One can use WP_User_Query by passing a series of arguments and listing the output. $my_authors = new WP_User_Query( array( 'blog_id' => $GLOBALS['blog_id'], 'role' => '', 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 'include' => array(), 'exclude' => array(), 'search' => '', 'orderby' => 'login', 'order' => 'ASC', 'offset' => '', 'number' => '', 'count_total' => true, 'fields' => 'all', 'who' => '' )); We’ll focus on only a few arguments, rather than go through all of them: roleThis is the user’s role. In our example, we’ll query for author. offsetThe first n users to be skipped in the returned array. numberLimit the total number of users returned. We also have the get_users3 class, which (like WP_User_Query) returns a number of users based on the parameters set. The important difference between the two is that get_users only returns an array of users and their meta data, whereas WP_User_Query returns extra information such as the total number of users (which is useful when it comes time to paginate). Simple User Listing Using get_users() Link Before moving on with the full user listing, including pagination and search, let’s see get_users in action. If all you need is a simple list of authors, then you could just use wp_list_authors4, like so: wp_list_authors('show_fullname=1&optioncount=1&orderby=post_count&order=DESC&number=3'); Creating A Plugin And Shortcode With A Bit More Functionality Link A simple and straightforward way to build our user listing would be to create a shortcode that we could include on any page we like. Housing this type of functionality in a plugin is ideal, so that we don’t have to worry about migrating it when we change the theme. Let’s keep it simple. Our entire plugin will consist of just one file: simple-user-listing.php. '', "number" => '10' ), $atts)); $role = sanitize_text_field($role); $number = sanitize_text_field($number); // We're outputting a lot of HTML, and the easiest way // to do it is with output buffering from PHP. ob_start(); // Get the Search Term $search = ( isset($_GET["as"]) ) ? sanitize_text_field($_GET["as"]) : false ; // Get Query Var for pagination. This already exists in WordPress $page = (get_query_var('paged')) ? get_query_var('paged') : 1; // Calculate the offset (i.e. how many users we should skip) $offset = ($page - 1) * $number; if ($search){ // Generate the query based on search field $my_users = new WP_User_Query( array( 'role' => $role, 'search' => '*' . $search . '*' )); } else { // Generate the query $my_users = new WP_User_Query( array( 'role' => 'author', 'offset' => $offset , 'number' => $number )); } // Get the total number of authors. Based on this, offset and number // per page, we'll generate our pagination. $total_authors = $my_users->total_users; // Calculate the total number of pages for the pagination $total_pages = intval($total_authors / $number) + 1; // The authors object. $authors = $my_users->get_results(); ?>
- ID); ?>
- ID, 90 ); ?>
display_name; ?> - ID ); ?> posts
description; ?>
ID&post_count=1" ); if (!empty($latest_post->post)){ ?> Latest Article: post->ID) ;?>
Read display_name; ?> posts
No authors found
Breaking Down The Code Link The top of our plugin’s main PHP file must contain the standard header of information. This header tells WordPress that our plugin exists, and it adds it to the plugin management screen so that it can be activated, loaded and run. /* Plugin Name: Simple User Listing Plugin URI: http://cozmoslabs.com Description: Create a simple shortcode to list our WordPress users. Author: Cristian Antohe Version: 0.1 Author URI: http://cozmoslabs.com */ Creating a Shortcode Link Adding a new shortcode in WordPress is rather easy. We find the function that returns the desired output (in our case, sul_user_listing), and then we add it using the add_shortcode WordPress function. function sul_user_listing($atts, $content = null) { // return our output } add_shortcode('userlisting', 'sul_user_listing'); We want to be able to list users based on their roles and to control how many users are displayed on the page. We do this through shortcode arguments. We’ll add the shortcode to our theme in this way: [userlisting role="author" number="15"]. This will allow us to reuse the plugin to list our subscribers as well. To do this, we need to use shortcode arguments: extract(shortcode_atts(array( "role" => '', "number" => '10' ), $atts)); The extract function imports variables into our function from an array. The WordPress function shortcode_atts basically returns an array with our arguments; and we’ll set up some defaults in case none are found. Note that the role default is an empty string, which would list all users regardless of their role. Shortcodes Should Never Echo Stuff Out Link The return value of a shortcode handler function gets inserted into the post content’s output in place of the shortcode. You should use return and not echo; anything that is echoed will be outputted to the browser but will probably appear above everything else. You would also probably get “headers already sent” type of errors. For simplicity, we’re buffering the output through ob_start(), so we put everything into an object and return it once we’re done. Setting Up Our Variables Link Now we can start building our listing of authors. First, we need to set up a few variables: $searchThis takes the GET parameter as if it exists. $pageThe get_query_var for the pagination. This already exists in WordPress. $offsetCalculate the offset (i.e. how many users to skip when paginating). $total_authorsGet the total number of authors. $total_pagesCalculate the total number of pages for the pagination. The Query Link We actually have two queries: the default listing and the search results. if ($search){ // Generate the query based on search field $my_users = new WP_User_Query( array( 'role' => $role, 'search' => '*' . $search . '*' )); } else { // Generate the query $my_users = new WP_User_Query( array( 'role' => 'author', 'offset' => $offset , 'number' => $number )); } WP_User_Query->total_users and WP_User_Query->get_results Link WP_User_Query provides us with two useful functions, among others: total_usersReturns the total number of authors. This, the offset and the number of users per page will generate our pagination. get_resultsReturns an object with the authors alone. This is similar to what get_users() returns. The Search Form Link For the search, we’re using a simple form. There’s nothing complex here.
User Data and Listing the Authors Link Looping through our results is fairly simple. However, getting information about users is a bit confusing in WordPress. You see, there are a lot of ways to get user data. We could get it directly from the returned query; we could use general functions such as get_userdata, get_user_meta, the_author_meta and get_the_author_meta; or we could even use dedicated functions such as the_author_link and the_author_posts. We’ll just use get_userdata plus two other functions: get_author_posts_url and get_avatar.
- ID); ?>
- ID, 90 ); ?>
display_name; ?> - ID ); ?> posts
description; ?>
ID&post_count=1" ); if (!empty($latest_post->post)){ ?> Latest Article: post->ID) ;?>
Read display_name; ?> posts
No authors found
We need pagination because each listing will generate two extra queries. So, if we were listing 100 people, we would end up with 200 extra queries per page. That’s a bit much, so pagination is really needed. Otherwise, for websites with many authors, the load could get so heavy that it brings down the website.Final Thoughts Link We’ve discussed the code for an authors listing, but it has so many more uses: List your company’s employees; Showcase users who have won a competition (by listing users with the role of “winners”); Present your company’s departments, each with its respective team (based on user roles). If you allow users to register on your website, you could use more or less the same code to generate any listing of users based on your needs. If you require users to log in in order to comment (an effective way to stop automated spam), then listing users and their number of comments could increase engagement. Have you used something similar for a project? If so, let us know in the comments! (al) 1 https://www.smashingmagazine.com/wp-content/uploads/2012/05/user-listing1.jpg 2 http://codex.wordpress.org/Class_Reference/WP_User_Query 3 http://codex.wordpress.org/Function_Reference/get_users 4 http://codex.wordpress.org/Function_Reference/wp_list_authors ↑ Back to top Tweet itShare on Facebook Advertisement NHC Experimental Gridded Marine Forecasts The NHC/TAFB gridded marine forecasts are now available on an experimental basis in the National Digital Forecast Database (NDFD). Gridded forecasts of marine weather elements are available over the TAFB high seas forecast area of responsibility (AOR), which also includes the offshore waters forecast AOR. The gridded marine parameters include: surface (10-m) wind speeds with direction surface (10-m) wind gusts significant wave heights marine hazards These elements are available at a spatial resolution of 10 km for TAFB. The data have an initial temporal resolution of six (6) hours out to 144 hours or six (6) days. Plans are to eventually move toward a temporal resolution of 3 hours for all the marine centers contributing to the NDFD. The grids are produced by forecasters through the AWIPS Graphical Forecast Editor (GFE) and should be available by 0330, 0930, 1530, and 2130 UTC each day. With this implementation, forecasts for these elements are available from NDFD in the following standard methods: Gridded Binary Version 2 (GRIB2) files via Hypertext Transfer Protocol (HTTP) and File Transfer Protocol (FTP) Extensible Markup Language (XML) via Simple Object Access Protocol (SOAP) Graphics via web browser More details regarding this experimental service are available in the Product Description Document from the online catalog of experimental NWS products and services. Please see the public information statement for additional information. View Graphical Forecasts Click on a geographic location of interest to launch the interactive map. The marine forecast images are also available via the experimental NDFD graphical interface. Select the "Oceanic" option to view wind speed, wind gusts, significant wave heights, and hazards for the National Hurricane Center, Ocean Prediction Center, CONUS, Alaska, Hawaii, and Guam areas of responsibility. Access Gridded Data The NDFD oceanic domain covers the Atlantic, Pacific, and Arctic basins for the offices issuing offshore waters and high seas forecasts. The upper right lat, lon for this grid is: 79.99N, 10.71E. The lower left corner lies directly on an NCEP grid 204 point, which coincides with all other Pacific region NDFD grids. The lower left lat, lon for this grid is 30.42S, 129.91E. Specific information on the NDFD grid domains, including the oceanic domain, can be found at http://graphical.weather.gov/docs/ndfdSRS.htm. Technical information on accessing and using NDFD elements can be found at http://ndfd.weather.gov/technical.htm. The GRIB2 marine data on the NDFD oceanic domain can be downloaded at the following locations: Note: Areas of the NDFD oceanic domain that coincide with the NDFD CONUS domain are included in the CONUS grids as well. Use the NDFD technical page to find access to the CONUS GRIB2 files. Comments & Feedback The marine elements will remain experimental until the NWS assesses feedback and completes a technical analysis. At that time, the NWS will determine whether to move these experimental elements to operational status, discontinue them, or revise and extend the experimental feedback period. Comments and feedback on the experimental TAFB Offshore and High Seas NDFD elements, as well as the OPC Offshore elements, are welcome at:http://www.nws.noaa.gov/survey/nws-survey.php?code=EGOSWHSMF General feedback on NDFD GRIB2 service:http://www.weather.gov/survey/nws-survey.php?code=ndfd-grids General feedback on NDFD XML SOAP service:http://www.weather.gov/survey/nws-survey.php?code=xmlsoap General feedback on the experimental NDFD map viewer:http://www.weather.gov/survey/nws-survey.php?code=wxmap
Subscribe to:
Posts (Atom)