Зеленый хостинг ТЭИА


LTCBTC - Bitfinex



Syndicate content My RSS Feed
My RSS Feed
Updated: 51 weeks 6 days ago

Totally Bonanza Tattly Birthday Sale

Thu, 07/26/2018 - 18:01

Once a year Tattly runs a totally bonanza 50% birthday sale. IT IS ON! And, while you’re browsing, you might want to know that our site is brand-new, launched last week, built by the fine folks of Lucid! Go try those filters! Wheee!

Happy our 7th Tattly birthday to you!

Categories: World News

New Version of KStars, Google Launches Edge TPU and Cloud IoT Edge, Lower Saxony to Migrate from Linux to Windows, GCC 8.2 Now Available and VMware Announces VMworld 2018

Thu, 07/26/2018 - 17:59

News briefs for July 26, 2018.

A new version of KStars—the free, open-source, cross-platform astronomy software—was released today. Version 2.9.7 includes new features, such as improvements to the polar alignment assistant and support for Ekos Live, as well as stability fixes. See the release notes for all the changes.

Google yesterday announced two new products: Edge TPU, a new "ASIC chip designed to run TensorFlow Lite ML models at the edge", and Cloud IoT Edge, which is "a software stack that extends Google Cloud's powerful AI capability to gateways and connected devices". Google states that "By running on-device machine learning models, Cloud IoT Edge with Edge TPU provides significantly faster predictions for critical IoT applications than general-purpose IoT gateways—all while ensuring data privacy and confidentiality."

The state of Lower Saxony in Germany is set to migrate away from Linux and back to Windows, following Munich's similar decision, ZDNet reports. The state currently has 13,000 workstations running openSUSE that it plans to migrate to "a current version of Windows" because "many of its field workers and telephone support services already use Windows, so standardisation makes sense". It's unclear how many years this migration will take.

GCC 8.2 was released today. This release is a bug-fix release and contains "important fixes for regressions and serious bugs in GCC 8.1 with more than 99 bugs fixed since the previous release", according to Jakub Jelinek's release statement. You can download GCC 8.2 here.

VMware announces VMworld 2018, which will be held August 26–30 in Las Vegas. The theme for the conference is "Possible Begins with You", and the event will feature keynotes by industry leaders, user-driven panels, certification training and labs. Topics will include "Data Center and Cloud, Networking and Security, Digital Workspace, Leading Digital Transformation, and Next-Gen Trends including the Internet of Things, Network Functions Virtualization and DevOps". For more information and to register, go here.

News KDE Astronomy Science Google IOT Cloud Windows openSUSE GCC VMware
Categories: World News

50+ Best Free Fonts for Designers 2018 (Serif, Script & Sans Serif)

Thu, 07/26/2018 - 17:47

We’re amazed at the number, and quality, of free fonts available today. Designers have an incredible choice of free fonts to choose from. So whether you’re looking for a serif, script, or sans-serif font, today’s collection of the best free fonts for designers has you covered!

Utilizing a great-looking font is a key part of making any type of a design look more professional. Of course, you don’t always have to use premium fonts to achieve that same level of professionalism. If you can’t afford to spend money on premium fonts to make your designs look great, you can always turn to one of the thousands of free fonts.

This collection includes the best free script fonts, serif fonts, sans-serif fonts, decorative fonts, and much more to match any kind of a design project you’re working on. Go ahead, scroll down and start downloading. Every font is free!

Railey – Free Handwritten Font

Railey is a beautifully modern handwritten script font you can use with various design projects, including web design, greeting cards, designs related to kids, and more. The font is free to use with your personal projects.

Tahu – Free Script Font

Tahu is a modern script font with a minimalist design. It’s perfect for T-shirt designs, website headers, and social media posts. The font is free to use with personal and commercial projects.

Odachi – Free Brush Font

Odachi is an elegant free brush font with a rough design. It’s completely free to use with your commercial projects. It includes numbers, alternates, and punctuations as well.

Machineat Script Font

This brush style script font features a mixed modern and vintage design that will surely add a certain elegance to your designs.

Macbeth – Free SVG Font

This creative brush-style SVG font comes to you free of charge. You can use it with various projects. It’s compatible with Photoshop CC 2017 and Illustrator CC 2018 or better.

