SlideShare une entreprise Scribd logo
1  sur  21
antispambot()
      ...
  zeroize()
$ whoami
Yoav Farhi
Developer
blog.yoavfarhi.com
@yoavf
$ pwd
//antispambot()

/**
 * Converts email addresses characters to HTML entities
 * to block spam bots.
 *
 * @return string Converted email address.
 */
function antispambot($emailaddy, $mailto=0)
?>


Email me at:
<?php echo antispambot('yoav@farhi.org'); ?>

Email me at:
yo&#97;v&#64;&#102;a&#114;&#104;&#105;&#46;org
//checked(), selected(), disabled()

/**
 * Outputs the html checked attribute.
 *
 * Compares the first two arguments and if identical
 * marks as checked
 *
 * @return string html attribute or empty string
 */
function checked( $checked, $current = true, $echo = true )

?>

<input type='checkbox' name='postlink' value='1' <?php if
( 1 == $postlink ) echo 'checked="checked"'; ?> />

<input type="checkbox" name="postlink" value="1" <?php
checked( $postlink, 1 ); ?> />
//human_time_diff()

/**
 * Determines the difference between two timestamps.
 *
 * The difference is returned in a human readable
 * format such as "1 hour", * "5 mins", "2 days".
 * @return string Human readable time difference.
*/
function human_time_diff( $from, $to )
?>

<?php echo human_time_diff(get_comment_time('U')).' ago';?>

//2 days ago
//wp_list_pluck()

/**
 * Pluck a certain field out of each object in a list.
 * @return array
 */
function wp_list_pluck( $list, $field );

$foods = array(
! array(
! ! 'name' =>     'Banana',
! ! 'color' =>    'Yellow',
! ),
! array(
! ! 'name' =>     'Apple',
! ! 'color' =>    'Red',
! ),
);

$foods_names = wp_list_pluck( $foods, 'name' );
//$foods_names = array( 'Banana','Apple' );

$color_names = wp_list_pluck( $foods, 'color' );
//$color_names = array( 'Yellow','Red' );
//wp_localize_script()




  //wordcamp.js

  jQuery(document).ready(function($){
    alert('Welcome to WordCamp Jerusalem 2013');
    });
  });
//wp_localize_script()

/**
 * Used to localizes a script.
 *
 * @return bool Whether the localization was
 * added successfully.
 */
function wp_localize_script( $handle, $object_name, $l10n );
?>

<?php
wp_enqueue_script( 'wordcamp-jeruslaem', 'wordcamp.js' );
$translation_array = array(
 'welcome' => __( 'Welcome to WordCamp Jerusalem 2013' )
);
wp_localize_script( 'wordcamp-jeruslaem', 'wc_strings',
                   $translation_array );
?>

<script>
  var wc_strings = {
     welcome: '2013 ‫,'ברוכים הבאים לוורדקמפ ירושלים‬
  };
</script>
//wp_localize_script()




  // WordCamp.js

  jQuery(document).ready(function($){
    alert( wc_strings.welcome );
    });
  });
Let’s get to work


                       cc-by galato901
                    http://yoav.fr/towork
//wp_kses()

/**
 * Filters content and keeps only allowable HTML elements.
 *
 * @return string Filtered content with only
 * allowed HTML elements
 */

function wp_kses($string, $allowed_html, $allowed_protocols);

$tags = array(
    'em' => array(),
    'strong' => array()
);

$html = <<<EOT
<p>
! <b>BOLD</b> is different than <em>italics</em>
</p>
EOT;

echo wp_kses( $html, $tags );
//BOLD is different than <em>italics</em>
//wp_mail()

/**
 * Send mail, similar to PHP's mail
 *
 * @return bool Whether the email contents were sent
 * successfully.
 */

function wp_mail( $to, $subject, $message, $headers =
'', $attachments = array() );

$to = 'yoav@farhi.org';
$subject = 'I love WordPres';
$message = 'WordPress is The Awesome!!!1';

$mail = wp_mail( $to, $subject, $message );

if( $mail )
! echo 'Mail sent';
//wp_remote_get()

/**
 * Retrieve the raw response from the HTTP
 * request using the GET method.
 *
 * @return WP_Error|array The response or
 *         WP_Error on failure.
 */
function wp_remote_get( $url, $args = array() );

$url = 'http://nominatim.openstreetmap.org/search?
q=Netanya&format=json';

$response = wp_remote_get( $url );

if ( ! is_wp_error( $response ) )
! //Do something
//wp_trim_words()