Potra – Free Futuristic Font

Potra is a modern typeface with a futuristic design. This font is ideal for crafting social media posts, T-Shirts, website headers, and more.

Milea Handwritten Brush Font

Milea is an elegant brush font with a natural handwritten style. It’s perfect for everything from book covers to wedding invitations, website designs, blogs, and much more.

Peace Sans – Bold Font

This bold font has been crafted to perfection to help you instantly grab your audience’s attention. It’s free to use and comes with glyphs, alternates, and punctuations.

Badriyah Script Font

This signature-style handwritten font has a certain elegance to it that makes it most suitable for designing logotypes, business cards, and product tags.

Coves – Free Font

Coves is a modern typeface that comes in two light and bold weights. The font is free to use with your personal projects.

Pink Blue font

Pink Blue is a modern font with a stylish brush design. This font is ideal for pop-culture designs, posters, T-shirts, and more.

MADE Evolve Sans

Evolve is a futuristic space-themed font that’s perfect for crafting website headers, social media posts, posters, and even logo designs.

Outistyle Free Font

This brush script font comes with a unique rough design. It’s ideal for designing labels, quote posts, badges, greeting cards, and more.

Antiophie – Free Script Font

Another script font with a unique design. This free font has a stylish design made specifically for titles, book covers, headers, logos, and other branding works.

Shella Font Trio

Shella is a bundle of 3 different typefaces with various styles. Featuring a hand brushed design, this font will allow you to craft unique and decorative web and print graphics.

Rocket Clouds Free Font

A retro-themed font featuring a design inspired by the 1980s. The font is free to use with your personal projects.

Striped King Handlettering Script

This hand lettering script font comes with a stylishly striped design. The vintage-themed design makes it truly one of a kind. You can use it free with your personal projects.

Marsek Display Sans Serif

Marsek is a bold display font with a sans-serif design. This font is perfect for designing bold website headers, social media posts, blog titles, banners, and more.

Sandbrush Script Font

Another stylish hand-brushed font featuring a rough design. This font will fit in perfectly with your branding designs, quote posts, greeting card designs, and more.

Sunset Signature Font

Sunset is a handwritten font with a signature style design. You can use it to craft product labels, logos, headers, and more. The font is free to use with personal projects.

Hensa – Free Brush Script Typeface

Hensa is a beautiful and a free brush script font you can use to design greeting cards, social media posts, book covers, and other designs.

Bourbon Grotesque – Free Font

Bourbon is a creative display font that comes with a bold design for crafting effective headers, titles, posters, and flyers.

IronHead – Free Font

IronHead is a vintage-themed display that you can use to design website headers, logos, badges, signage, and banners with a retro design.

Willful Handwritten Brush Font

This beautiful handwritten brush font is perfect for many different types of creative projects, including book covers, posters, social media posts. And more.

Messenger – Free Commercial Font

Messenger is a..

Categories: World News

Learn a few different ways to get a progress bar for your dd command

Thu, 07/26/2018 - 17:32

The dd tool has been a critical component on the Linux (and UNIX) command line for ages. You know a command-line tool is important if it has only two letters, and dd is no exception. What I love about it in particular is that it truly embodies the sense of a powerful tool with no safety features, as described in Neal Stephenson's In the Beginning was the Command Line. The dd command does something simple: it takes input from one file and outputs it to another file, and since in UNIX "everything is a file", that means dd doesn't care if the output file is another file on your disk, a partition or even your active hard drive, it happily will overwrite it! Because of this, dd fits in that immortal category of sysadmin tools that I type out and then pause for five to ten seconds, examining the command, before I press Enter.

Unfortunately, dd has fallen out of favor lately, and some distributions even will advise using tools like cp or a graphical tool to image drives. This is largely out of the concern that dd doesn't wait for the disk to sync before it exits, so even if it thinks it's done writing, that doesn't mean all of the data is on the output file, particularly if it's over slow I/O like in the case of USB flash storage. The other reason people have tended to use other imaging tools is that traditionally dd doesn't output any progress. You type the command, and then if the image is large, you just wait, wait and then wait some more, wondering if dd will ever complete.

But, it turns out that there are quite a few different ways to get progress output from dd, so I cover a few popular ones here, all based on the following dd command to image an ISO file to a disk: Read more here https://www.linuxjournal.com/content/progress-your-image

submitted by /u/carlief007
[visit reddit] [comments]
Categories: World News

25 Manipulation Tutorials to Take Your Photoshop Skills to the Next Level

Thu, 07/26/2018 - 17:09
We’ve put together an amazing list of Photoshop manipulation tutorials that we hope every designer, beginner or master, will find it useful. 

There are several essential skills that make a designer successful. Every single one is crucial and has a lot of power when used appropriately. A skillful desinger:

Adobe Photoshop is one of the most potent design softwares in the world and one of the most popular. And there is a reason for that. With Photoshop you can create about anything your mind can come up with.

You can retouch a photo, apply filters, design a logo or website, use Photoshop actions and edit a bunch of images at once, crop the picture, and much more. In order become super knowledgeable and to create design in a no-time, you have to practice daily. What better ways for doing that than following a step-by-step manipulation tutorials?

In this list, we have shared 25 fantastic manipulation tutorials which will stretch your creativity and help you think out of the box. You are going to create hologram effect, create a melting camera, build a surreal landscape and make a fantasy deer.

1. Add a Hologram Effect to a Photo Using Photoshop

2. Digital Painting Lesson: How to Create a Photo Realistic Portrait

3. How to Make a Melting Camera Scene

4. The Ultimate Guide to Adjustment Layers – Gradient Map

5. Photoshop tutorial: Advanced compositing techniques

6. How to Digitally Add Shallow Depth of Field

7. Create a Colorful Out of Frame Animal Composition

8. How to Create a World Under the Sky using Photoshop

9. How to Create a Stunning Surreal Landscape

10. Create an Epic Beach Disaster Scene

11. Design a Conceptual Album Cover in Photoshop

12. Create a Devastating Tidal Wave in Photoshop

13. Create a Surreal Smoking Photo Manipulation


15. Photo Manipulate a Surreal Sky Station Scene

16. Amazing Light Photo Manipulation Tutorial

17. Learn How to Photo Manipulate the Colorful Portrait ‘Transcendental’

18. Create a Fantasy Deer Photo Manipulation in Photoshop

19. How to Create an Amazing Watercolor Artwork in Photoshop

20. How to Turn a Photo Into a Beautiful Painting in Photoshop

21. Create a Coffee Cake Photo Manipulation

22. Create a Surreal Rock Formation in Photoshop

23. Human Scarecrow – Manipulation Tutorial

24. Making Your First Photoshop Manipulation

25. How to Make a Fish Jump Out of Water

If you found this tutorial list helpful, share it with your fellow designers so that they can benefit from it, too. You never know whose designer’s life you are saving just by sharing an article.

Would you like to share your tutorial with us? Drop us an e-mail at webdesignledger.blog@gmail.com and we will make sure it reaches to other designers.

Read More at 25 Manipulation Tutorials to Take Your Photoshop Skills to the Next Level

Categories: World News

The world’s most beautiful router is also a task lamp

Thu, 07/26/2018 - 17:05

Your Wi-Fi router has seen the light.

When was the last time you called a Wi-Fi router beautiful? I can’t remember either.

Read Full Story

Categories: World News

The future of security? A good old-fashioned key

Thu, 07/26/2018 - 17:05

Google’s employees are now using hardware security keys, including one version designed to look like a real key.

I juggle two password managers that mishmash random characters and numbers together and file them away to ensure optimal encryption across my various accounts on the web. As a result, I can’t even get into my bank account without cross referencing apps and autofills. And you know what? None of this matters all that much when someone just hacks into a database like Yahoo and extracts my perfectly crafted password–no reverse-engineering required.

Read Full Story

Categories: World News

HTML and Boostrap 4 to Wordpress and Woocommerce. Should I learn it myself, or partner up with a senior dev?

Thu, 07/26/2018 - 16:50

I feel my workflow from designing and coding from figma all along to code it onto HTML is somewhat enjoyable. Is Wordpress a monster that should be taken special care and years to learn so I am ought to partner with a dev? Devs love designers who can code and help with support, I hope this will not be a hard task to accomplish. But maybe, it is not a hard task to learn it myself, is there anyone here that do it all? If so congrats