/**
 * Trims text to a certain number of words.
 *
 * @return string Trimmed text.
 */

function wp_trim_words( $text, $num_words = 55, $more = null );

$text = "I love WordPress and Joomla";
echo wp_trim_words( $text, 3 );

// I Love WordPress
//zeroise()

/**
 * Add leading zeros when necessary.
 *
 * @return string Adds leading zeros to number if needed.
 */
function zeroise($number, $threshold);

$comno = get_comments_number();
// $comno = '2'
$zeroed = zeroise($comno, 2);
// $zeroed = '02'
cc by-nc-nd anarosaphotography
           http://yoav.fr/happy




Happy
questions ?
How can I get involved
with the WordPress.org
      community?

Contenu connexe

Tendances

Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using CodeceptionJeroen van Dijk
 
Drupal 7 module development
Drupal 7 module developmentDrupal 7 module development
Drupal 7 module developmentAdam Kalsey
 
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -Yusuke Wada
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQueryorestJump
 
Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5Yusuke Wada
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Laravel, the right way - PHPConference 2016
Laravel, the right way - PHPConference 2016Laravel, the right way - PHPConference 2016
Laravel, the right way - PHPConference 2016Matheus Marabesi
 
YAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービスYAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービスYusuke Wada
 
TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !Matheus Marabesi
 
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...Matheus Marabesi
 
ZCPE - PHP Conference 2015
ZCPE   - PHP Conference 2015ZCPE   - PHP Conference 2015
ZCPE - PHP Conference 2015Matheus Marabesi
 

Tendances (20)

Web 11 | AJAX + JSON + PHP
Web 11 | AJAX + JSON + PHPWeb 11 | AJAX + JSON + PHP
Web 11 | AJAX + JSON + PHP
 
Refactoring using Codeception
Refactoring using CodeceptionRefactoring using Codeception
Refactoring using Codeception
 
Web 8 | Introduction to PHP
Web 8 | Introduction to PHPWeb 8 | Introduction to PHP
Web 8 | Introduction to PHP
 
Web 9 | OOP in PHP
Web 9 | OOP in PHPWeb 9 | OOP in PHP
Web 9 | OOP in PHP
 
Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 
Web 10 | PHP with MySQL
Web 10 | PHP with MySQLWeb 10 | PHP with MySQL
Web 10 | PHP with MySQL
 
Drupal 7 module development
Drupal 7 module developmentDrupal 7 module development
Drupal 7 module development
 
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 
Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Php variables (english)
Php variables (english)Php variables (english)
Php variables (english)
 
5. hello popescu
5. hello popescu5. hello popescu
5. hello popescu
 
Laravel, the right way - PHPConference 2016
Laravel, the right way - PHPConference 2016Laravel, the right way - PHPConference 2016
Laravel, the right way - PHPConference 2016
 
YAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービスYAPC::Asia 2010 Twitter解析サービス
YAPC::Asia 2010 Twitter解析サービス
 
TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !TDC2015 Porto Alegre - Automate everything with Phing !
TDC2015 Porto Alegre - Automate everything with Phing !
 
Php Training Workshop by Vtips
Php Training Workshop by VtipsPhp Training Workshop by Vtips
Php Training Workshop by Vtips
 
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
TDC 2016 (Florianópolis) - Vá para o próximo nível - Dicas e truques para a c...
 
ZCPE - PHP Conference 2015
ZCPE   - PHP Conference 2015ZCPE   - PHP Conference 2015
ZCPE - PHP Conference 2015
 

En vedette

Responsive Design for WordPress
Responsive Design for WordPressResponsive Design for WordPress
Responsive Design for WordPressMiriam Schwab
 
Qtp Training Deepti 2 Of 44780
Qtp Training Deepti 2 Of 44780Qtp Training Deepti 2 Of 44780
Qtp Training Deepti 2 Of 44780Azhar Satti
 
MME Results Comparison
MME Results ComparisonMME Results Comparison
MME Results Comparisonpanthers
 
היכרות עם וורדפרס ועוד חן כהן
היכרות עם וורדפרס ועוד   חן כהןהיכרות עם וורדפרס ועוד   חן כהן
היכרות עם וורדפרס ועוד חן כהןMiriam Schwab
 
The Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi ConstableThe Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi ConstableMiriam Schwab
 
Digital Fabrication Studio 0.3 Media, Business, Platform, Economy
Digital Fabrication Studio 0.3 Media, Business, Platform, EconomyDigital Fabrication Studio 0.3 Media, Business, Platform, Economy
Digital Fabrication Studio 0.3 Media, Business, Platform, EconomyMassimo Menichinelli
 

En vedette (6)

Responsive Design for WordPress
Responsive Design for WordPressResponsive Design for WordPress
Responsive Design for WordPress
 
Qtp Training Deepti 2 Of 44780
Qtp Training Deepti 2 Of 44780Qtp Training Deepti 2 Of 44780
Qtp Training Deepti 2 Of 44780
 
MME Results Comparison
MME Results ComparisonMME Results Comparison
MME Results Comparison
 
היכרות עם וורדפרס ועוד חן כהן
היכרות עם וורדפרס ועוד   חן כהןהיכרות עם וורדפרס ועוד   חן כהן
היכרות עם וורדפרס ועוד חן כהן
 
The Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi ConstableThe Power of Your Story - Kimanzi Constable
The Power of Your Story - Kimanzi Constable
 
Digital Fabrication Studio 0.3 Media, Business, Platform, Economy
Digital Fabrication Studio 0.3 Media, Business, Platform, EconomyDigital Fabrication Studio 0.3 Media, Business, Platform, Economy
Digital Fabrication Studio 0.3 Media, Business, Platform, Economy
 

Similaire à מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים

Tidy Up Your Code
Tidy Up Your CodeTidy Up Your Code
Tidy Up Your CodeAbbas Ali
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)Jeff Eaton
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developersStoyan Stefanov
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Seri Moth
 
C A S Sample Php
C A S Sample PhpC A S Sample Php
C A S Sample PhpJH Lee
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes Paul Bearne
 
Creating native apps with WordPress
Creating native apps with WordPressCreating native apps with WordPress
Creating native apps with WordPressMarko Heijnen
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConRafael Dohms
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix itRafael Dohms
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?Radek Benkel
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 

Similaire à מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים (20)

Tidy Up Your Code
Tidy Up Your CodeTidy Up Your Code
Tidy Up Your Code
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
 
My shell
My shellMy shell
My shell
 
C A S Sample Php
C A S Sample PhpC A S Sample Php
C A S Sample Php
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
wget.pl
wget.plwget.pl
wget.pl
 
WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes
 
Creating native apps with WordPress
Creating native apps with WordPressCreating native apps with WordPress
Creating native apps with WordPress
 
Further Php
Further PhpFurther Php
Further Php
 
Your code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnConYour code sucks, let's fix it - DPC UnCon
Your code sucks, let's fix it - DPC UnCon
 
You code sucks, let's fix it
You code sucks, let's fix itYou code sucks, let's fix it
You code sucks, let's fix it
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?
 
Wp query
Wp queryWp query
Wp query
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Daily notes
Daily notesDaily notes
Daily notes
 

Plus de Miriam Schwab

Making your content fly with onsite SEO
Making your content fly with onsite SEOMaking your content fly with onsite SEO
Making your content fly with onsite SEOMiriam Schwab
 
Content Security Policies: A whole new way of securing your website that no o...
Content Security Policies: A whole new way of securing your website that no o...Content Security Policies: A whole new way of securing your website that no o...
Content Security Policies: A whole new way of securing your website that no o...Miriam Schwab
 
Digitizing your business
Digitizing your businessDigitizing your business
Digitizing your businessMiriam Schwab
 
Managing multitudes of media
Managing multitudes of mediaManaging multitudes of media
Managing multitudes of mediaMiriam Schwab
 
Mobile SEO at SMX Israel 2014
Mobile SEO at SMX Israel 2014Mobile SEO at SMX Israel 2014
Mobile SEO at SMX Israel 2014Miriam Schwab
 
WordPress for Startups
WordPress for StartupsWordPress for Startups
WordPress for StartupsMiriam Schwab
 
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013Miriam Schwab
 
Getting an online marketing job in Jerusalem - is that even possible?
Getting an online marketing job in Jerusalem - is that even possible?Getting an online marketing job in Jerusalem - is that even possible?
Getting an online marketing job in Jerusalem - is that even possible?Miriam Schwab
 
WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013Miriam Schwab
 
Using SASS in the WordPress environment - Ran Bar Zik
Using SASS in the WordPress environment - Ran Bar ZikUsing SASS in the WordPress environment - Ran Bar Zik
Using SASS in the WordPress environment - Ran Bar ZikMiriam Schwab
 
מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013Miriam Schwab
 
The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013Miriam Schwab
 