submitted by /u/argiebrah
[visit reddit] [comments]
Categories: World News

Best place to learn PHP?

Thu, 07/26/2018 - 16:50

Hey I was hoping someone could recommend a good place to learn PHP? mainly for CMS purposes as that's kind of the kind step for me in my freelance work, thanks!

submitted by /u/Grimsted
[visit reddit] [comments]
Categories: World News

5 Ways to Lower Your Site’s Barrier to Entry

Thu, 07/26/2018 - 16:37

The internet, like most activities on the planet, has a barrier to entry. You need at least one brain—conscious and functioning at a level high enough to tap or click on stuff—and a working Internet-enabled device. You need access, in one form or another, to an Internet service provider. And that’s really about it.

In an ideal world, that’s all you need. People without functioning eyeballs can use screen readers. People without hands have other input devices for their computers. People with crappy computers have… access to an ever-shrinking percentage of websites.

Wait… what?

Here’s the thing, each individual website, depending on how it’s built, can either increase its barrier to entry, or keep it at a bare minimum. Every time you implement a feature or technology that not everyone has access to, you raise the barrier a bit. You’re essentially kicking people off of your website. I suspect that, for the most part, you’d really rather not.

Well, you don’t have to.

1. Follow HTML and CSS Best Practices

This is the obvious one. You see, I’m hardly the first person to think of these problems. Web industry experts have been thinking about these things pretty much since the beginning. HTML and CSS have guidelines and rules in place to increase the accessibility of every website built with them.

Follow those guidelines. Use the Alt text. Use the right HTML elements for the right content. It doesn’t just help you maintain code, it helps screen reader apps navigate your site. Make sure all information conveyed with color is available without color. Heck, here’s a list.

2. Test for Accessibility

The guidelines alone won’t cut it. You need to test these things out. Grab a blind friend, or use a screen reader while wearing a blindfold if you have to. Test your site in different lighting conditions. Glasses on or off. Turn off the colors on your screen. Try apps that simulate various forms color-blindness.

These conditions (especially various forms of visual impairment) are a lot more common than you might think, so this is important. Also, make sure your site can be navigated by keyboard, where possible. Some devices for the disabled mimic keyboard input rather than mouse input, so that should be considered. Plus, some people just prefer keyboards.

3. Embrace Backwards Compatibility

A lot of people in the world still access the Internet via Internet cafes. Some by old phones. Others via gaming consoles. On these devices, not all of your usual browser features will be supported. “People with crappy hardware” isn’t a protected class, but if you’re selling a five-dollar-a-month service, is there any reason they shouldn’t be able to access it?

But what if you’re selling a luxury item? We expect people with money to have good computers, right? Well, massive corporations are known to use use old hardware and software, when they can get away with it. It’s entirely possible that there are people with six-figure salaries sitting in an office right now, browsing on a computer with Windows XP and an outdated version of Firefox because their phone is about three inches too far away. It happens.

Recently, I saw someone mention that CSS Grid has reached 70% compatibility. That’s fantastic, and designers should start using it more. But 30% of Internet users is a damned large number, and your site shouldn’t completely break if CSS Grid (or any other feature) isn’t supported. Your content should be structured in such a way that if everything goes straight to Hell, at least you have a usable, if almost entirely vertical, layout.

4. Speed and Performance

Speaking (again) of old phones and computers, loading speed and processing speed are absolutely barriers to entry. The longer your site takes to load at all, the worse it will be for spotty mobile networks, for the weirdly large number of people that still use dial-up, and for the even larger number of people with bad Internet because their provider has a local monopoly.

And even taking new devices into account, there are phones and mini-laptops still being made that sport old atom processors, and 1-2 GB of RAM. The longer your site takes to process, the worse it is for them. Yes, most Internet users are mobile these days, but they don’t all have iPhones.

5. Watch Out For Cognitive Overload

As a general rule, the busier and more visually overwhelming your site is, the more effort it will take your users to focus. The more effort it takes them to focus, the less they will want to be there. I’ve literally left sites just because the first thing I thought when I saw them was, “I just can’t deal with this right now. Nope. I’m out.”