Small but mighty - Google+, Instagram, Pinterest
Small but mighty - Google+, Instagram, PinterestSmall but mighty - Google+, Instagram, Pinterest
Small but mighty - Google+, Instagram, PinterestMiriam Schwab
 
Measuring Twitter: SMX Israel 2013
Measuring Twitter: SMX Israel 2013Measuring Twitter: SMX Israel 2013
Measuring Twitter: SMX Israel 2013Miriam Schwab
 
Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013Miriam Schwab
 
Introduction to the semantic web: SMX Israel 2013
Introduction to the semantic web: SMX Israel 2013Introduction to the semantic web: SMX Israel 2013
Introduction to the semantic web: SMX Israel 2013Miriam Schwab
 
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...Miriam Schwab
 
Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012Miriam Schwab
 
Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012Miriam Schwab
 
June 2012 - Web Trends for Marketing Professionals
June 2012 - Web Trends for Marketing ProfessionalsJune 2012 - Web Trends for Marketing Professionals
June 2012 - Web Trends for Marketing ProfessionalsMiriam Schwab
 

Plus de Miriam Schwab (20)

Making your content fly with onsite SEO
Making your content fly with onsite SEOMaking your content fly with onsite SEO
Making your content fly with onsite SEO
 
Content Security Policies: A whole new way of securing your website that no o...
Content Security Policies: A whole new way of securing your website that no o...Content Security Policies: A whole new way of securing your website that no o...
Content Security Policies: A whole new way of securing your website that no o...
 
Digitizing your business
Digitizing your businessDigitizing your business
Digitizing your business
 
Managing multitudes of media
Managing multitudes of mediaManaging multitudes of media
Managing multitudes of media
 
Mobile SEO at SMX Israel 2014
Mobile SEO at SMX Israel 2014Mobile SEO at SMX Israel 2014
Mobile SEO at SMX Israel 2014
 
WordPress for Startups
WordPress for StartupsWordPress for Startups
WordPress for Startups
 
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
How to add semantic data to your WP site in 20 minutes or less! WordSesh 2013
 
Getting an online marketing job in Jerusalem - is that even possible?
Getting an online marketing job in Jerusalem - is that even possible?Getting an online marketing job in Jerusalem - is that even possible?
Getting an online marketing job in Jerusalem - is that even possible?
 
WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013WordPress site planning, WordCamp Jerusalem 2013
WordPress site planning, WordCamp Jerusalem 2013
 
Using SASS in the WordPress environment - Ran Bar Zik
Using SASS in the WordPress environment - Ran Bar ZikUsing SASS in the WordPress environment - Ran Bar Zik
Using SASS in the WordPress environment - Ran Bar Zik
 
מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013מצגת יעל הרמן מוורדקמפ ירושלים 2013
מצגת יעל הרמן מוורדקמפ ירושלים 2013
 
The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013The Business of WordPress - WordCamp Jerusalem 2013
The Business of WordPress - WordCamp Jerusalem 2013
 
Small but mighty - Google+, Instagram, Pinterest
Small but mighty - Google+, Instagram, PinterestSmall but mighty - Google+, Instagram, Pinterest
Small but mighty - Google+, Instagram, Pinterest
 
Measuring Twitter: SMX Israel 2013
Measuring Twitter: SMX Israel 2013Measuring Twitter: SMX Israel 2013
Measuring Twitter: SMX Israel 2013
 
Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013Google Analytics for PPC: SMX Israel 2013
Google Analytics for PPC: SMX Israel 2013
 
Introduction to the semantic web: SMX Israel 2013
Introduction to the semantic web: SMX Israel 2013Introduction to the semantic web: SMX Israel 2013
Introduction to the semantic web: SMX Israel 2013
 
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
Blogging with WordPress.com for beginners, part 1/3, by Deena Levenstein IN H...
 
Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012
 
Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012Webinar: 9 Steps to Socialize your WordPress Website - July 2012
Webinar: 9 Steps to Socialize your WordPress Website - July 2012
 
June 2012 - Web Trends for Marketing Professionals
June 2012 - Web Trends for Marketing ProfessionalsJune 2012 - Web Trends for Marketing Professionals
June 2012 - Web Trends for Marketing Professionals
 

Dernier

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Dernier (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

מ-antispambot ועד zeroise – עשר פונקציות וורדפרס שאתם כנראה לא מכירים

  • 1. antispambot() ... zeroize()
  • 5.
  • 6. //antispambot() /** * Converts email addresses characters to HTML entities * to block spam bots. * * @return string Converted email address. */ function antispambot($emailaddy, $mailto=0) ?> Email me at: <?php echo antispambot('yoav@farhi.org'); ?> Email me at: yo&#97;v&#64;&#102;a&#114;&#104;&#105;&#46;org
  • 7. //checked(), selected(), disabled() /** * Outputs the html checked attribute. * * Compares the first two arguments and if identical * marks as checked * * @return string html attribute or empty string */ function checked( $checked, $current = true, $echo = true ) ?> <input type='checkbox' name='postlink' value='1' <?php if ( 1 == $postlink ) echo 'checked="checked"'; ?> /> <input type="checkbox" name="postlink" value="1" <?php checked( $postlink, 1 ); ?> />
  • 8. //human_time_diff() /** * Determines the difference between two timestamps. * * The difference is returned in a human readable * format such as "1 hour", * "5 mins", "2 days". * @return string Human readable time difference. */ function human_time_diff( $from, $to ) ?> <?php echo human_time_diff(get_comment_time('U')).' ago';?> //2 days ago
  • 9. //wp_list_pluck() /** * Pluck a certain field out of each object in a list. * @return array */ function wp_list_pluck( $list, $field ); $foods = array( ! array( ! ! 'name' => 'Banana', ! ! 'color' => 'Yellow', ! ), ! array( ! ! 'name' => 'Apple', ! ! 'color' => 'Red', ! ), ); $foods_names = wp_list_pluck( $foods, 'name' ); //$foods_names = array( 'Banana','Apple' ); $color_names = wp_list_pluck( $foods, 'color' ); //$color_names = array( 'Yellow','Red' );
  • 10. //wp_localize_script() //wordcamp.js jQuery(document).ready(function($){ alert('Welcome to WordCamp Jerusalem 2013'); }); });
  • 11. //wp_localize_script() /** * Used to localizes a script. * * @return bool Whether the localization was * added successfully. */ function wp_localize_script( $handle, $object_name, $l10n ); ?> <?php wp_enqueue_script( 'wordcamp-jeruslaem', 'wordcamp.js' ); $translation_array = array( 'welcome' => __( 'Welcome to WordCamp Jerusalem 2013' ) ); wp_localize_script( 'wordcamp-jeruslaem', 'wc_strings', $translation_array ); ?> <script> var wc_strings = { welcome: '2013 ‫,'ברוכים הבאים לוורדקמפ ירושלים‬ }; </script>
  • 12. //wp_localize_script() // WordCamp.js jQuery(document).ready(function($){ alert( wc_strings.welcome ); }); });
  • 13. Let’s get to work cc-by galato901 http://yoav.fr/towork
  • 14. //wp_kses() /** * Filters content and keeps only allowable HTML elements. * * @return string Filtered content with only * allowed HTML elements */ function wp_kses($string, $allowed_html, $allowed_protocols); $tags = array( 'em' => array(), 'strong' => array() ); $html = <<<EOT <p> ! <b>BOLD</b> is different than <em>italics</em> </p> EOT; echo wp_kses( $html, $tags ); //BOLD is different than <em>italics</em>
  • 15. //wp_mail() /** * Send mail, similar to PHP's mail * * @return bool Whether the email contents were sent * successfully. */ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ); $to = 'yoav@farhi.org'; $subject = 'I love WordPres'; $message = 'WordPress is The Awesome!!!1'; $mail = wp_mail( $to, $subject, $message ); if( $mail ) ! echo 'Mail sent';
  • 16. //wp_remote_get() /** * Retrieve the raw response from the HTTP * request using the GET method. * * @return WP_Error|array The response or * WP_Error on failure. */ function wp_remote_get( $url, $args = array() ); $url = 'http://nominatim.openstreetmap.org/search? q=Netanya&format=json'; $response = wp_remote_get( $url ); if ( ! is_wp_error( $response ) ) ! //Do something
  • 17. //wp_trim_words() /** * Trims text to a certain number of words. * * @return string Trimmed text. */ function wp_trim_words( $text, $num_words = 55, $more = null ); $text = "I love WordPress and Joomla"; echo wp_trim_words( $text, 3 ); // I Love WordPress
  • 18. //zeroise() /** * Add leading zeros when necessary. * * @return string Adds leading zeros to number if needed. */ function zeroise($number, $threshold); $comno = get_comments_number(); // $comno = '2' $zeroed = zeroise($comno, 2); // $zeroed = '02'
  • 19. cc by-nc-nd anarosaphotography http://yoav.fr/happy Happy
  • 21. How can I get involved with the WordPress.org community?