Now in some cases, you actually want as much information on a page as you can reasonably squeeze in. One of the clearest examples of this is in eCommerce. But in eCommerce, they’re usually careful to organize the wealth of information very carefully, and categorize it all so you can find it easily. Even so, I usually feel pure relief when I finish up a “shopping trip” on Amazon.

Simply put, dealing with information (and deciding what to do with it) takes mental energy. The more mental energy used to process what you’re seeing, the higher the barrier to entry is. There is, of course, a balance to be struck. You don’t want to provide so little information that everything seems vague. Just, every time you add a bit of text, an animation, or a full blown widget (I love saying “widget”), ask yourself what the effect on the user’s cognitive load will be.

It will directly impact whether or not they feel like coming back.

Add Realistic Chalk and Sketch Lettering Effects with Sketch’it – only $5!

Categories: World News

Reflection Cards

Thu, 07/26/2018 - 16:36

Holstee’s Reflection Cards look like a sure way to have a meaningful conversation. Want!

Categories: World News

DTrace on Linux: an Update

Thu, 07/26/2018 - 16:27
Categories: World News

Progress with Your Image

Thu, 07/26/2018 - 16:26
by Kyle Rankin

Learn a few different ways to get a progress bar for your dd command.

The dd tool has been a critical component on the Linux (and UNIX) command line for ages. You know a command-line tool is important if it has only two letters, and dd is no exception. What I love about it in particular is that it truly embodies the sense of a powerful tool with no safety features, as described in Neal Stephenson's In the Beginning was the Command Line. The dd command does something simple: it takes input from one file and outputs it to another file, and since in UNIX "everything is a file", that means dd doesn't care if the output file is another file on your disk, a partition or even your active hard drive, it happily will overwrite it! Because of this, dd fits in that immortal category of sysadmin tools that I type out and then pause for five to ten seconds, examining the command, before I press Enter.

Unfortunately, dd has fallen out of favor lately, and some distributions even will advise using tools like cp or a graphical tool to image drives. This is largely out of the concern that dd doesn't wait for the disk to sync before it exits, so even if it thinks it's done writing, that doesn't mean all of the data is on the output file, particularly if it's over slow I/O like in the case of USB flash storage. The other reason people have tended to use other imaging tools is that traditionally dd doesn't output any progress. You type the command, and then if the image is large, you just wait, wait and then wait some more, wondering if dd will ever complete.

But, it turns out that there are quite a few different ways to get progress output from dd, so I cover a few popular ones here, all based on the following dd command to image an ISO file to a disk:

$ sudo dd if=/some/file.iso of=/dev/sdX bs=1M Option 1: Use pv

Like many command-line tools, dd can accept input from a pipe and output to a pipe. This means if you had a tool that could measure the data flowing over a pipe, you could sandwich it in between two different dd commands and get live progress output. The pv (pipe viewer) command-line tool is just such a tool, so one approach is to install pv using your distribution's packaging tool and then create a pv and dd sandwich:

Go to Full Article
Categories: World News

HTTP versus HTTPS – what’s all the fuss? [VIDEO]

Thu, 07/26/2018 - 16:10
With non-HTTPS sites now getting actively outed as "insecure" by browsers... well, why should we care? We explain in plain English...
Categories: World News

More browser extensions and apps caught spying on users

Thu, 07/26/2018 - 16:10
The pop-up blocking function of many apps and browser extensions appears to obscure an ulterior motive – spying on a user’s web traffic.
Categories: World News

WordPress Notifications Made Easy

Thu, 07/26/2018 - 15:50
WordPress Notifications Made Easy WordPress Notifications Made Easy Jakub Mikita 2018-07-26T14:20:27+02:00 2018-07-26T12:30:36+00:00

WordPress doesn’t offer any kind of notification system. All you can use is the wp_mail() function, but all of the settings have to be hardcoded, or else you have to create a separate settings screen to allow the user tweak the options. It takes many hours to write a system that is reliable, configurable and easy to use. But not anymore. I’ll show you how to create your own notification system within minutes with the free Notification plugin. By notification, I mean any kind of notification. Most of the time, it will be email, but with the plugin we’ll be using, you can also send webhooks and other kinds of notifications.

While creating a project for one of my clients, I encountered this problem I’ve described. The requirement was to have multiple custom email alerts with configurable content. Instead of hardcoding each and every alert, I decided to build a system. I wanted it to be very flexible, and the aim was to be able to code new scenarios as quickly as possible.

The code I wrote was the start of a great development journey. It turned out that the system I created was flexible enough that it could work as a separate package. This is how the Notification plugin was born.

Suppose you want to send an email about a user profile being updated by one of your website’s members. WordPress doesn’t provide that functionality, but with the Notification plugin, you can create such an email in minutes. Or suppose you want to synchronize your WooCommerce products with third-party software by sending a webhook to a separate URL every time a new product is published. That’s easy to do with the plugin, too.

Lessons Learned While Developing WordPress Plugins

Good plugin development and support lead to more downloads. More downloads mean more money and a better reputation. Learn how you can develop good-quality products with seven golden rules. Read more →

In this article, you’ll learn how to integrate the plugin in your own application and how to create an advanced WordPress notification system more quickly and easily than ever.

In this article, we’ll cover:

  1. how to install the plugin,
  2. the idea behind the plugin and its architecture,
  3. creating a custom scenario for notifications,
  4. creating the action (step 1 of the process),
  5. creating the trigger (step 2 of the process),
  6. creating the custom notification type,
  7. how to enable white-label mode and bundle the plugin in your package.

Getting the process just right ain't an easy task. That's why we've set up 'this-is-how-I-work'-sessions — with smart cookies sharing what works really well for them. A part of the Smashing Membership, of course.

Explore features → Installing The Plugin

To create your own scenarios, you are going to need the Notification plugin. Just install it from the WordPress.org repository in your WordPress dashboard, or download it from the GitHub repository.

Large preview

Later in the article, you’ll learn how to hide this plugin from your clients and make it work as an integrated part of your plugin or theme.

The Idea Of The Plugin

Before going into your code editor, you’ll need to know what the plugin’s architecture looks like. The plugin contains many various components, but its core is really a few abstract classes.

The main components are:

  • The notification
    This could be an email, webhook, push notification or SMS.
  • The trigger
    This is what sends the notification. It’s effectively the WordPress action.
  • The merge tag
    This is a small portion of the dynamic content, like {post_title}.

To give you a better idea of how it all plays together, you can watch this short video:

The core of the Notification plugin is really just an API. All of the default triggers, like Post published and User registered are things built on top of that API.

Because the plugin was created for developers, adding your own triggers is very easy. All that’s required is a WordPress action, which is just a single line of code and a class declaration.

Custom Scenario

Let’s devise a simple scenario. We’ll add a text area and button to the bottom of each post, allowing bugs in the article to be reported. Then, we’ll trigger the notification upon submission of the form.

This scenario was covered in another article, “Submitting Forms Without Reloading the Page: AJAX Implementation in WordPress”.

For simplicity, let’s make it a static form, but there’s no problem putting the action in an AJAX handler, instead of in the wp_mail() function.

Let’s create the form.

The Form add_filter( 'the_content', 'report_a_bug_form' ); function report_a_bug_form( $content ) { // Display the form only on posts. if ( ! is_single() ) { return $content; } // Add the form to the bottom of the content. $content .= '<form action="' . admin_url( 'admin-post.php' ) . '" method="POST"> <input type="hidden" name="post_id" value="' . get_ID() . '"> <input type="hidden" name="action" value="report_a_bug"> <textarea name="message" placeholder="' . __( 'Describe what\'s wrong...', 'reportabug' ) . '"></textarea> <button>' . __( 'Report a bug', 'reportabug' ) . '</button> </div>'; return $content; }

Please note that many components are missing, like WordPress nonces, error-handling and display of the action’s result, but these are not the subject of this article. To better understand how to handle these actions, please read the article mentioned above.

Preparing The Action

To trigger the notification, we are going to need just a single action. This doesn’t have to be a custom action like the one below. You can use any of the actions already registered in WordPress core or another plugin.

The Form Handler And Action add_action( 'admin_post_report_a_bug', 'report_a_bug_handler' ); add_action( 'admin_post_nopriv_report_a_bug', 'report_a_bug_handler' ); function report_a_bug_handler() { do_action( 'report_a_bug', $_POST['post_id'], $_POST['message'] ); // Redirect back to the article. wp_safe_redirect( get_permalink( $_POST['post_id'] ) ); exit; }

You can read more on how to use the admin-post.php file in the WordPress Codex.

This is all we need to create a custom, configurable notification. Let’s create the trigger.

Registering The Custom Trigger

The trigger is just a simple class that extends the abstract trigger. The abstract class does all of the work for you. It puts the trigger in the list, and it handles the notifications and merge tags.

Let’s start with the trigger declaration.

Minimal Trigger Definition class ReportBug extends \BracketSpace\Notification\Abstracts\Trigger { public function __construct() { // Add slug and the title. parent::__construct( 'reportabug', __( 'Bug report sent', 'reportabug' ) ); // Hook to the action. $this->add_action( 'report_a_bug', 10, 2 ); } public function merge_tags() {} }

All you need to do is call the parent constructor and pass the trigger slug and nice name.

Then, we can hook into our custom action. The add_action method is very similar to the add_action() function; so, the second parameter is the priority, and the last one is the number of arguments. Only the callback parameter is missing because the abstract class does that for us.

Having the class, we can register it as our new trigger.

register_trigger( new ReportBug() );

This is now a fully working trigger. You can select it from the list when composing a new notification.

(Large preview)

Although the trigger is working and we can already send the notification we want, it’s not very useful. We don’t have any way to show the recipient which post has a bug and what the message is.

This would be the time, then, to register some merge tags and set up the trigger context with the action parameters we have: the post ID and the message.

To do this, we can add another method to the trigger class. This is the action callback, where we can catch the action arguments.

Handling Action Arguments public function action( $post_ID, $message ) { // If the message is empty, don't send any notifications. if ( empty( $message ) ) { return false; } // Set the trigger properties. $this->post = get_post( $post_ID ); $this->message = $message; }

Note the return false; statement. If you return false from this method, the trigger will be stopped, and no notification will be sent. In our case, we don’t want a notification to be submitted with an empty message. In the real world, you’d want to validate that before the form is sent.

Then, we just set the trigger class’ properties, the complete post object and the message. Now, we can use them to add some merge tags to our trigger. We can just fill the content of the merge_tags method we declared earlier.

Defining Merge Tags public function merge_tags() { $this->add_merge_tag( new \BracketSpace\Notification\Defaults\MergeTag\UrlTag( array( 'slug' => 'post_url', 'name' => __( 'Post URL', 'reportabug' ), 'resolver' => function( $trigger ) { return get_permalink( $trigger->post->ID ); }, ) ) ); $this->add_merge_tag( new \BracketSpace\Notification\Defaults\MergeTag\StringTag( array( 'slug' => 'post_title', 'name' => __( 'Post title', 'reportabug' ), 'resolver' => function( $trigger ) { return $trigger->post->post_title; }, ) ) ); $this->add_merge_tag( new \BracketSpace\Notification\Defaults\MergeTag\HtmlTag( array( 'slug' => 'message', 'name' => __( 'Message', 'reportabug' ), 'resolver' => function( $trigger ) { return nl2br( $trigger->message ); }, ) ) ); $this->add_merge_tag( new \BracketSpace\Notification\Defaults\MergeTag\EmailTag( array( 'slug' => 'post_author_email', 'name' => __( 'Post author email', 'reportabug' ), 'resolver' => function( $trigger ) { $author = get_userdata( $trigger->post->post_author ); return $author->user_email; }, ) ) ); }

This will add four merge tags, all ready to use while a notification is being composed.

The merge tag is an instance of a special class. You can see that there are many types of these tags, and we are using them depending on the value that is returned from the resolver. You can see all merge tags in the GitHub repository.

All merge tags are added via the add_merge_tag method, and they require the config array with three keys:

  • slug
    The static value that will be used in the notification (i.e. {post_url}).
  • name
    The translated label for the merge tag.
  • resolver
    The function that replaces the merge tag with the actual value.

The resolver doesn’t have to be the closure, as in our case, but using it is convenient. You can pass a function name as a string or an array if this is a method in another class.

In the resolver function, only one argument is available: the trigger class instance. Thus, we can access the properties we just set in the action method and return the value we need.

And that’s all! The merge tags are not available to use with our trigger, and we can set up as many notifications of the bug report as we want.

(Large preview) Creating The Custom Notification Type

The Notification plugin offers not only custom triggers, but also custom notification types. The plugin ships with two types, email and webhook, but it has a simple API to register your own notifications.

It works very similarly to the custom trigger: You also need a class and a call to one simple function to register it.

I’m showing only an example; the implementation will vary according to the system you wish to integrate. You might need to include a third-party library and call its API or operate in WordPress’ file system, but the guide below will set you up with the basic process.

Let’s start with a class declaration:

class CustomNotification extends \BracketSpace\Notification\Abstracts\Notification { public function __construct() { // Add slug and the title. parent::__construct( 'custom_notification', __( 'Custom Notification', 'textdomain' ) ); } public function form_fields() {} public function send( \BracketSpace\Notification\Interfaces\Triggerable $trigger ) {} }

In the constructor, you must call the parent’s class constructor and pass the slug and nice name of the notification.

The form_fields method is used to create a configuration form for notifications. (For example, the email notification would have a subject, body, etc.)

The send method is called by the trigger, and it’s where you can call the third-party API that you wish to integrate with.

Next, you have to register it with the register_notification function.

register_trigger( new CustomNotification() ); The Notification Form

There might be a case in which you have a notification with no configuration fields. That’s fine, but most likely you’ll want to give the WordPress administrator a way to configure the notification content with the merge tags.

That’s why we’ll register two fields, the title and the message, in the form_fields method. It looks like this:

public function form_fields() { $this->add_form_field( new \BracketSpace\Notification\Defaults\Field\InputField( array( 'label' => __( 'Title', 'textdomain' ), 'name' => 'title', 'resolvable' => true, 'description' => __( 'You can use merge tags', 'textdomain' ), ) ) ); $this->add_form_field( new \BracketSpace\Notification\Defaults\Field\TextareaField( array( 'label' => __( 'Message', 'textdomain' ), 'name' => 'message', 'resolvable' => true, 'description' => __( 'You can use merge tags', 'textdomain' ), ) ) ); }

As you can see, each field is an object and is registered with the add_form_field method. For the list of all available field types, please visit the GitHub repository.

Each field has the translatable label, the unique name and a set of other properties. You can define whether the field should be resolved with the merge tags with the resolvable key. This means that when someone uses the {post_title} merge tag in this field, it will be changed with the post’s actual title. You can also provide the description field for a better user experience.

At this point, your custom notification type can be used in the plugin’s interface with any available trigger type.

(Large preview) Sending The Custom Notification

In order to make it really work, we have to use the send method in our notification class declaration. This is the place where you can write an API call or use WordPress’ file system or any WordPress API, and do whatever you like with the notification data.

This is how you can access it:

public function send( \BracketSpace\Notification\Interfaces\Triggerable $trigger ) { $title = $this->data['title']; $message = $this->data['message']; // @todo Write the integration here. }

At this point, all of the fields are resolved with the merge tags, which means the variables are ready to be shipped.

That gives you endless possibilities to integrate WordPress with any service, whether it’s your local SMS provider, another WordPress installation or any external API you wish to communicate with.

White Labeling And Bundling The Plugin

It’s not ideal to create a dependency of a plugin that can be easily deactivated and uninstalled. If you are building a system that really requires the Notification plugin to be always available, you can bundle the plugin in your own code.

If you’ve used the Advanced Custom Fields plugin before, then you are probably familiar with the bundling procedure. Just copy the plugin’s files to your plugin or theme, and invoke the plugin..

Categories: World News

Mercury Prize 2018 shortlist revealed, including Arctic Monkeys, Florence + The Machine and Lily Allen - Official Charts Company

Thu, 07/26/2018 - 15:21
The shortlist for this year's Hyundai Mercury Prize has been unveiled. Arctic Monkeys' Tranquility Base Hotel + Casino, Florence + The Machine's High As Hope and Lily Allen's No Shame are among the acts nominated for this year's prestigious award, now ...

and more »
Categories: World News


Thu, 07/26/2018 - 15:05

This Butter dish, designed by Kristina Filler, made me laugh: Buttah!

Categories: World News

Просто хороший хостинг