#php json decode error
Explore tagged Tumblr posts
fromdevcom · 1 month ago
Text
Decoding Data in PHP: The Ultimate Guide to Reading File Stream Data to String in 2025 Reading file content into a string is one of the most common tasks in PHP development. Whether you're parsing configuration files like JSON or INI, processing uploaded documents, or consuming data from streams and APIs, being able to efficiently and correctly read file data into a string is essential. With PHP 8.x, developers have access to mature, robust file handling functions, but choosing the right one—and understanding how to handle character encoding, memory efficiency, and errors—is key to writing performant and reliable code. In this comprehensive guide, we’ll walk through the best ways to read file stream data into a string in PHP as of 2025, complete with modern practices, working code, and real-world insights. Why Read File Stream Data to String in PHP? There are many scenarios in PHP applications where you need to convert a file's contents into a string: Parsing Configuration Files: Formats like JSON, INI, and YAML are typically read as strings before being parsed into arrays or objects. Reading Text Documents: Applications often need to display or analyze user-uploaded documents. Processing Network Streams: APIs or socket streams may provide data that needs to be read and handled as strings. General File Processing: Logging, data import/export, and command-line tools often require reading file data as text. Methods for Reading and Converting File Stream Data to String in PHP 1. Using file_get_contents() This is the simplest and most widely used method to read an entire file into a string. ✅ How it works: It takes a filename (or URL) and returns the file content as a string. 📄 Code Example: phpCopyEdit 📌 Pros: Very concise. Ideal for small to medium-sized files. ⚠️ Cons: Loads the entire file into memory—can be problematic with large files. Error handling must be explicitly added (@ or try/catch via wrappers). 2. Using fread() with fopen() This method provides more control, allowing you to read file contents in chunks or all at once. 📄 Code Example: phpCopyEdit 📌 Pros: Greater control over how much data is read. Better for handling large files in chunks. ⚠️ Cons: Requires manual file handling. filesize() may not be reliable for network streams or special files. 3. Reading Line-by-Line Using fgets() Useful when you want to process large files without loading them entirely into memory. 📄 Code Example: phpCopyEdit 📌 Pros: Memory-efficient. Great for log processing or large data files. ⚠️ Cons: Slower than reading in one go. More code required to build the final string. 4. Using stream_get_contents() Works well with generic stream resources (e.g., file streams, network connections). 📄 Code Example: phpCopyEdit 📌 Pros: Works with open file or network streams. Less verbose than fread() in some contexts. ⚠️ Cons: Still reads entire file into memory. Not ideal for very large data sets. 5. Reading Binary Data as a String To read raw binary data, use binary mode 'rb' and understand the data's encoding. 📄 Code Example: phpCopyEdit 📌 Pros: Necessary for binary/text hybrids. Ensures data integrity with explicit encoding. ⚠️ Cons: You must know the original encoding. Risk of misinterpreting binary data as text. Handling Character Encoding in PHP Handling character encoding properly is crucial when working with file data, especially in multilingual or international applications. 🔧 Best Practices: Use UTF-8 wherever possible—it is the most compatible encoding. Check the encoding of files before reading using tools like file or mb_detect_encoding(). Use mb_convert_encoding() to convert encodings explicitly: phpCopyEdit$content = mb_convert_encoding($content, 'UTF-8', 'ISO-8859-1'); Set default encoding in php.ini:
iniCopyEditdefault_charset = "UTF-8" Be cautious when outputting string data to browsers or databases—set correct headers (Content-Type: text/html; charset=UTF-8). Error Handling in PHP File Operations Proper error handling ensures your application fails gracefully. ✅ Tips: Always check return values (fopen(), fread(), file_get_contents()). Use try...catch blocks if using stream wrappers that support exceptions. Log or report errors clearly for debugging. 📄 Basic Error Check Example: phpCopyEdit Best Practices for Reading File Stream Data to String in PHP ✅ Use file_get_contents() for small files and quick reads. ✅ Use fread()/fgets() for large files or when you need precise control. ✅ Close file handles with fclose() to free system resources. ✅ Check and convert character encoding as needed. ✅ Implement error handling using conditionals or exceptions. ✅ Avoid reading huge files all at once—use chunked or line-by-line methods. ✅ Use streams for remote sources (e.g., php://input, php://memory). Conclusion Reading file stream data into a string is a foundational PHP skill that underpins many applications—from file processing to configuration management and beyond. PHP 8.x offers a robust set of functions to handle this task with flexibility and precision. Whether you’re using file_get_contents() for quick reads, fgets() for memory-efficient processing, or stream_get_contents() for stream-based applications, the key is understanding the trade-offs and ensuring proper character encoding and error handling. Mastering these techniques will help you write cleaner, safer, and more efficient PHP code—an essential skill for every modern PHP developer. 📘 External Resources: PHP: file_get_contents() - Manual PHP: fread() - Manual PHP: stream_get_contents() - Manual
0 notes
airman7com · 5 years ago
Text
PHP JSON Decode Example
PHP JSON decode. In this tutorial, we will discuss json_decode () function syntax, defination, parameters, and an examples.
In this tutorial, we will take examples using the json_decode () function. Like, convert JSON strings to PHP arrays, convert JSON strings to multidimensional PHP and JSON arrays decode and access object value PHP.
PHP JSON Decode Function
Definition: – The PHP json_decode ()…
View On WordPress
0 notes
mainsnoble · 3 years ago
Text
Json decode
Tumblr media
#JSON DECODE HOW TO#
#JSON DECODE CODE#
#JSON DECODE FREE#
With the help of the Online JSON Parser Tool, we can easily format our minify JSON Data and easily find key and value pairs and identify changes quickly.
JSON Data mainly used when we need to transfer data with different platforms and it’s easy to synchronize and used in any system.
All Data are available in Key and value pair. Decode a JSON document from s (a str beginning with a JSON document) and return a 2-tuple of the.
Here, In the above sample JSON data Name, Country, and Age are known as key and Jone, USA, and 39 known as a Value.
In Treeview, You can Search and highlight, and Sorting Data.
jsondecode converts JSON data types to the MATLAB data types in this table.
Minify or Compact JSON Data to resave and reduct its Size. JSON supports fewer data types than MATLAB.
JSON Validator for your Online Changes and your other JSON Data.
Redo and Undo facility when you edit your JSON online.
#JSON DECODE HOW TO#
How to Parse Large JSON Data with Isolates in Dart 2.The JSON Parser Tools have Below the main functionality:.
#JSON DECODE CODE#
How to Parse JSON in Dart/Flutter with Code Generation using FreezedĪnd if you need to parse large JSON data, you should do so in a separate isolate for best performance.In such cases, code generation is a much better option and this article explains how to use it: If you have a lot of different model classes, or each class has a lot of properties, writing all the parsing code by hand becomes time-consuming and error-prone. Restaurant Ratings example - JSON Serialization code.While the example JSON we used as reference wasn't too complex, we still ended up with a considerable amount of code: consider using the deep_pick package to parse JSON in a type-safe way.for nested JSON data (lists of maps), apply the fromJson() and toJson() methods.add explicit casts, validation, and null checks inside fromJson() to make the parsing code more robust.create model classes with fromJson() and toJson() for all domain-specific JSON objects in your app.When null, JSON objects will be returned as. When true, JSON objects will be returned as associative array s when false, JSON objects will be returned as object s. PHP implements a superset of JSON as specified in the original RFC 7159. use jsonEncode() and jsonDecode() from 'dart:convert' to serialize JSON data This function only works with UTF-8 encoded strings.But if we want our apps to work correctly, it's very important that we do it right and pay attention to details: JSON serialization is a very mundane task. You can build anything with Appwrite! Click here to learn more. Appwrite is a secure, self-hosted solution that provides developers with a set of easy-to-use REST APIs to manage their core backend needs. Open-Source Backend Server for Flutter Developers. Help me keep it that way by checking out this sponsor:
#JSON DECODE FREE#
Serializing Nested ModelsĪs a last step, here's the toJson() method to convert a Restaurant (and all its reviews) back into a Map:Ĭode with Andrea is free for everyone. You need to write the parsing code that is most appropriate for your use case. This specific implementation makes some assumptions about what may or may not be null, what fallback values to use etc.
if the reviews are missing, we use an empty list ( ) as a fallback.
map() operator to convert each dynamic value to a Review object using omJson()
the values in the list could have any type, so we use List.
the reviews may be missing, hence we cast to a nullable List.
Tumblr media
1 note · View note
noahkessler6841 · 6 years ago
Text
Natas: Level 11
This level once again focuses on cookies, and it took me a good while to figure out. The main page allows the user to input a colour, which will the change the background of the page to said colour when submitted.
Tumblr media
Digging into the provided sourcecode, we see that an array of key value pairs is json encoded, xor encrypted and then base64 encoded, before being stored as a cookie called ‘data’ on the users computer.
Tumblr media
The most difficult part of this level was understanding the properties of xor encryption. Thankfully Richard touched on it a bit in one of the online lectures for the course that I’d watched. I also managed to find some more information about it on this site: https://www.hackthis.co.uk/articles/the-xor-cipher. So in order to solve this level, we need to make use of the property that when something is xor’d twice, it will be deciphered.
My main goal is to find the censored ‘$key’ variable used in the xor_encrypt function. Since we know that the xor of the json encoded data (e.g. $defaultdata) and $key is equal to the ‘data’ cookie base64 decoded, we can use this information the derive the $key.
Making use of the xor_encrypt function provided in the code and with a bit of trial and error, I used an online php evlauator to get this result:
Tumblr media
So from this we can derive that the $key is “qw8J”. Now we can create our own cookie, setting ‘showpassword’ to ‘yes’. 
Tumblr media
Changing the data cookie and refreshing the page gets us the password to the next level.
Tumblr media
I really felt like this level was quite challenging at first. However, after spending more time understanding the code and xor encyption, the solution kinda clicked in my head.
0 notes
gslin · 8 years ago
Text
PHP 7.3 的 json_decode() 將會用 Exception 處理錯誤
PHP 7.3 的 json_decode() 將會用 Exception 處理錯誤
在「PHP: rfc:json_throw_on_error」這邊提到 PHP 7.3 會解決 json_decode() 發生錯誤時的處理方式: PHP has two functions for dealing with JSON, json_decode() and json_encode(). Unfortunately, both have suboptimal error handling. json_decode() returns null upon erroring, but null is also a possible valid result (if decoding the JSON “null”). 在這之前唯一的判斷方式是另外再呼叫 json_last_error() 或是 json_last_error_msg(),但這樣寫很辛苦,所以要引入…
View On WordPress
0 notes
Text
How to Incorporate External APIs in Your WordPress Theme or Plugin
APIs can help you to add functionality to your WordPress plugins and themes. In this tutorial I will show you how to use any API (whether it be from Flickr, Google, Twitter, and so on) with WordPress. You will learn how to connect, collect data, store and render–everything you need to know to extend your plugin or theme with new functionality!
We will use Flickr as an example, creating a simple widget that displays the latest Flickr images in order of username.  
Wait, What’s an API?
“API” stands for Application Programming Interface; an intermediary between applications, allowing them to communicate, sending information back and forth in real time. We’ll be using a Web API, one which uses HTTP to fetch data from a remote location on the internet somewhere.
“APIs are used by software applications in much the same way that interfaces for apps and other software are used by humans.” – David Berlind, ProgrammableWeb
If you want to get an even clearer idea of what APIs are before we dive into our tutorial, here are some more resources to help you:
News
The Increasing Importance of APIs in Web Development
Janet Wagner
WordPress
Use the WooCommerce API to Customize Your Online Store
Rachel McCollin
API WordPress Plugins on Envato Market
If you’d like to see what other WordPress developers are building with APIs, check out this collection of plugins on Envato Market–plenty of API goodness to get stuck into!
API WordPress plugins on Envato Market
1. Organize Your Working Environment
Let’s begin by organizing our working environment. Start by downloading the Postman app, which provides an API development environment that makes it easy to connect, test, and develop any API. For individuals and small teams it’s completely free.
We’re going to build a widget in a simple WordPress plugin, so make sure you have WordPress installed.
2. Code the Plugin Basics
To start let’s create a simple plugin called flickr-widget. Create a folder with that name and create a flickr-widget.php file in it. At the top of the file place the following code (feel free to change the Author and URIs with your own details):
/* Plugin Name: Flickr widget Plugin URI: https://www.enovathemes.com Description: Display recent Flickr images Author: Enovathemes Version: 1.0 Author URI: http://enovathemes.com */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly }
Note: this is rudimentary plugin, so I won’t load a language file or create any additional parameters. 
Put the freshly created plugin folder inside your WordPress install: wp-content > plugins. You can now activate it from within the WordPress admin dashboard > plugins. You won’t see any changes to your WordPress because we haven’t actually added any functional code.
A Note on Using APIs
Before we go any further, let me quickly mention API use. Any service whose API you want to use will have documentation; I highly recommend you look closely at it. You can use APIs with all kinds of development languages and often get data back in any format you need: PHP, JSON, Java etc. Good documentation will contain detailed information on how to connect to the API, with instructions for each language, and also the main API endpoints (an endpoint is one end of a communication channel).
Web APIs are typically categorized as being either SOAP or REST. SOAP relies solely on XML to provide messaging services, while REST offers a more lightweight method, using URLs in most cases to receive or send information. In our example we will use a REST API.
Programming Fundamentals
What Does REST Mean?
Matthew Machuga
3. Configure and Test API with Postman
So, here is our plan:
Configure and test API with Postman
Connect, collect, and format data from Flickr REST API
Cache the data with WordPress transients
Let’s refer to the Flickr API documentation. Under the Request Formats section you have REST, XML-RPC, SOAP. We need the REST. Click it and you will see an example of a general Flickr REST API Endpoint: https://www.flickr.com/services/rest/.
With the Flickr REST API we can GET, POST, and DELETE any Flickr data we want. Copy the sample endpoint and paste it into Postman (make sure your request type is set to GET). 
Click the Send button and... error! 
The sample request included the compulsory Flickr API method, but we didn’t specify the API key that is required in order to connect (keys are used to track and control how an API is being used, for example to prevent malicious use or abuse of the API as defined perhaps by terms of service).
4. Get API Key
Having established that we need an API key, let’s go and get one. In order to create one you will first need to have a Flickr/Yahoo account. Once you’ve entered the API dashboard click on the link create your first:
After that click on the Request an API Key. Many API providers have their own specific terms on API usage. Some limit access, others have light and pro versions, or commercial and non-commercial. Sometimes API keys are provided after manual approval; it depends entirely on the API provider. I have chosen Flickr, because it has simple API requirements. For example, Twitter requires a detailed description of the app you want to build before providing an API key, and this is then reviewed by the review team. 
That said, click on the Apply for a non-commercial key button and provide some basic info on the app name.
Once you’ve submitted the request you will get the API key (which identifies you) and secret code (which proves you are who you say you are) immediately. Keep these details safe!
5. Set the Request Parameters
Now we will need a method to request data. From the Flickr API documentation we can see that Flickr has tons to choose from. Some methods, like image posting, or deleting, require authentication. Flickr uses OAuth for this; an open, simple, and secure protocol that enables applications to authenticate users and interact with API providers on their behalf. The end user’s information is securely transferred without revealing the identity of the user.
For now, we’ll use simple methods that don’t require oAuth. Click on flickr.photos.getRecent method to see what’s required. This method does not need authentication, but it does take several arguments: api_key (required), extras, per_page, page. Let’s make a simple request in Postman using our parameters:
API general endpoint - https://flickr.com/services/rest
API key - f49df4a290d8f224ecd56536af51FF77 (this is a sample API key which you’ll need to replace with your own)
Method - flickr.photos.getRecent
It will look like this:
https://www.flickr.com/services/rest/?api_key=f49df4a290d8f224ecd56536af51FF77&method=flickr.photos.getRecent
This will return the list of recent public images from Flickr in XML format. 
XML format
I always set data format to auto to let Postman decide what format the data is. With Postman you have several data format options: JSON (my favorite), XML, HTML and Text. Flickr returns data in XML format, but this is not a problem for us, as we can add an additional parameter to get data in JSON &format=json:
JSON format
6. Connect, Collect, and Format Data
Now we know how to request data using the REST API, let’s build our WordPress Flickr widget. In the plugin’s main PHP file paste the widget code. I won’t cover the specifics of WordPress widget creation in this tutorial as our focus is different. We have a learning guide Introduction to Creating Your First WordPress Widget by Rachel McCollin which should get you up to speed if you need it.
In the WordPress admin navigate to Appearance > Widgets and add the “Photos from Flickr” widget to a widget area. Now if you go to the front-end you will see the widget title, but no results just yet. 
Back in our plugin PHP file, here we render the widget output itself. We have our API key, and the method, and the format we’re looking for. Now we will need to make sure the Flickr user id is provided, and the number of photos the user wants to fetch. These are are gathered from the widget settings.
Note: to get a Flickr user id use this service. I am using envato as the username, and the id is 52617155@N08. Enter the following code inside IF statement:
$url = 'https://www.flickr.com/services/rest/'; $arguments = array( 'api_key' => 'f49df4a290d8f224ecd56536af51FF77', 'method' => 'flickr.people.getPublicPhotos', 'format' => 'json', 'user_id' => $user_id, 'per_page'=> $photos_number, ); $url_parameters = array(); foreach ($arguments as $key => $value){ $url_parameters[] = $key.'='.$value; } $url = $url.implode('&', $url_parameters);
At this point we can knit together the final REST API endpoint url with all the arguments we’ve collected. 
Now we’ll make an API request with the file_get_contents() php function:
$response = file_get_contents($url); if ($response) { print_r($response); }
If you now go to the front-end you will something like this outputted:
jsonFlickrApi({"photos":{"page":1,"pages":1033,"perpage":1,"total":"1033","photo":[{"id":"15647274066","owner":"52617155@N08","secret":"2ee48c3fe9","server":"3940","farm":4,"title":"Halloween 2014 at Envato in Melbourne","ispublic":1,"isfriend":0,"isfamily":0}]},"stat":"ok"})
Our request was successful and returned useful data, so now let’s decode and format it. We’ll begin by cleaning up the JSON string–first by removing the wrapper (jsonFlickrApi({...});) with a str_replace. Then we’ll decode the JSON url:
$response = str_replace('jsonFlickrApi(', '', $response); $response = str_replace('})', '}', $response); $response = json_decode($response,true);
Now if we print our results we will see an associative array with data. When we’re ready we can loop through that array and create the data output structure. But first, take a closer look at the small parameter stat. According to the Flickr documentation this indicates the response status. So, before creating the structure of the widget let’s use this status to make sure we have the correct data. Add an IF statement: 
if ($response['stat'] == 'ok') { // code here… }
Create an empty array before the IF statement. This array will then be used to contain the collected data:
$response_results = array();
Your foreach loop should now look like this:
if ($response['stat'] == 'ok') { foreach ($response['photos']['photo'] as $photo) { $response_results[$photo['id']]['link'] = esc_url('//flickr.com/photos/'.$photo["owner"].'/'.$photo["id"]); $response_results[$photo['id']]['url'] = esc_url('//farm'.$photo["farm"].'.staticflickr.com/'.$photo["server"].'/'.$photo["id"].'_'.$photo["secret"].'_s.jpg'); $response_results[$photo['id']]['alt'] = esc_attr($photo["title"]); } }
Here we loop through each photo object in the photos array from our response data. Our widget needs the following information to function properly:
Image absolute URL
Image link to Flickr
Image description/alt text
Examine this page and you will understand why I used the given structure. Here you will find the detailed information on how to create the image path and image link. 
Create Widget Output
Now our $response_results array contains the exact data we need to create our widget:
if (!empty($response_results)) { $output = ''; $output .= '<ul class="widget-flickr-list">'; foreach ($response_results as $photo) { $output .= '<li>'; $output .= '<a href="'.$photo['link'].'" target="_blank">'; $output .= '<img src="'.$photo['url'].'" alt="'.$photo['alt'].'" />'; $output .= '</a>'; $output .= '</li>'; } $output .= '</ul>'; echo $output; }
We begin by making sure our response is not empty. After that we create an unordered list, storing it in $output, then loop through each image, adding a wrapper link, all the other details, and finally outputting the whole thing with echo;.
If you now go to the site front-end you will see a list of images! 
Let’s add some basic styling with CSS to make it look better.
Create an empty flickr-widget.css file in the root plugin folder. In the top of the plugin file paste the following code:
if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } function register_script(){ wp_register_style('widget-flickr', plugins_url('/widget-flickr.css', __FILE__ )); } add_action( 'wp_enqueue_scripts', 'register_script' );
Then, inside the IF statement at the very top add the code:
if (!empty($response_results)) { wp_enqueue_style('widget-flickr');
Inside the css file add basic styling:
.widget-flickr-list { list-style: none; margin:0 -4px 0 -4px; padding: 0; } .widget-flickr-list:after { content: ""; clear: both; } .widget-flickr-list li { display: block; float: left; width: 25%; margin:0; padding: 4px; }
Now it looks much better!
Bonus: Cache the Data with WordPress Transients
At this stage we’ve finished the widget, but there is one more little thing that will take our development to the next level: caching. 
Any API request uses your site’s resources and increases load time. Each browser reload will send an API request, which could be multiple users at the same time. What if for some reason your API provider host is down? Your site will suffer load difficulties. The solution is to cache the results and update at a give time interval. So the first time a user visits our page the API request will be sent, but the next time, or with another user, we won’t need to send an API request but instead fetch the results from our site cache. 
Let’s modify the widget code to cache results:
if (!empty($flickr_id)) { $api_key = 'f49df4a290d8f224ecd56536af51FF77'; $transient_prefix = esc_attr($flickr_id . $api_key); if (false === ($response_results = get_transient('flickr-widget-' . $transient_prefix))) { $url = 'https://www.flickr.com/services/rest/'; $arguments = array( 'api_key' => $api_key, 'method' => 'flickr.people.getPublicPhotos', 'format' => 'json', 'user_id' => $flickr_id, 'per_page' => $photos_number, ); $url_parameters = array(); foreach ($arguments as $key => $value) { $url_parameters[] = $key . '=' . $value; } $url .= '?' . implode('&', $url_parameters); $response = file_get_contents($url); if ($response) { $response = str_replace('jsonFlickrApi(', '', $response); $response = str_replace('})', '}', $response); $response = json_decode($response, true); $response_results = array(); if ($response['stat'] == 'ok') { foreach ($response['photos']['photo'] as $photo) { $response_results[$photo['id']]['link'] = esc_url('//flickr.com/photos/' . $photo["owner"] . '/' . $photo["id"]); $response_results[$photo['id']]['url'] = esc_url('//farm' . $photo["farm"] . '.staticflickr.com/' . $photo["server"] . '/' . $photo["id"] . '_' . $photo["secret"] . '_s.jpg'); $response_results[$photo['id']]['alt'] = esc_attr($photo["title"]); } if (!empty($response_results)) { $response_results = base64_encode(serialize($response_results)); set_transient('flickr-widget-' . $transient_prefix, $response_results, apply_filters('null_flickr_cache_time', HOUR_IN_SECONDS * 2)); } } } else { return new WP_Error('flickr_error', esc_html__('Could not get data', 'your-text-domain')); } } if (!empty($response_results)) { $response_results = unserialize(base64_decode($response_results)); wp_enqueue_style('widget-flickr'); $output = ''; $output .= '<ul class="widget-flickr-list">'; foreach ($response_results as $photo) { $output .= '<li>'; $output .= '<a href="' . $photo['link'] . '" target="_blank">'; $output .= '<img src="' . $photo['url'] . '" alt="' . $photo['alt'] . '" />'; $output .= '</a>'; $output .= '</li>'; } $output .= '</ul>'; echo $output; } }
I won’t describe what the transient is and how it works, just what it does. Any time the widget is rendered we first check if the transient is in place; if it is present we fetch results from transient, but if not, we make an API request. And each two hours our transient expires, in order to keep our latest Flickr images actual and up to date. 
With the WordPress plugin Transients Manager you can even see what your cached Flickr API request results look like:
And the final touch here is to remove transient for every widget update. For example, if you want to change the number of images displayed, or change the username, you’d need to make a new API request. This can be done with the widget_update_callback WordPress filter, or the widget class public function update:
public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['photos_number'] = strip_tags($new_instance['photos_number']); $instance['flickr_id'] = strip_tags($new_instance['flickr_id']); $api_key = 'f49df4a290d8f224ecd56536af51FF77'; $transient_name = 'flickr-widget-' . esc_attr($instance['flickr_id'] . $api_key); delete_transient($transient_name); return $instance; }
Conclusion
That was a lot of effort, but now you know how to work with WordPress and APIs! If you enjoyed this post and would like to see additional tutorials on APIs or transients, let me know in the comments section.
To grab the widget sample files head over to the GitHub repository.
0 notes
xenleaksinc · 6 years ago
Text
XenForo 2.0.12 - Upgrade
XenForo 2.0.12 is now available for all licensed customers to download. We recommend that all customers running previous versions of XenForo 2.0 upgrade to this release to benefit from increased stability. This version makes a number of changes to improve compatibility with PHP 7.3.0. However, at this time, we do not recommend using PHP 7.3.0 in production due to a bug that can cause code to execute incorrectly, potentially leading to data loss. We believe this bug will be resolved in PHP 7.3.1 when it's released. Download XenForo 2.0.12 Some of the changes in XF 2.0.12 include: Improve PHP 7.3 compatibility. If available and different from the server version, grab a more detailed version for the Server environment report. If the $_SERVER['SERVER_SOFTWARE'] value isn't available or valid then just don't display that entry in the report, because it's mostly not essential. Adds some additional phrases for the "Server environment report" Fix an issue which affects building add-on releases on Windows where local paths included a leading slash. Incrementally update the job state of the Sitemap job so that a fatal error shouldn't disrupt the process and introduce corrupted/duplicate items. Adjust error message given when attempting to edit a user's permissions for a content type without a valid user_id. Standardize the locale information used by PHP. Use a different approach to loading icons on the add-ons list in the Admin CP. To avoid issues with multiple database connections, the icon image data is instead converted to a data URI. User upgrades should not check canPurchase() before processing a payment that has been received, as this method is really only for limiting the UI/purchase setup. Add some additional trusted IP ranges for Google. Ensure 'nullable' entity property is reflected in generated code Ensure node navigation entries use their assigned title Ignore custom field errors during admin edit and include custom field title with errors Convert warning notes field to structured text Correctly apply admin user message leave options Prevent new messages being duplicated in Firefox Ensure multi quote quotes are inserted into the correct editor Hide 'Start a new conversation' link if visitor doesn't have permission to start conversations. Allow permanent redirects to be stickied and unstickied. Remove extra save call when ignoring member Remove UTC check from server environment report and link PHP version to phpinfo page Prevent loading of Setup.php if addon.json requirements aren't met Make xf-dev:entity-class-properties CLI command correctly handle subdirectories Return 'complete' response from UserGroupPromotion job if no active promotions are found. Ensure 'From name' and 'From email' fields are applied when batch emailing users Hide editor draft menu from guests Ensure cron entries run at zero valued time units if multiple time values are selected. Check for missing hash in IPSForums3x authentication handler. Add missing hint parameter to discouraged checkbox on user edit page Remove invalid relation from SpamTriggerLog entity Use content type phrase when rebuilding the search index Fix incorrect URL on conversation message likes list Fix broken 'Delay duration' option for floating notices Allow invalid users to be unfollowed Re-add explain text in the user_edit form to clarify non-valid user states behaviour. Include table name in message for any exception occurring in SchemaManager methods. Implement custom stack trace builder to mask passwords in method arguments Add deleted item styling to news feed items When restoring spam cleaned threads, ensure threads which were originally moved are restored back to the correct forum. Return an error phrase upon invalid callback validation when performing spam clean actions. Note that the method name switches to ucfirst(\XF\Util\Php::camelCase($action)) in XF 2.1 but remains as ucfirst($action) in XF 2.0. When handling a Stripe webhook that is missing required metadata, when attempting to find a previous related log, ensure said log actually contains a purchase_request_key. Improve BB code parsing of incomplete tags within plain-child tags. Migrate user field criteria during upgrade from XF 1.x to 2.x By default, do not allow cookies to be retrieved as arrays to prevent unexpected behavior. (Array support can now be opted into explicitly.) Prevent an error when trying to delete a payment profile when there is an invalid purchasable definition. Track when a preview is pending to prevent multiple simultaneous preview loads. Prevent a PHP notice when deleting a poll for a thread started by a guest Include breadcrumb in edit history view and compare templates. Pass unused $ellipsis variable into wholeWordTrim. Prevent long select options from causing overflow on iOS. Enable the HTML to BB code simplification process to handle additional situations Resolve some situations where the new messages indications while composing a reply wouldn't take you to the expected location. Validate advertisement html before saving. Prevent tel/sms links being converted to bbcode Remove the insert icode option when extended text formatting is disabled. Allow end user modification to the "allow this BB code in signatures" option on add-on-defined custom BB codes. Call the canPurchase method instead of can_purchase in UserUpgrade::getFilteredUserUpgradesForList. Correctly combine multiple custom field-related limits to the user and thread searchers. Correctly apply the "not in secondary groups" user search condition (users cannot be in any of the listed groups). When building a release and testing a JSON, only consider an error if decoding the build.json does not return an array. When submitting spammers to StopForumSpam, convert binary IP address to readable string. When saving style templates through the admin UI, force version/last_edit_date to be updated like XF 1.x When merging threads, always redirect to the target thread. Fix currency code for Belarusian Ruble (BYR => BYN) No longer cache the preview container object in the PreviewClick handler. If there are multiple handlers per page, the cached container becomes incorrect if using different handlers. When form filling, if the control is a textarea with a textarea-handler, trigger its update method to ensure the textarea is resized appropriately. Prevent an array-to-string conversion when throwing a bulkInsert exception if a missing column is detected. Ensure that the user following cache cannot include your own user ID. Add missing mod_log.thread_poll_reset phrase. Attempt to exclude dot files/directories from our vendor dependencies. Number boxes are too wide and cause units to overflow their container, fixed with max-width. Add "Please do not reply to this message" text to outgoing conversation emails. Reassign user group changes when merging users Ensure PasswordChange service errors on any UserAuth error. Fetch more threads for new threads widget Ensure exceptions in sub-processes stop execution, and always exit with non-zero error code on error. Make Disabler system compatible with select options. Ensure FieldAdder handles Disabler elements correctly Ensure prefix of destination thread is shown in moved post alert. Trigger change event on select when prefix selected Remove the "mixed" stuff from CodeMirror's PHP mode so that the opening tag is no longer required. Update broken link to Apple support in cookie help page text (and in XF 1.5). Adjust top border radii of blocks within overlays. Allow non-user selectable styles to be used for the email style. Also, add several email-related style properties to allow email colors to be overridden more directly, without creating a new style. Implement a "notice watcher" system for bottom fixed notices. This calculates the total visible notice height in the bottom fix location and adds a footer margin to the same value so that no content can be covered by the notice(s). Adjust how we parse search query modifiers to be more strict. (- and + require whitespace before and none after, | requires whitespace on both sides. Don't parse doubled up modifiers.) Adjust trophies phrase capitalization Include no_date_limit in the rel=canonical link for forums when needed Attempt to reduce cases where conversation reply_count values could potentially get out of sync. Allow the reply count and other parts to be rebuilt via the conversation rebuild tool. By default, reject email addresses as invalid if there are no dots in the domain part. Add a bit of left padding on contentRow-suffix elements. Include the forum a thread is in in the RSS feeds (only for global feeds) Fix add-on development data not being removed as expected when the last entry of a type has been removed. (The metadata JSON file must still exist.) Relax URL validation a tiny bit, notably don't block adjacent path separators in the path section. Ensure phrase is escaped in HTML attribute. Ensure usage of phrase within HTML attribute is escaped. In the AbstractSearcher ensure that the day end value is converted properly to the end of the day. Never allow the XF add-on to appear in add-on lists. Handle avatar deletes via the spam cleaner for gravatars too. Make add-on action finalization more robust when uninstalling legacy add-ons. When importing dev output, ignore any invalid columns. Add some block border radius to the member header block so that it fits within its parent block. Ensure permissions are rebuilt on add-on active change. Update child navigation entries directly when the parent ID changes to ensure dev output is written correctly. Use the correct maxlength value for the public navigation structure. Additionally, bump AdminNavigation ID lengths up to 50 from 25. Add support for partial indexes to schema manager conflict resolution system Fix multiple issues that make it hard to use XF\Import\Data\AbstractEntityData Consistently use code paths which result in the canView method of the report entity (rather than the handler) being used. The following public templates have had changes: account_upgrades core_contentrow.less core_input.less core_overlay.less editor_base.less edit_history_compare edit_history_view forum_view PAGE_CONTAINER quick_reply_macros thread_save_draft warning_info Where necessary, the merge system within the "outdated templates" page should be used to integrate these changes. As always, new releases of XenForo are free to download for all customers with active licenses, who may now grab the new version from the customer area. Note: add-ons, customizations and styles made for XenForo 1.x are not compatible with XenForo 2.x. If your site relies upon these for essential functionality, ensure that a XenForo 2 version exists before you start to upgrade. We strongly recommend you make a backup before attempting an upgrade. Current Requirements Please note that XenForo 2.0.x has higher system requirements than XenForo 1.x. The forthcoming XenForo 2.1.x release will have higher system requirements again (PHP 5.6). The following are minimum requirements: PHP 5.4 or newer (PHP 7.2 recommended) MySQL 5.5 and newer (Also compatible with MariaDB/Percona etc.) All of the official add-ons require XenForo 2.0. Enhanced Search requires at least Elasticsearch 2.0. Installation and Upgrade Instructions for XenForo 2.0 Full details of how to install and upgrade XenForo can be found in the XenForo 2 Manual. Note that when upgrading from XenForo 1.x, all add-ons will be disabled and style customizations will not be maintained. New versions of add-ons will need to be installed and customizations will need to be redone. We strongly recommended that you make a backup before attempting an upgrade. Once upgraded, you will not be able to downgrade without restoring from a backup.
xenforo_2.0.12_upgrade.zip
source https://xenforoleaks.com/topic/308-xenforo-2012-upgrade/
0 notes
michfilson-blog · 7 years ago
Text
How to make a wordpress website?
Tumblr media
Today, WordPress is the most popular content management system: it has been used to create a myriad of different websites. Initially, it was designed to be a platform for bloggers, but its functionality was extended significantly. Should you create a WordPress-based website? This article is here to answer this question.
 Key advantages of WordPress-based projects
The primary advantage of this CMS is the fact it’s totally free. Besides, WordPress provides a wide range of free plugins.
 WordPress installation is very simple – a user doesn’t have to possess any special technical skills, and many hosting providers have WordPress already built in their service. Manual installation takes up to 10 minutes.
 Convenient content management is possible thanks to numerous plugins that facilitate publishing considerably. The content manager doesn’t need even HTML knowledge.
 Inner optimization – plugins allow for organizing comprehensive inner linking, automating title and description creation, image naming and many other details that impact SEO.
 Main disadvantages of WordPress-based websites
The most considerable drawback of this system is conflicting plugins. They should be installed with particular accuracy: prior to every installation, a website backup copy should be made to restore it in case of failure. That will help you to get the website up and running in a few minutes without losing visitors.
 Another serious disadvantage is the absence of decent plugins for payment process. That’s why WordPress isn’t recommended for eCommerce stores.
 Lack of creative potential. Even if paid themes are used, this CMS doesn’t allow for developing some truly unique and outstanding project design. For this reason, a website doesn’t stand out from the crowd, which results in high bounce rate and lower search engine conversion.
 Therefore, WordPress is a great platform for creation of minor websites, blogs or corporate stores without online payment methods.
 WordPress plugins for improving your website
Although WordPress already includes a few essential instruments and widgets, its functionality can be extended with the help of plugins. Plugins are installed on WordPress interface (the Plugins section in Control panel).
 There’s a large variety of plugins for any task, and most of them are free. At the moment, WordPress provides over 21,500 plugins that can be sorted by categories, name, or rating.
 Use Akismet to eliminate spam
WordPress leverages visitor comments for users to share their thoughts about your content. This is a useful option for blogs that allows creating your own business community, improving visibility and website rating in the search engines.
 However, as soon as you start drawing the attention of visitors and potential clients, you also attract spammers who can clutter comments with ads and annoying messages. Spam comments are easy to detect, but deleting them takes some time.
 Today, Akismet is the most popular and efficient antispam plugin for WordPress. It detects spam comments automatically, including the messages with links to other websites and useless content. When Akismet detects a spam comment, it blocks it and puts in the spam section to be checked by admin, which prevents website cluttering. Akismet is free for personal blogs, and it’s a non-expensive business solution.
 Automatic search engine optimization with WordPress
As soon as you have your website up and running, there’s a lot of work ahead. Now it’s time to attract visitors! Search engines are a major source of traffic, but you need to gain a decent rating first. To put it simply, the closer is your website to the top of the results page, the more is the chance that someone will visit your pages. SEO (search engine optimization) is website improvement that makes it comprehensible and boosts ranks. A worthy WordPress SEO plugin can provide you with all necessary tools for website optimization.
 One of the most widespread SEO plugins is Yoast. This is a multi-functional plugin that performs automatic SEO optimization and helps the user with that. For example, it offers the most suitable keyword for each page and gives recommendations for raising your position in search engines.
 Find a plugin that suits your website
While some plugins extend the functionality of all widespread content types, other WordPress plugins are developed for certain kinds of websites. The inbuilt WordPress plugin search instrument is very efficient for finding a suitable plugin.
 For example, you can publish your projects on the website using Portfolio plugin. It helps you to generate the portfolio section with projects and descriptions. No matter what kind of content you publish, there’s always a plugin that will help you to upgrade your website.
 Read more to learn about extended WordPress functions and instruments for getting your website to the next level.
 Setting up a blog on a website
Since WordPress was initially created as a blogging instrument, even its latest versions presuppose that your blog is the core of your website. Although having a blog is important, the vast majority of business websites use a different approach: they launch pages as the main content and use blog posts additionally.
 So if you want your home page to be a static one, you can change one setting in the WordPress control panel. First, you need to make sure that you’ve created a static page that will serve as a homepage, and have another page where your blog posts are placed. You can leave the blog page empty since WordPress will receive every message automatically.
 Now proceed to settings and select reading. The first setting defines what’s reflected on the home page. Now you need to select the static page for visitors to see and another page for your blog or news.
 This minor change can make your website look more professional. Besides, you can integrate a widget with the latest messages/posts on the main page – WordPress offers a pattern widget that displays the last posts.
 Some beginners wonder where they can find tutorials and manuals for WordPress website creation. Why you should start learning WordPress, and where to get the educational content.
 Why you should learn WordPress?
WordPress is an exceptional instrument that allows you to create blogs and websites absolutely for free. Both website and blog are equally crucial for business. Here are a few reasons to start learning WordPress right now.
 WordPress can be downloaded from WordPress.org without any charge. Besides, there are millions of educating videos, tutorials, and websites dedicated to WordPress-based website development. To top it off, there are thousands of free themes for customization of website and blog design – they are simple in use and installation.
 WordPress provides thousands of plugins that extend website functionality and help users to create any type of website, be that a coupon aggregator, video website, online casino, etc. WordPress itself and its plugins are updated automatically making maintenance easy as never before.
 The last but not the least is the fact that WordPress boasts free technical support of plugins and themes. It’s the right choice for starters and professionals.
 Let’s observe a few educational material sources for WordPress starters.
 The first thing that springs to user’s mind is the official website WordPress.org: it offers video tutorials and a free forum for users. There’s also a helpdesk where you can leave your questions about WordPress – they’ll be answered by other users online. Most of them are patient and can describe everything in detail.
 The full range of educational materials for mastering WordPress can be found on YouTube.com. Here, you can find a tutorial for any WordPress module or any error people face during WordPress blog creation. Thousands of videos will educate you on using themes, plugins, software and all the rest tools for WordPress website creation. Resources are free, and you can play videos again and again to understand the information better.
 WordPress integration with third-party programs and services
When creating WordPress based web-applications, developers connect them with third-party programs and services via different API. APIs are also used to extend the functionality and user experience of WordPress application. WordPress REST API allows for a more efficient connection between applications and services. Developers use the plugin to get access to other websites and services despite the difference in data form and programming languages.
 JSON data format
For WordPress to interact with software and services by sending and receiving JavaScript Object Notation (JSON) objects, developers can use plugins. JSON is a modern data format. It’s convenient for reading and provides coders and decoders for the vast majority of programming languages. Therefore, WordPress and third-party software suits can exchange data in a mutually comprehensible way. Developers are free to connect WordPress applications to various programs and services by writing a simple JavaScript code.
 REST model
Using the Representational State Transfer model, WordPress has developed a versatile connecting plugin. Aside from simple data format, REST allows developers to use popular HTTP models, such as POST, GET, DELETE и PUT, and facilitates the exchange of data in XML and JSON formats. REST methodology simplifies the interaction between two programs and exchanges data between WordPress apps and other websites and XML and JSON services.
 Compatibility with other programming languages
When creating WordPress-based websites, programmers have to write a PHP code. Today, PHP is the most popular server programming language. However, it lacks a few additional functions provided by modern programming languages, such as Ruby, Java, and C#. For this reason, many developers prefer writing code using modern programming languages. WordPress REST API simplifies the connection of applications with other websites and services regardless of server programming language. Flawless connection eliminates the compatibility issues.
 Simplification of web-application development
WordPress REST API simplifies the creation of web-applications complying with different business demands. Since developers can use a plugin for accessing data and resources of third-party providers, it allows for improving the appearance and functionality of a web application. Some developers can create their own websites without relying on the traditional WordPress interface. They can also use the instrument for the creation of WordPress application in new, more efficient ways.
  Sometimes a person doesn’t have much time and experience of web-development, but needs a website. That’s where a CMS (Content Management System) comes in handy. Such systems feature a convenient interface, useful content management instruments (for instance, visual editors), and tools for website adaptation and improvement. Alternatively, website constructors can be used – they don’t have to be installed because all changes are made online. However, constructor providers force users to use the proprietary hosting because it’s more profitable. Besides, the design of a website made in an online constructor is limited by a few patterns.
0 notes
just4programmers · 7 years ago
Text
Online JSON Tools Review
If you’re a savvy web developer, you have definitely searched on Google for tools like “url decode json” or “convert json to text”. And what do you usually get? You get garbage websites filled with ads, popups, blinking download buttons and tools that don’t really work.
The same problem was faced by Peter K. Rumins from Browserling. He decided to solve this problem once and for all by building a network of tools websites. These sites consist of thousands of simple tools that help to work with JSON, XML, CSV, YAML, PNG, JPG, Strings and even Mathematics. These tools are ads free, there are no configuration options and no ads.
OnlineJSONtools.com is one such website in the network and it helps developers to work with JSON data structures in the browser. The tools are so easy to use that all you have to do is enter JSON input and you instantly get the result you are looking for.
Currently Supported JSON Tools
Below is the list of all the tools that are currently available. Apart from that Browserling team is constantly working to add more tools such as JSON to BSON.
JSON Highlighter tool: JSON highlighter will give each token a different color. Values, keywords, brackets and also to special characters (like newlines, tabs, etc) get special colors. Let’s see a working version of JSON highlighter in an example:
You can see strings, object values and keys are in yellow color, blue color for numerical values, white color for arrays and objects, and grey color for invisible special characters.
It has some additional features that let you control highlighting of JSON:
Shows special characters, as in above example new line is represented by a “downstairs symbol”.
It will care about your matching brackets, it also highlights matching brackets if the cursor is near one.
It also shows the active line in gray color so that you can see more easily on which line the cursor is.
It also tells user not only the line number where is the error but also what is the error by highlighting it as shown in below example.
JSON Prettifier Tool: So here word “prettifier” itself describing this tool. This makes your JSON code well formatted with proper indentation. It will convert an ugly code to beautiful code.
Let’s see the use of the tool on a given problem where you have minified JSON input:
You can see from the above program the code in left block is not indented and not aligned but after using JSON prettifier it aligns the code in proper indentation and you can quickly understand it.
We can also define by the “number of spaces” and “number of tabs” to indent output with spaces and with tabs as shown below.
JSON Minifier Tool: It is a tool which removes all whitespaces and gives a JSON code that takes least space. It’s effective for transmitting less data and making faster web page load time.
JSON Validator Tool: This is an important tool that let you write a valid JSON code. It will point out where is the error and tell the programmer what the error is.
JSON Escaper Tool: JSON escaper helps the programmer to embed JSON in a string as it escapes all special symbols. So now you don’t need to worry about if you forget escape sequence code of any special character, because JSON escaper is here to help you.
JSON Unescaper Tool: JSON unescaper just reverse of the JSON escaper. It will return you a valid JSON object from a string version of JSON object.
JSON to XML Convertor Tool: This tool helps you to easily convert your JSON data into an XML documents and also allow us to make change in indentation for easier reading.
XML to JSON Convertor Tool: This tool gives us a very easy solution of converting an XML data into JSON documents.
JSON to YAML Convertor Tool: It let us convert our JSON structure to its equivalent YAML config file.
YAML to JSON Convertor Tool: A reverse version of JSON to YAML that transpiles YAML data to JSON config.
JSON to TSV Convertor Tool: The main feature of this tool is that it quickly converts our JSON code into text in tab separated values format.
TSV to JSON Convertor Tool: This tool let us do reverse action of previous and convert TSV columns into JSON objects.
JSON to CSV Convertor Tool: JSON to CSV convertor is similar to JSON to TSV but here the output is column separated values.
CSV to JSON Convertor Tool: This tool helps us convert CSV back to JSON in a just one click without installing any application or following any instructions.
JSON to BSON Convertor Tool: This tool helps us to represent our JSON code in binary-encoded format. This increases the efficiency in binary applications.
BSON to JSON Convertor Tool: It allow us to convert BSON, which is binary encoded JSON back to JSON format.
JSON to Image Convertor Tool: It helps to transforms our JSON code into a JPEG, PNG, GIF, BMP image. It basically screenshots the JSON code and gives you back a downloadable image.
JSON to Base64 Tool: It not only allows us to encode our JSON data to base64 code that’s used in webapps.
Base64 to JSON Tool: Simple and easy tool that decodes base64 data back to JSON format.
URL-encode JSON Tool: This is a fantastic tool that encodes our JSON objects into URL-encoding format by escaping all URL characters to percent-number-number format.
URL-decode JSON Tool: This tool transform our data back to JSON format from URL-encoded data by unescaping all URL-encoded sequences to regular characters.
JSON to Plain Text: The main feature of this tool is that it extracts plain text data from JSON code by removing all special JSON symbols and operators.
JSON Editor Tool: It provides us a clear interface in the browser to edit JSON in syntax-highlighted editor.
Upcoming JSON Tools
Mr. Rumins and his team at Browserling is also working on more new JSON tools. Here is the list of tools that will be available soon on the site:
Display JSON Statistics: Provide statistics about JSON objects and their complexity.
Flatten JSON: Flatten deep JSON structures into flat single depth objects.
Obfuscate JSON: Convert JSON to unrecognizable but still valid data.
Convert JSON to a HTML: Create HTML webpage from a JSON code.
Convert JSON to a Bencode: Convert JSON objects to B-encoded data that’s used in bittorrent protocol.
Convert JSON to a Latex Table: Create a Latex table code from a JSON data structure.
Truncate JSON: Cut off excessively large JSON data and make JSON the required length.
Convert JSON to Data URI: Encode JSON so that it can be used in URLs.
Convert JSON To a PHP Array: Create PHP code from JSON code.
Compare Two JSON Files: Compare two JSON files in the browser and find their differences.
If you found JSON tools useful and you would like to have more tools and new JSON features then please tell us know by commenting below.
I would like to thank whole Browserling team for building such handy online tools that is making the work easier for programmers like me and many others. A million and one thanks!
The post Online JSON Tools Review appeared first on The Crazy Programmer.
0 notes
luxus4me · 7 years ago
Link
Envato Tuts+ Code http://j.mp/2BkuAR1
Channels from Pusher is a platform that allows you to give your apps seamless real-time data. 
In this post, I'll show you how to write the functional components of a very simple chat app. It's a stripped-down example, but you'll see how Channels can simplify the implementation of real-time communication in a web app.
Setting Up the Server
Our server application is a single PHP file called messages.php which will handle the POST requests coming from the browser. Our message handler will send the client’s messages to the Channels service, which will then broadcast those messages to other clients.
When using PHP for your server application, you want to download and use the Channels library, and you can install that library using composer and the following command:
composer require pusher/pusher-php-server
The code for messages.php is almost an exact copy of what you can find on the Getting Started page in your Channels dashboard. There are just a few modifications.
First, you need to require the autoload.php file to use the Pusher library:
require './../vendor/autoload.php';
Next, the data coming from the client is in JSON format, so we obviously want to decode it into a workable PHP array.
$data = json_decode(file_get_contents('php://input'), true);
We then want to set up our Pusher object so that we can then trigger an event.
$options = array( 'cluster' => 'us2' ); $pusher = new Pusher\Pusher( '427017da1bd2036904f3', 'c46fabbaf65c4c31686b', '534815', $options );
My PHP installation does not work if the encrypted option is enabled, so I omitted it from my code. Your mileage may vary, but it's important to note that the encrypted option determines whether or not the data sent between the server and Channels is encrypted. It has nothing to do with the connection between Channels and your clients—the client library handles that.
The final line of our server's code sends the message data to Channels:
$pusher->trigger('anon-chat', 'send-message', $data);
As with other server libraries, we pass three things to the trigger() method:
The channel name: anon-chat
The event name: send-message
The payload: $data
Notice that the channel and event names are different than the channel and event names used on the Getting Started page. You do not have to create new channels or define custom events in the dashboard; just use whatever channel and event names you want in your code.
Completing the Client
Our client is a web page with three Vue.js components powering the UI. The main component is called ChannelsChat, and it is where we will put our Pusher object that listens for send-message events in the anon-chat channel. Let's use the created hook.
created() { let pusher = new Pusher('427017da1bd2036904f3', { cluster: 'us2', encrypted: true }); let channel = pusher.subscribe('anon-chat'); channel.bind( 'send-message', function() {} // to be implemented later ); }
In this code, we create the Pusher object, subscribe to the anon-chat channel, and listen for send-message events.
Because this is a chat application, we need to store the message history so that whoever is using the application can see all the messages they received during their session. The easiest way to accomplish this is to store each message as an element in the array. So let's add a messages data property to this component, as shown in the following code:
data() { return { messages: [] } }
Then, when we receive a message, we'll simply push() it to our array, as shown in the following code:
channel.bind( 'send-message', (data) => this.messages.push(data.message) );
We'll then pass the messages to the MessageView component:
<message-view :messages="messages" />
Sending Messages
The last of our code belongs in the MessageSend component; when the user types a message and clicks the Send button, we need to send that data to messages.php.
First, let's make sure the user typed something into the text box. Otherwise, there's no need to do anything!
sendMessage(e) { if (!this.message) { return; } // to be continued...
The message property is bound to the <input/>'s value, so we'll use that to determine if we have any data.
Next, we send the POST request to message.php, and the data is an object with a message property.
// (continued) axios.post('/message.php', { message: this.message }).then(() => { this.message = ''; }).catch((err) => { alert(err); }); }
If the request is successful, we clear the message property's value, which in turn clears the <input/>'s value (remember that they're bound). If the request fails, an alert box tells the user that an error occurred.
That's it for the code. So open two browser windows and point them to index.php. Start sending messages and you should see both windows automatically update and display the messages.
Conclusion
As you can see, Channels makes it incredibly easy to quickly add real-time communication to your applications, and it didn't even require a lot of code! 
You also learned that you can create channels and events on the fly as you write your code. There's no need to set them up prior to using them. 
And finally, you learned how you can set up your applications to incorporate real-time communication. Simply handle incoming user input from your server, and trigger events based on that input.
http://j.mp/2vUHRKZ via Envato Tuts+ Code URL : http://j.mp/2etecmc
0 notes
admeci · 7 years ago
Text
10 Important Features of Advanced PHP
Tumblr media
PHP or Hypertext Preprocessor is a programming language which deals with all the functions on the server-side. PHP is free to use, very easy, and simple to learn. It is the best choice to make websites dynamic with the help of its outstanding features.
It is developed by Rasmus Lerdorf a Danish-Canadian programmer. It is a dynamic type language so there is no need to declare the data type of the variable and all the variables can be used with a symbol $. There are much more features of PHP which should be known by you. So let us start to know about the features of world’s most popular server-side language.
Features of Advanced PHP
1. Database Connectivity
Rather than having your database association settings scattered all over the place, for what reason not simply make one ace record that contains its settings, and afterward incorporate it in your PHP contents? In the event that you have to change subtle elements, later on, you can do it in one record rather than a few documents. This is additionally extremely helpful when you have to utilize different constants and capacities all through various contents. You will always sanitize Data That will go into your Database.
2. Web Services  
A web service is a product framework intended for interoperable collaboration over a system. A web service is characterized by a WSDL (Web Services Description Language) report, and different frameworks associated with the web services utilizing SOAP messages, exchanged utilizing HTTP with an XML serialization. A web service is a theoretical asset that gives an arrangement of capacities and is actualized by an operator, which sends and gets messages.
3. APIs
API extends for "Application Programming Interface".It is a set or decides that enables one bit of programming application to converse with another. Those "rules" includes CRUD operations. Application Programming Interface is a need since this is the lightest method to make, read, refresh or erase data between various applications over the web or HTTP convention. This data is displayed to the client in a moment particularly on the off chance that you utilize JavaScript to render the information on a site page.
4. SPL (Standard PHP Library)
The Standard PHP Library (SPL) is a group of classes and interfaces that are planned to solve the regular issues.
SPL gives an arrangement of standard information structure, an arrangement of iterators to cross over items, an arrangement of interfaces, an arrangement of standard Exceptions, various classes to work with records and it gives an arrangement of capacities like spl_autoload_register()
5. Sessions
Sessions are a straightforward method to store information for singular clients against a one of a kind session ID. This can be utilized to continue state data between page demands. Session IDs are typically sent to the program by means of session treats and the ID is utilized to recover existing session information.
6. Exception handling
Exceptions can be handled by using some keywords in PHP. Keywords for handling all the exceptions. We can use multiple catches for a try block but cannot use multiple tries with a single catch statement. When an exception occurs it creates an object of exception type and throws it to catch statement. Catch statement catch that object and handle it and helps to continue the normal execution of the program. One more keyword is used to handle the exceptions and i.e. throw.
7. Regular Expressions
Regular expressions is a pattern or sequence of characters itself. They give the establishment for pattern-matching functionality. You can search a substring inside another string by using a regular expression, also you can easily replace string by another string and can split a string into substrings. There are two types of Regular Expressions:
POSIX Regular Expressions
PERL Style Regular Expressions
8. Bugs Debugging
There are different ways by which we can display error messages and debug the bugs of the program. To display an error message in the browser, set the property named display_errors configuration directive to On. To send errors to the web server, set the property log_errors to On.  If you want to display the error messages in both places then you can set them both to On.
PHP provides some constants to set the value of error_reporting such that errors of certain types get reported: E_PARSE (parse errors), E_ERROR (fatal errors), E_ALL (for all errors except strict notices), E_WARNING (warnings), E_NOTICE (notices), and E_STRICT (strict notices).
9. PHP & AJAX
Like HTML, you can embed AJAX in PHP to extract the information from the database easily. It is used for fast interactive communication website with a database.
10. JSON Encoding and Decoding
To encode the JSON, json_encode() function is used in PHP. This function represents the data in JSON format and returns a value on success and failure on FALSE. A function named as json_decode() is used for decoding the JSON format in PHP. It returns the value decoded from JSON to PHP type which is appropriate.
Although most of the essential features of PHP are covered in this article but still there is more to explore for you. Web development is a vast sphere where PHP has a significant position. To understand the web development more clearly you need to understand PHP first since it is the backbone of website development. If you have the desire to master this amazing programming language then joining an ideal training institute is truly advisable.
There are many more features of core and advance PHP, so to know more features of PHP in details, you should take classes from ADMEC Multimedia Institute which is one of the reputed PHP training institutes in North  Delhi offers advanced PHP training in Rohini by experienced trainers. Come and explore all the courses to make a bright career in web development with us.
Souurce:- http://admec-multimedia-institute.blogspot.in/2018/05/10-important-features-of-advanced-php.html
0 notes
thelaitkor-blog · 7 years ago
Text
Some must try cool PHP tricks!
PHP involves a series of cool tricks to be practiced. Though the concepts are nothing new yet are easily missed by many. A deeply nested object could be converted to a deeply nested associative array by using it as a substitute on the behaviour of the JSON encode/decode functions.
There are number of tricky trials available in PHP which could make not only the happenings of the event more easy but at the same time it helps in maintaining accuracy.
You can specifically check the accuracy and the fallacy of the project dealt in with. The best part in PHP is that it uses ‘==’ internally almost every time (see ‘in_array’ and ‘switch’ statements below). A trick worth knowing!
1.    $foo = 0
2.    switch ($foo) {
3.     case ‘infinity’ :
4.       eco  ‘lol php’ ;
5.       break ;
6.     Default:
7.       eco ‘php’ is great ;
8.    }
Guess the output!
A number of websites are available for documenting these kind of tricks, only thing you need to do is to google anything like “lol php”. Meanwhile, ‘tricks’, will not be going to benefit you in any ways present in any language. But for it will only annoy people reading or working around you and put them to sufferings.
Apart from these negative elements, long time ago there where some tricks which were actually bind to be good, by some developers having crazy hardware constraints but it was way long ago. Minimize for code readability and in the case of PHP Development Services USA avoid subtle bugs like the ones above and everything related to it will be altogether right.
You should be careful while using ‘get_class()’, or you might end up with results beyond expectation. It has gone to be mostly kind and funny as at the time of need, it is well documented along with everything. Thus it becomes easy to ‘create function()’ and programming on it. These tricks might be unpleasant for the people working on same codebase.
Though you might be knowing a number of PHP tricks, it won’t make you a better developer, since in reality having the knowledge of such tricks would not help you in the improvement or quality of your software. Instead it could also be taken as an opportunity by using it for the decoration of $foo with default values and to replace missing array properties with null arrays. PHP introduces with various amazing string functions, like if you wanted to check the
Accuracy in spellings of common words:
Levenshtein — Manual
Find words sounding in the same way:
Soundex — Manual
Check if the text is similar:
Similar_text — Manual
Another cool part is that you can collapse your pieces of code without putting a break in it. You can individually validate Email Address before doing any effort work. It is featured by a built in function called checkdnsrr() which will specify an email address and check if it resolves as an IP address. This would be a cool act which save your much time, efforts, server resources and just making things very clear and precise, where you could actually able to see the domain and the coexistence of your email address. Rather you can also Switch Off Error Reporting.
When you move into production on your website, you must kill the error reporting. You need not to put all those warning and errors out from there for all mankind to see. Simply set error reporting(0); and rest of all in the world would be absolutely alright.
You should comment your code. If you are not doing so, no one is going to take you seriously as a developer until you act in the same way and must validate all inputs and outputs as this part should be mandatory.
For any queries and doubts regarding the above mentioned tips and tricks, feel free to get in touch with the ready to help support team at Laitkor.
After the following, Lithium Framework is another emerging framework in this category, represented exclusively for PHP 5.3. This one is designed by the original developers of CakePHP who decided to start the newer more advanced framework from scratch. It include the heavily uses of the new features in PHP 5.3, including namespaces, closures, and late static binding and its appearance seemed to be more interesting from the designs perspective. This framework is highly recommended to be dealt in with even for the learning matter or goods coding purpose. It is also having its own database abstraction layer similar to ActiveRecord.
These were some of the frameworks having MVC, templating and database abstraction layer, most among them are based on standard PHP Database Object (PDO) library that comes with PHP. Even if you do not use any of the frameworks, you can generally practice PDO for database access as it helps in improving the readability and portability of your code with fairly modest overhead.
We at Laitkor aim to help our clients in every possible way and in case you get stuck at choosing the right framework for you according to your project, our expert panel can always be there to help you out.
Source: https://www.laitkor.com/some-mus...
0 notes
arduinopebi · 8 years ago
Text
FINAL REPORT : SMART PARKING
Dan berikut kelompok kami persembahkan final report dari tugas besar IMKA SMART PARKING.
Keep reading guys!
1. Identifikasi Masalah
Berikut merupakan masalah yang melatarbelakangi kami untuk membuat Project SmartParking.
1.   Pengendara kesulitan dalam menemukan tempat parkir yang kosong
2.   Pengendara tidak mengetahui apakah masih tersedia parkir atau tidak
3.   Pihak pengelola yang kurang dapat memantau tempat parkir yang mana yang kosong dan berapa jumlahnya
4.   Pihak pengelola yang tidak mengetahui informasi jumlah pengunjung atau traffic pengendara yang menggunakan tempat parkir
2. Alternatif Pemecahan Masalah
2.1  Alternatif Solusi
Dari beberapa permasalahan yang menjadi latar belakang project ini terdapat alternative pemecahannya yang dapat dijelaskan sebagai berikut
Tabel 1. Tabel Alternatif Pemecahan Masalah
Tumblr media
Dari tabel tersebut, dihasilkan sebuah konsep sistem yang dapan digambarkan sebagai berikut.
Tumblr media
Gambar 1. Konsep Smart Parking
2.2  Alternatif Solusi Implementasi
Berikut alternatif pemilihan teknologi untuk implementasi Smart Parking.
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Tabel 2. Tabel Alternatif Solusi Implementasi
3. Spesifikasi Desain
Berikut merupakan komponen yang digunakan pada proyek Smart Parking.
Tumblr media
Gambar 2. Komponen Smart Parking
 Berikut merupakan input-output pada proyek Smart Parking.
Tumblr media
Protocol yang digunakan adalah TCP/IP karena proses upload data menggunakan jaringan internet pada laptop.
4. Desain Perangkat Keras
Berikut skema arduino, sensor, dan display dari sistem Smart Parking 
Tumblr media
Gambar 4. Skema Perangkat Keras Sistem 
Berikut adalah blok diagram dari sistem Smart Parking.
Tumblr media
Gambar 5. Blok DIagram Sistem
5. Desain Perangkat Lunak
Berikut adalah state transition diagram dari sistem Smart Parking.
Tumblr media
Gambar 6. State Transistion Diagram
6. Desain User Interaction
6.1  Tampilan Mobile Application
Berikut adalah tampilan dari mobile application Smart Parking
Tumblr media
Gambar 7. Tampilan Mobile Application
 6.1  Tampilan Web Application
Berikut adalah tampilan dari Web Application Smart Parking
Tumblr media
7. Implementasi Perangkat Keras
Berikut gambar dari implementasi perangkat keras sistem Smart Parking.
Tumblr media
Gambar 8. Implementasi Sistem Smart Parking
8. Implementasi Perangkat Lunak
8.1  Arduino
//Setting Library
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 //Setting Servo
#include <Servo.h>
Servo myservo;
#define ServoM    12                                //Pin servo
#define BarLow    177                               //State servo saat palang pintu menutup
#define BarUp     95                                //State servo saat palang pintu membuka
 //Setting BLYNK
#define BLYNK_PRINT Serial1
#include <BlynkSimpleStream.h>
char auth[] = "8322a75d38ff44ce913d108b69efff42"; //Token untuk koneksi Blynk
 //Setting Blynk LED
WidgetLED ledb1(V5);                               //Virtual LED to show status on App
WidgetLED ledb2(V6);
WidgetLED ledb3(V7);
 //Setting OLED
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
 #define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
 #define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
 B00000001, B11000000,
 B00000001, B11000000,
 B00000011, B11100000,
 B11110011, B11100000,
 B11111110, B11111000,
 B01111110, B11111111,
 B00110011, B10011111,
 B00011111, B11111100,
 B00001101, B01110000,
 B00011011, B10100000,
 B00111111, B11100000,
 B00111111, B11110000,
 B01111100, B11110000,
 B01110000, B01110000,
 B00000000, B00110000 };
 #if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
 //Setting Button
int buttonIn = 10;          //Pin button keluar tempat parkir
int buttonOut = 11;         //Pin button masuk tempat parkir
int Available = 3;          //Initial state jumlah lahan parkir yang tersedia
int buttonStateIn = 0;      //Initial state button masuk tempat parkir
int buttonStateOut = 0;     //Initial state button keluar tempat parkir
  //Setting LED
int led1 = 7;               //Digital Pin LED 1
int led2 = 8;               //Digital Pin LED 2
int led3 = 9;               //Digital Pin LED 3
int state1 = LOW;           //Initial state LED 1
int state2 = LOW;           //Initial state LED 2
int state3 = LOW;           //Initial state LED 3
 //Setting status untuk data yang dikirim ke webhook
int prevstatus1 = 0;        //Status lahan parkir 1 (P1) previous
int prevstatus2 = 0;        //Status lahan parkir 2 (P2) previous
int prevstatus3 = 0;        //Status lahan parkir 3 (P3) previous
int status1 = 0;            //Status lahan parkir 1 (P1) current
int status2 = 0;            //Status lahan parkir 2 (P2) current
int status3 = 0;            //Status lahan parkir 3 (P3) current
 //Setting IR Sensor
int ir1 = 9;                //Analog Pin LED 1
int ir2 = 7;                //Analog Pin LED 2
int ir3 = 8;                //Analog Pin LED 3
 void setup()   {                
 //Debug console
 Serial.begin(9600);
 Blynk.begin(Serial, auth);
   //OLED
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  //Initialize with the I2C addr 0x3C (for the 128x32)
   //LED
 pinMode(led1,OUTPUT);
 pinMode(led2,OUTPUT);
 pinMode(led3,OUTPUT);
   //Button
 pinMode(buttonIn, INPUT);
 pinMode(buttonOut, INPUT);
 digitalWrite(buttonIn, HIGH);               //Connect button in
 digitalWrite(buttonOut, HIGH);              //Connect button out
//Servo
 myservo.attach(ServoM);                     //Attaches the servo
 myservo.write(BarLow);                      //Barrier in the low position
}
 //Scrolling text Smart Parking Area
void testscrolltext(void) {
 display.setTextSize(1);
 display.setTextColor(WHITE);
 display.setCursor(10,0);
 display.clearDisplay();
display.println("WelcomeSmartParking");
 display.println("Sisa Parkir");
 display.println(Available);
 display.display();
 delay(1);
}
 //Membuka gate
void bukaservo(void){
 myservo.write(BarUp);               //Palang pintu terbuka
 delay(3000);
 myservo.write(BarLow);              //Palang pintu tertutup
}
 //Sensor button
void button(int buttonState, int letak){
 if (buttonState == 0)
 {
   if (letak == 1) {                 //Kondisi mobil keluar
     if(Available!=0)
     {
       Available--;
       bukaservo();                  //Buka Gate
       delay(300);
       display.clearDisplay();       //Display OLED
       testscrolltext();
     }  
 } else {                            //Kondisi mobil masuk
   if(Available!=3)
   {
     Available++;
     bukaservo();                    //Buka gate
     delay(300);
     display.clearDisplay();         //Display OLED
     testscrolltext();
   }
 }
}
}
 void loop () {
   Blynk.run();
 testscrolltext();                          //Draw scrolling text
 //Button
 //Membaca input button
 buttonStateIn = digitalRead(buttonIn);    //Membaca state button In
 buttonStateOut = digitalRead(buttonOut);  //Membaca state button Out
   //Button Masuk
 button(buttonStateIn, 0);
   //Buton Keluar
 button(buttonStateOut, 1);
   //Baca IR
 bacaIR();
   //Display value available di Blynk
 Blynk.virtualWrite(V4,Available);
  }
 void bacaIR () {
 int sensorval1 = analogRead(ir1);   //Pin IR1
 int sensorval2 = analogRead(ir2);   //Pin IR2
 int sensorval3 = analogRead(ir3);   //Pin IR3
   //IR1
 if(sensorval1<150) {
   state1=HIGH;
   status1=1;
   ledb1.setValue(255);              //Set Pin V1 on pada Blynk
 } else {
   state1=LOW;
   status1=0;
   ledb1.setValue(0);                //Set Pin V1 off pada Blynk
 }
 digitalWrite(led1, state1);
   //IR2
 if(sensorval2<100) {
   state2=HIGH;
   status2=1;
   ledb2.setValue(255);              //Set Pin V2 on pada Blynk
 } else {
   state2=LOW;
   status2=0;
   ledb2.setValue(0);                //Set Pin V2 off pada Blynk
 }
 digitalWrite(led2, state2);
   //IR3
 if(sensorval3<100) {
   state3=HIGH;
   status3=1;
   ledb3.setValue(255);              //Set Pin V3 on pada Blynk
 } else {
   state3=LOW;
   status3=0;
   ledb3.setValue(0);                //Set Pin V3 off pada Blynk
 }
 digitalWrite(led3, state3);
//Kirim lewat webhook
if ((prevstatus1 != status1) or (prevstatus2 != status2) or (prevstatus3 != status3)) {
 Blynk.virtualWrite(V0, status1, status2, status3);
 prevstatus1 = status1;
 prevstatus2 = status2;
 prevstatus3 = status3;
}
delay(1000);
}
8.1  Kode API
<?php
     date_default_timezone_set('Asia/Jakarta');
       $servername = "localhost";
     $username = "id1585967_smartparking";
     $password = "smartparking";
     $dbname = "id1585967_smartparking";
       //Create connection
     $conn = new mysqli($servername, $username, $password, $dbname);
     $time = "SET `time_zone` = '".date('P')."'";
       if ($conn->query($time) == TRUE) {
           echo "Time set\n";
     } else {
           echo "Error: ".$time."<br>".$conn->error;
     }
       //Check connection
     if ($conn->connect_error){
           die("Connection failed: " . $conn-> connect_error);
     }
     echo "Connected successfully\n";
       if (getenv('REQUEST_METHOD') == 'POST') {
           $parkir = file_get_contents ("php://input");
           $dataParkir = json_decode($parkir, true); //decode JSON to associative array
             print_r($dataParkir);
             $P1 = $dataParkir["P1"];
           $P2 = $dataParkir["P2"];
           $P3 = $dataParkir["P3"];
           $Jumlah =  $P1+$P2+$P3;
             //Query SQL
           $lahan = "INSERT INTO LahanParkir (Waktu, Lahan1, Lahan2, Lahan3, Jumlah) VALUES (NOW()+INTERVAL 7 HOUR, $P1, $P2, $P3, $Jumlah)";
           if ($conn->query($lahan) == TRUE) {
                 echo "New record created successfully";
           } else {
                 echo "Error: ".$lahan."<br>".$conn->error;
           }
     }
       $conn->close();
?>
8.1  Web APP
<html>
     <body style = "background-color : #F0FFFF;">
     <head>
           <h1 align = "center">
           <img src="smartpark.png"></h1>
           <style>
                 table {
                       border-collapse: collapse;
                       width: 60%;
                 }
                   th, td {
                       text-align: center;
                       padding: 3px;
                       font-size: 20px;
                 }
                   tr:nth-child(even){background-color: #f2f2f2}
                   th {
                       background-color: #20B2AA;
                       color: white;
                 }
                 .button {
            display: inline-block;
            padding: 8px 18px;
            font-size: 13px;
            cursor: pointer;
            text-align: center;  
            text-decoration: none;
            outline: none;
            color: #fff;
            background-color: #20B2AA;
            border: none;
            border-radius: 8px;
            box-shadow: 0 6px #999;
           }
             .button:hover {background-color: #3e8e41}
             .button:active {
            background-color: #3e8e41;
            box-shadow: 0 2px #666;
            transform: translateY(4px);
           }
           </style>
     </head>
        <h2 style = "background-color : #2F4F4F" align="center">
     <font face="arial" size ="5" color ="white">DATA LAHAN PARKIR</font></h2>
       <span style="float:right;">
                 <div align="right">
                       <font size="5"><b>Tempat Parkir Kosong<br><br></b></font>
     <?php
           $servername = "localhost";
           $username = "id1585967_smartparking";
           $password = "smartparking";
           $dbname = "id1585967_smartparking";
           //Create connection
           $conn = new mysqli($servername, $username, $password, $dbname);
           $kosong =mysqli_query($conn, "SELECT Jumlah FROM LahanParkir WHERE ID = (SELECT MAX(ID) FROM LahanParkir)");
           $row1 = mysqli_fetch_assoc($kosong);
           $isinya = 3 - $row1['Jumlah'];
           echo "<div style ='font-size:50px;color:#000000'> $isinya </div>";
     ?>
                 </div>                  
     </span>
     <span style="float:left;">
           <div align="left">
                 <font size="5"><b>Total Kendaraan<br><br></b></font>
     <?php
           $kendaraan =mysqli_query($conn, "SELECT SUM(Jumlah) AS Jumlah FROM LahanParkir");
           $row = mysqli_fetch_assoc($kendaraan);
           $row1= $row['Jumlah'];
           echo "<div style ='font-size:50px;color:#000000'> $row1 </div>";
     ?>
           </div>
     </span>
     <table align="center">
           <thead>
                 <th>Waktu</th>
                 <th>Parkir 1</th>
                 <th>Parkir 2</th>
                 <th>Parkir 3</th>
           </thead>
           <?php
                 $result =mysqli_query ($conn, "SELECT * FROM LahanParkir");
                 foreach ($result as $row){  
                 echo "<tr>";
                 echo "<td>".$row['Waktu']."</td>";
                 echo "<td>".$row['Lahan1']."</td>";
                 echo "<td>".$row['Lahan2']."</td>";
                 echo "<td>".$row['Lahan3']."</td>";
                 echo "</tr>";
                 }
                 echo "</table>";
                 $conn->close();
           ?>
           </table>
           <br>
     </body>
</html>
Berikut merupakan pengaturan pada Blynk untuk LED yang menunjukkan tempat parkir terisi atau kosong. Ada 2 lainnya yang sejenis, yaitu P2 dan P3(berbeda pin).
Tumblr media
Gambar 9. Konfigurasi P1 Pada Blynk App
Berikut merupakan pengaturan pada Blynk untuk menampilkan sisa lahan parkir.
Tumblr media
Gambar 10. Konfigurasi Sisa Lahan pada Blynk App
Berikut pmerupakan pengaturan webhook pada Blynk. URL merupakan link API untuk melakukan POST ke database.
Gambar 11. Konfigurasi API pada Blynk App
9. Pengujian
Pengujian terhadap sistem SMART PARKING dilakukan dengan metode pengujian Black Box. Hasil pengujian yang diperoleh adalah sebagai berikut:
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
10. Kesimpulan dan Saran
Project Smart Parking dapat menjawab permasalahan di awal karena project ini dapat memberikan informasi ketersediaan lahan parkir serta dapat pula memberikan informasi lahan parkir yang kosong melalui Aplikasi dan Website. Project ini juga dapat memberikan informasi kepada pengelola mengenai traffic area parkir sehingga dapat digunakan lebih lanjut untuk keperluan pengelola. Ke depannya, kami berharap agar project ini dapat dikembangkan lagi sehingga semakin dapat memberikan kepuasan pada pengguna area parkir.
0 notes
devitarduino-blog · 8 years ago
Text
Smart Parking Report
Akhirnya Smart Parking sudah siap untuk didemokan :) Semoga hasilnya memuaskan yaa..
Di post kali ini akan ditampilkan Smart Parking Final Report untuk memudahkan pembaca dalam memahami Smart Parking System ini. Yukk kita mulai dari ...
1. Identifikasi Masalah
Masalah yang menjadi fokus kami mengenai tempat parkir sekarang ini adalah sebagai berikut.
- Pengendara kesulitan dalam menemukan tempat parkir yang kosong
- Pengendara yang tidak mengetahui apakah masih tersedia parkir atau tidak
- Pihak pengelola yang kurang dapat memantau tempat parkir mana yang kosong dan berapa jumlahnya
- Pihak pengelola yang tidak mengetahui informasi jumlah pengunjung atau traffic pengendara yang menggunakan tempat parkir
2. Alternatif Pemecahan Masalah
Dari permasalahan diatas kami menemukan alternatif pemecahan masalah sebagai berikut.
Tumblr media Tumblr media
Dari kesimpulan mengenai alternatif solusi yang akan diterapkan terciptalah sistem Smart Parking dengan sub-sistem sebagai berikut.
Tumblr media
Dalam mencari teknologi untuk mengimplementasikan Smart Parking System kami melakukan beberapa pertimbangan sebagai berikut.
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
3. Spesifikasi Desain
Dari hasil pertimbangan dalam memilih teknologi atau komponen untuk mengembangkan Smart Parking berikut komponen-komponen yang akan digunakan.
Tumblr media
Untuk input dan output dari tiap komponen, berikut penjelasannya.
Tumblr media
Untuk rencana implementasi tempat parkir, kami telah merancang tempat parkir yang akan dibuat sebagai berikut.
Tumblr media
4. Desain Perangkat Keras
Dalam menyusun semua komponen perangkat keras yang dipakai dalam Smart Parking ini, kami menggunakan skema sebagai berikut.
Tumblr media
Agar dapat memahami kerja sistem secara keseluruhan, berikut blok diagram sistem Smart Parking.
Tumblr media
5. Desain Perangkat Lunak
Agar lebih mudah dalam memahami project ini, akan diperlihatkan state diagram yang menggambarkan state dari komponen-komponen yang dipakai beserta kondisinya.
Tumblr media
6. Desain User Interaction
Karena kami menggunakan mobile dan web app berikut tampilan dari kedua aplikasi tersebut.
- Mobile app
Tumblr media
- Web app
Tumblr media
7. Implementasi Perangkat Keras
Berikut implementasi perangkat keras dari Smart Parking.
Tumblr media
8. Implementasi Perangkat Lunak
Berikut kode-kode yang dipakai dalam implementasi Smart Parking ini.
- Kode untuk upload pada Arduino (Bismillah.ino)
//Setting Library #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h>
//Setting Servo #include <Servo.h> Servo myservo; #define ServoM    12                                //Pin servo #define BarLow    177                               //State servo saat palang pintu menutup #define BarUp     95                                //State servo saat palang pintu membuka
//Setting BLYNK #define BLYNK_PRINT Serial1 #include <BlynkSimpleStream.h> char auth[] = "8322a75d38ff44ce913d108b69efff42";  //Token untuk koneksi Blynk
//Setting Blynk LED WidgetLED ledb1(V5);                               //Virtual LED to show status on App WidgetLED ledb2(V6); WidgetLED ledb3(V7);
//Setting OLED #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH  16 static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000,  B00000001, B11000000,  B00000001, B11000000,  B00000011, B11100000,  B11110011, B11100000,  B11111110, B11111000,  B01111110, B11111111,  B00110011, B10011111,  B00011111, B11111100,  B00001101, B01110000,  B00011011, B10100000,  B00111111, B11100000,  B00111111, B11110000,  B01111100, B11110000,  B01110000, B01110000,  B00000000, B00110000 };
#if (SSD1306_LCDHEIGHT != 32) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif
//Setting Button int buttonIn = 10;          //Pin button keluar tempat parkir int buttonOut = 11;         //Pin button masuk tempat parkir int Available = 3;          //Initial state jumlah lahan parkir yang tersedia int buttonStateIn = 0;      //Initial state button masuk tempat parkir int buttonStateOut = 0;     //Initial state button keluar tempat parkir
//Setting LED int led1 = 7;               //Digital Pin LED 1 int led2 = 8;               //Digital Pin LED 2 int led3 = 9;               //Digital Pin LED 3 int state1 = LOW;           //Initial state LED 1 int state2 = LOW;           //Initial state LED 2 int state3 = LOW;           //Initial state LED 3
//Setting status untuk data yang dikirim ke webhook int prevstatus1 = 0;        //Status lahan parkir 1 (P1) previous int prevstatus2 = 0;        //Status lahan parkir 2 (P2) previous int prevstatus3 = 0;        //Status lahan parkir 3 (P3) previous int status1 = 0;            //Status lahan parkir 1 (P1) current int status2 = 0;            //Status lahan parkir 2 (P2) current int status3 = 0;            //Status lahan parkir 3 (P3) current
//Setting IR Sensor int ir1 = 9;                //Analog Pin LED 1 int ir2 = 7;                //Analog Pin LED 2 int ir3 = 8;                //Analog Pin LED 3
void setup()   {                  //Debug console  Serial.begin(9600);  Blynk.begin(Serial, auth);
 //OLED  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  //Initialize with the I2C addr 0x3C (for the 128x32)
 //LED  pinMode(led1,OUTPUT);  pinMode(led2,OUTPUT);  pinMode(led3,OUTPUT);
 //Button  pinMode(buttonIn, INPUT);  pinMode(buttonOut, INPUT);  digitalWrite(buttonIn, HIGH);               //Connect button in  digitalWrite(buttonOut, HIGH);              //Connect button out
//Servo  myservo.attach(ServoM);                     //Attaches the servo  myservo.write(BarLow);                      //Barrier in the low position }
//Scrolling text Smart Parking Area void testscrolltext(void) {  display.setTextSize(1);  display.setTextColor(WHITE);  display.setCursor(10,0);  display.clearDisplay();  display.println("WelcomeSmartParking");  display.println("Sisa Parkir");  display.println(Available);  display.display();  delay(1); }
//Membuka gate void bukaservo(void){  myservo.write(BarUp);               //Palang pintu terbuka  delay(3000);  myservo.write(BarLow);              //Palang pintu tertutup }
//Sensor button void button(int buttonState, int letak){  if (buttonState == 0)  {    if (letak == 1) {                 //Kondisi mobil keluar      if(Available!=0)      {        Available--;        bukaservo();                  //Buka Gate        delay(300);        display.clearDisplay();       //Display OLED        testscrolltext();      }    } else {                            //Kondisi mobil masuk    if(Available!=3)    {      Available++;      bukaservo();                    //Buka gate      delay(300);      display.clearDisplay();         //Display OLED      testscrolltext();    }  } } }
void loop () {
 Blynk.run();  testscrolltext();                          //Draw scrolling text
 //Button  //Membaca input button  buttonStateIn = digitalRead(buttonIn);    //Membaca state button In  buttonStateOut = digitalRead(buttonOut);  //Membaca state button Out
 //Button Masuk  button(buttonStateIn, 0);
 //Buton Keluar  button(buttonStateOut, 1);
 //Baca IR  bacaIR();
 //Display value available di Blynk  Blynk.virtualWrite(V4,Available);
}
void bacaIR () {  int sensorval1 = analogRead(ir1);   //Pin IR1  int sensorval2 = analogRead(ir2);   //Pin IR2  int sensorval3 = analogRead(ir3);   //Pin IR3
 //IR1  if(sensorval1<150) {    state1=HIGH;    status1=1;    ledb1.setValue(255);              //Set Pin V1 on pada Blynk  } else {    state1=LOW;    status1=0;    ledb1.setValue(0);                //Set Pin V1 off pada Blynk  }  digitalWrite(led1, state1);
 //IR2  if(sensorval2<100) {    state2=HIGH;    status2=1;    ledb2.setValue(255);              //Set Pin V2 on pada Blynk  } else {    state2=LOW;    status2=0;    ledb2.setValue(0);                //Set Pin V2 off pada Blynk  }  digitalWrite(led2, state2);
 //IR3
 if(sensorval3<100) {    state3=HIGH;    status3=1;    ledb3.setValue(255);              //Set Pin V3 on pada Blynk  } else {    state3=LOW;    status3=0;    ledb3.setValue(0);                //Set Pin V3 off pada Blynk  }  digitalWrite(led3, state3);
//Kirim lewat webhook if ((prevstatus1 != status1) or (prevstatus2 != status2) or (prevstatus3 != status3)) {  Blynk.virtualWrite(V0, status1, status2, status3);  prevstatus1 = status1;  prevstatus2 = status2;  prevstatus3 = status3; } delay(1000); }
- Web API (posthandler.php)
<?php date_default_timezone_set('Asia/Jakarta');
$servername = "localhost"; $username = "id1585967_smartparking"; $password = "smartparking"; $dbname = "id1585967_smartparking";
//Create connection $conn = new mysqli($servername, $username, $password, $dbname); $time = "SET `time_zone` = '".date('P')."'";
if ($conn->query($time) == TRUE) { echo "Time set\n"; } else { echo "Error: ".$time."<br>".$conn->error; }
//Check connection if ($conn->connect_error){ die("Connection failed: " . $conn-> connect_error); } echo "Connected successfully\n";
if (getenv('REQUEST_METHOD') == 'POST') { $parkir = file_get_contents ("php://input"); $dataParkir = json_decode($parkir, true); //decode JSON to associative array
print_r($dataParkir);
$P1 = $dataParkir["P1"]; $P2 = $dataParkir["P2"]; $P3 = $dataParkir["P3"]; $Jumlah =  $P1+$P2+$P3;
//Query SQL $lahan = "INSERT INTO LahanParkir (Waktu, Lahan1, Lahan2, Lahan3, Jumlah) VALUES (NOW()+INTERVAL 7 HOUR, $P1, $P2, $P3, $Jumlah)"; if ($conn->query($lahan) == TRUE) { echo "New record created successfully"; } else { echo "Error: ".$lahan."<br>".$conn->error; } }
$conn->close(); ?>
- Web App (index.php)
<html> <body style = "background-color : #F0FFFF;"> <head> <h1 align = "center"> <img src="smartpark.png"></h1> <style> table { border-collapse: collapse; width: 60%; }
th, td { text-align: center; padding: 3px; font-size: 20px; }
tr:nth-child(even){background-color: #f2f2f2}
th { background-color: #20B2AA; color: white; } .button {  display: inline-block;  padding: 8px 18px;  font-size: 13px;  cursor: pointer;  text-align: center;  text-decoration: none;  outline: none;  color: #fff;  background-color: #20B2AA;  border: none;  border-radius: 8px;  box-shadow: 0 6px #999; }
.button:hover {background-color: #3e8e41}
.button:active {  background-color: #3e8e41;  box-shadow: 0 2px #666;  transform: translateY(4px); } </style> </head>
<h2  style = "background-color : #2F4F4F" align="center"> <font face="arial" size ="5" color ="white">DATA LAHAN PARKIR</font></h2>
<span style="float:right;"> <div align="right"> <font size="5"><b>Tempat Parkir Kosong<br><br></b></font> <?php $servername = "localhost"; $username = "id1585967_smartparking"; $password = "smartparking"; $dbname = "id1585967_smartparking"; //Create connection $conn = new mysqli($servername, $username, $password, $dbname); $kosong =mysqli_query($conn, "SELECT Jumlah FROM LahanParkir WHERE ID = (SELECT MAX(ID) FROM LahanParkir)"); $row1 = mysqli_fetch_assoc($kosong); $isinya = 3 - $row1['Jumlah']; echo "<div style ='font-size:50px;color:#000000'> $isinya </div>"; ?> </div> </span> <span style="float:left;"> <div align="left"> <font size="5"><b>Total Kendaraan<br><br></b></font> <?php $kendaraan =mysqli_query($conn, "SELECT SUM(Jumlah) AS Jumlah FROM LahanParkir"); $row = mysqli_fetch_assoc($kendaraan); $row1= $row['Jumlah']; echo "<div style ='font-size:50px;color:#000000'> $row1 </div>"; ?> </div> </span> <table align="center"> <thead> <th>Waktu</th> <th>Parkir 1</th> <th>Parkir 2</th> <th>Parkir 3</th> </thead>
<?php $result =mysqli_query ($conn, "SELECT * FROM LahanParkir"); foreach ($result as $row){   echo "<tr>"; echo "<td>".$row['Waktu']."</td>"; echo "<td>".$row['Lahan1']."</td>"; echo "<td>".$row['Lahan2']."</td>"; echo "<td>".$row['Lahan3']."</td>"; echo "</tr>"; } echo "</table>"; $conn->close(); ?> </table> <br> </body> </html>
9. Pengujian
Berikut daftar pengujian yang kami lakukan.
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
10. Kesimpulan dan Saran
0 notes
xenleaksinc · 6 years ago
Text
XenForo 2.0.12 With Branding Removal
This version makes a number of changes to improve compatibility with PHP 7.3.0. However, at this time, we do not recommend using PHP 7.3.0 in production due to a bug that can cause code to execute incorrectly, potentially leading to data loss. We believe this bug will be resolved in PHP 7.3.1 when it's released. Some of the changes in XF 2.0.12 include:
Improve PHP 7.3 compatibility.
If available and different from the server version, grab a more detailed version for the Server environment report.
If the $_SERVER['SERVER_SOFTWARE'] value isn't available or valid then just don't display that entry in the report, because it's mostly not essential.
Adds some additional phrases for the "Server environment report"
Fix an issue which affects building add-on releases on Windows where local paths included a leading slash.
Incrementally update the job state of the Sitemap job so that a fatal error shouldn't disrupt the process and introduce corrupted/duplicate items.
Adjust error message given when attempting to edit a user's permissions for a content type without a valid user_id.
Standardize the locale information used by PHP.
Use a different approach to loading icons on the add-ons list in the Admin CP. To avoid issues with multiple database connections, the icon image data is instead converted to a data URI.
User upgrades should not check canPurchase() before processing a payment that has been received, as this method is really only for limiting the UI/purchase setup.
Add some additional trusted IP ranges for Google.
Ensure 'nullable' entity property is reflected in generated code
Ensure node navigation entries use their assigned title
Ignore custom field errors during admin edit and include custom field title with errors
Convert warning notes field to structured text
Correctly apply admin user message leave options
Prevent new messages being duplicated in Firefox
Ensure multi quote quotes are inserted into the correct editor
Hide 'Start a new conversation' link if visitor doesn't have permission to start conversations.
Allow permanent redirects to be stickied and unstickied.
Ensure xfagenav tags use correct router.
Remove extra save call when ignoring member
Remove UTC check from server environment report and link PHP version to phpinfo page
Prevent loading of Setup.php if addon.json requirements aren't met
Make xf-dev:entity-class-properties CLI command correctly handle subdirectories
Return 'complete' response from UserGroupPromotion job if no active promotions are found.
Ensure 'From name' and 'From email' fields are applied when batch emailing users
Hide editor draft menu from guests
Ensure cron entries run at zero valued time units if multiple time values are selected.
Check for missing hash in IPSForums3x authentication handler.
Add missing hint parameter to discouraged checkbox on user edit page
Remove invalid relation from SpamTriggerLog entity
Use content type phrase when rebuilding the search index
Fix incorrect URL on conversation message likes list
Fix broken 'Delay duration' option for floating notices
Allow invalid users to be unfollowed
Re-add explain text in the user_edit form to clarify non-valid user states behaviour.
Include table name in message for any exception occurring in SchemaManager methods.
Implement custom stack trace builder to mask passwords in method arguments
Add deleted item styling to news feed items
When restoring spam cleaned threads, ensure threads which were originally moved are restored back to the correct forum.
Return an error phrase upon invalid callback validation when performing spam clean actions. Note that the method name switches to ucfirst(\XF\Util\Php::camelCase($action)) in XF 2.1 but remains as ucfirst($action) in XF 2.0.
When handling a Stripe webhook that is missing required metadata, when attempting to find a previous related log, ensure said log actually contains a purchase_request_key.
Improve BB code parsing of incomplete tags within plain-child tags.
Migrate user field criteria during upgrade from XF 1.x to 2.x
By default, do not allow cookies to be retrieved as arrays to prevent unexpected behavior. (Array support can now be opted into explicitly.)
Prevent an error when trying to delete a payment profile when there is an invalid purchasable definition.
Track when a preview is pending to prevent multiple simultaneous preview loads.
Prevent a PHP notice when deleting a poll for a thread started by a guest
Include breadcrumb in edit history view and compare templates.
Pass unused $ellipsis variable into wholeWordTrim.
Prevent long select options from causing overflow on iOS.
Enable the HTML to BB code simplification process to handle additional situations
Resolve some situations where the new messages indications while composing a reply wouldn't take you to the expected location.
Validate advertisement html before saving.
Prevent tel/sms links being converted to bbcode
Remove the insert icode option when extended text formatting is disabled. Allow end user modification to the "allow this BB code in signatures" option on add-on-defined custom BB codes.
Call the canPurchase method instead of can_purchase in UserUpgrade::getFilteredUserUpgradesForList.
Correctly combine multiple custom field-related limits to the user and thread searchers.
Correctly apply the "not in secondary groups" user search condition (users cannot be in any of the listed groups).
When building a release and testing a JSON, only consider an error if decoding the build.json does not return an array.
When submitting spammers to StopForumSpam, convert binary IP address to readable string.
When saving style templates through the admin UI, force version/last_edit_date to be updated like XF 1.x
When merging threads, always redirect to the target thread.
Fix currency code for Belarusian Ruble (BYR => BYN)
No longer cache the preview container object in the PreviewClick handler. If there are multiple handlers per page, the cached container becomes incorrect if using different handlers.
When form filling, if the control is a textarea with a textarea-handler, trigger its update method to ensure the textarea is resized appropriately.
Prevent an array-to-string conversion when throwing a bulkInsert exception if a missing column is detected.
Ensure that the user following cache cannot include your own user ID.
Add missing mod_log.thread_poll_reset phrase.
Attempt to exclude dot files/directories from our vendor dependencies.
Number boxes are too wide and cause units to overflow their container, fixed with max-width.
Add "Please do not reply to this message" text to outgoing conversation emails.
Reassign user group changes when merging users
Ensure PasswordChange service errors on any UserAuth error.
Fetch more threads for new threads widget
Ensure exceptions in sub-processes stop execution, and always exit with non-zero error code on error.
Make Disabler system compatible with select options.
Ensure FieldAdder handles Disabler elements correctly
Ensure prefix of destination thread is shown in moved post alert.
Trigger change event on select when prefix selected
Remove the "mixed" stuff from CodeMirror's PHP mode so that the opening tag is no longer required.
Update broken link to Apple support in cookie help page text (and in XF 1.5).
Adjust top border radii of blocks within overlays.
Allow non-user selectable styles to be used for the email style. Also, add several email-related style properties to allow email colors to be overridden more directly, without creating a new style.
Implement a "notice watcher" system for bottom fixed notices. This calculates the total visible notice height in the bottom fix location and adds a footer margin to the same value so that no content can be covered by the notice(s).
Adjust how we parse search query modifiers to be more strict. (- and + require whitespace before and none after, | requires whitespace on both sides. Don't parse doubled up modifiers.)
Adjust trophies phrase capitalization
Include no_date_limit in the rel=canonical link for forums when needed
Attempt to reduce cases where conversation reply_count values could potentially get out of sync. Allow the reply count and other parts to be rebuilt via the conversation rebuild tool.
By default, reject email addresses as invalid if there are no dots in the domain part.
Add a bit of left padding on contentRow-suffix elements.
Include the forum a thread is in in the RSS feeds (only for global feeds)
Fix add-on development data not being removed as expected when the last entry of a type has been removed. (The metadata JSON file must still exist.)
Relax URL validation a tiny bit, notably don't block adjacent path separators in the path section.
Ensure phrase is escaped in HTML attribute.
Ensure usage of phrase within HTML attribute is escaped.
In the AbstractSearcher ensure that the day end value is converted properly to the end of the day.
Never allow the XF add-on to appear in add-on lists.
Handle avatar deletes via the spam cleaner for gravatars too.
Make add-on action finalization more robust when uninstalling legacy add-ons.
When importing dev output, ignore any invalid columns.
Add some block border radius to the member header block so that it fits within its parent block.
Ensure permissions are rebuilt on add-on active change.
Update child navigation entries directly when the parent ID changes to ensure dev output is written correctly.
Use the correct maxlength value for the public navigation structure. Additionally, bump AdminNavigation ID lengths up to 50 from 25.
Add support for partial indexes to schema manager conflict resolution system
Fix multiple issues that make it hard to use XF\Import\Data\AbstractEntityData
Consistently use code paths which result in the canView method of the report entity (rather than the handler) being used.
The following public templates have had changes:
account_upgrades
core_contentrow.less
core_input.less
core_overlay.less
editor_base.less
edit_history_compare
edit_history_view
forum_view
PAGE_CONTAINER
quick_reply_macros
thread_save_draft
warning_info
XenForo 2.0.12 Branding Removal Nulled.zip
source https://xenforoleaks.com/topic/309-xenforo-2012-with-branding-removal/
0 notes
xenleaksinc · 6 years ago
Text
XenForo 2.0.12 - Full Install
XenForo 2.0.12 is now available for all licensed customers to download. We recommend that all customers running previous versions of XenForo 2.0 upgrade to this release to benefit from increased stability. This version makes a number of changes to improve compatibility with PHP 7.3.0. However, at this time, we do not recommend using PHP 7.3.0 in production due to a bug that can cause code to execute incorrectly, potentially leading to data loss. We believe this bug will be resolved in PHP 7.3.1 when it's released. Download XenForo 2.0.12 Some of the changes in XF 2.0.12 include: Improve PHP 7.3 compatibility. If available and different from the server version, grab a more detailed version for the Server environment report. If the $_SERVER['SERVER_SOFTWARE'] value isn't available or valid then just don't display that entry in the report, because it's mostly not essential. Adds some additional phrases for the "Server environment report" Fix an issue which affects building add-on releases on Windows where local paths included a leading slash. Incrementally update the job state of the Sitemap job so that a fatal error shouldn't disrupt the process and introduce corrupted/duplicate items. Adjust error message given when attempting to edit a user's permissions for a content type without a valid user_id. Standardize the locale information used by PHP. Use a different approach to loading icons on the add-ons list in the Admin CP. To avoid issues with multiple database connections, the icon image data is instead converted to a data URI. User upgrades should not check canPurchase() before processing a payment that has been received, as this method is really only for limiting the UI/purchase setup. Add some additional trusted IP ranges for Google. Ensure 'nullable' entity property is reflected in generated code Ensure node navigation entries use their assigned title Ignore custom field errors during admin edit and include custom field title with errors Convert warning notes field to structured text Correctly apply admin user message leave options Prevent new messages being duplicated in Firefox Ensure multi quote quotes are inserted into the correct editor Hide 'Start a new conversation' link if visitor doesn't have permission to start conversations. Allow permanent redirects to be stickied and unstickied. Remove extra save call when ignoring member Remove UTC check from server environment report and link PHP version to phpinfo page Prevent loading of Setup.php if addon.json requirements aren't met Make xf-dev:entity-class-properties CLI command correctly handle subdirectories Return 'complete' response from UserGroupPromotion job if no active promotions are found. Ensure 'From name' and 'From email' fields are applied when batch emailing users Hide editor draft menu from guests Ensure cron entries run at zero valued time units if multiple time values are selected. Check for missing hash in IPSForums3x authentication handler. Add missing hint parameter to discouraged checkbox on user edit page Remove invalid relation from SpamTriggerLog entity Use content type phrase when rebuilding the search index Fix incorrect URL on conversation message likes list Fix broken 'Delay duration' option for floating notices Allow invalid users to be unfollowed Re-add explain text in the user_edit form to clarify non-valid user states behaviour. Include table name in message for any exception occurring in SchemaManager methods. Implement custom stack trace builder to mask passwords in method arguments Add deleted item styling to news feed items When restoring spam cleaned threads, ensure threads which were originally moved are restored back to the correct forum. Return an error phrase upon invalid callback validation when performing spam clean actions. Note that the method name switches to ucfirst(\XF\Util\Php::camelCase($action)) in XF 2.1 but remains as ucfirst($action) in XF 2.0. When handling a Stripe webhook that is missing required metadata, when attempting to find a previous related log, ensure said log actually contains a purchase_request_key. Improve BB code parsing of incomplete tags within plain-child tags. Migrate user field criteria during upgrade from XF 1.x to 2.x By default, do not allow cookies to be retrieved as arrays to prevent unexpected behavior. (Array support can now be opted into explicitly.) Prevent an error when trying to delete a payment profile when there is an invalid purchasable definition. Track when a preview is pending to prevent multiple simultaneous preview loads. Prevent a PHP notice when deleting a poll for a thread started by a guest Include breadcrumb in edit history view and compare templates. Pass unused $ellipsis variable into wholeWordTrim. Prevent long select options from causing overflow on iOS. Enable the HTML to BB code simplification process to handle additional situations Resolve some situations where the new messages indications while composing a reply wouldn't take you to the expected location. Validate advertisement html before saving. Prevent tel/sms links being converted to bbcode Remove the insert icode option when extended text formatting is disabled. Allow end user modification to the "allow this BB code in signatures" option on add-on-defined custom BB codes. Call the canPurchase method instead of can_purchase in UserUpgrade::getFilteredUserUpgradesForList. Correctly combine multiple custom field-related limits to the user and thread searchers. Correctly apply the "not in secondary groups" user search condition (users cannot be in any of the listed groups). When building a release and testing a JSON, only consider an error if decoding the build.json does not return an array. When submitting spammers to StopForumSpam, convert binary IP address to readable string. When saving style templates through the admin UI, force version/last_edit_date to be updated like XF 1.x When merging threads, always redirect to the target thread. Fix currency code for Belarusian Ruble (BYR => BYN) No longer cache the preview container object in the PreviewClick handler. If there are multiple handlers per page, the cached container becomes incorrect if using different handlers. When form filling, if the control is a textarea with a textarea-handler, trigger its update method to ensure the textarea is resized appropriately. Prevent an array-to-string conversion when throwing a bulkInsert exception if a missing column is detected. Ensure that the user following cache cannot include your own user ID. Add missing mod_log.thread_poll_reset phrase. Attempt to exclude dot files/directories from our vendor dependencies. Number boxes are too wide and cause units to overflow their container, fixed with max-width. Add "Please do not reply to this message" text to outgoing conversation emails. Reassign user group changes when merging users Ensure PasswordChange service errors on any UserAuth error. Fetch more threads for new threads widget Ensure exceptions in sub-processes stop execution, and always exit with non-zero error code on error. Make Disabler system compatible with select options. Ensure FieldAdder handles Disabler elements correctly Ensure prefix of destination thread is shown in moved post alert. Trigger change event on select when prefix selected Remove the "mixed" stuff from CodeMirror's PHP mode so that the opening tag is no longer required. Update broken link to Apple support in cookie help page text (and in XF 1.5). Adjust top border radii of blocks within overlays. Allow non-user selectable styles to be used for the email style. Also, add several email-related style properties to allow email colors to be overridden more directly, without creating a new style. Implement a "notice watcher" system for bottom fixed notices. This calculates the total visible notice height in the bottom fix location and adds a footer margin to the same value so that no content can be covered by the notice(s). Adjust how we parse search query modifiers to be more strict. (- and + require whitespace before and none after, | requires whitespace on both sides. Don't parse doubled up modifiers.) Adjust trophies phrase capitalization Include no_date_limit in the rel=canonical link for forums when needed Attempt to reduce cases where conversation reply_count values could potentially get out of sync. Allow the reply count and other parts to be rebuilt via the conversation rebuild tool. By default, reject email addresses as invalid if there are no dots in the domain part. Add a bit of left padding on contentRow-suffix elements. Include the forum a thread is in in the RSS feeds (only for global feeds) Fix add-on development data not being removed as expected when the last entry of a type has been removed. (The metadata JSON file must still exist.) Relax URL validation a tiny bit, notably don't block adjacent path separators in the path section. Ensure phrase is escaped in HTML attribute. Ensure usage of phrase within HTML attribute is escaped. In the AbstractSearcher ensure that the day end value is converted properly to the end of the day. Never allow the XF add-on to appear in add-on lists. Handle avatar deletes via the spam cleaner for gravatars too. Make add-on action finalization more robust when uninstalling legacy add-ons. When importing dev output, ignore any invalid columns. Add some block border radius to the member header block so that it fits within its parent block. Ensure permissions are rebuilt on add-on active change. Update child navigation entries directly when the parent ID changes to ensure dev output is written correctly. Use the correct maxlength value for the public navigation structure. Additionally, bump AdminNavigation ID lengths up to 50 from 25. Add support for partial indexes to schema manager conflict resolution system Fix multiple issues that make it hard to use XF\Import\Data\AbstractEntityData Consistently use code paths which result in the canView method of the report entity (rather than the handler) being used. The following public templates have had changes: account_upgrades core_contentrow.less core_input.less core_overlay.less editor_base.less edit_history_compare edit_history_view forum_view PAGE_CONTAINER quick_reply_macros thread_save_draft warning_info Where necessary, the merge system within the "outdated templates" page should be used to integrate these changes. As always, new releases of XenForo are free to download for all customers with active licenses, who may now grab the new version from the customer area. Note: add-ons, customizations and styles made for XenForo 1.x are not compatible with XenForo 2.x. If your site relies upon these for essential functionality, ensure that a XenForo 2 version exists before you start to upgrade. We strongly recommend you make a backup before attempting an upgrade. Current Requirements Please note that XenForo 2.0.x has higher system requirements than XenForo 1.x. The forthcoming XenForo 2.1.x release will have higher system requirements again (PHP 5.6). The following are minimum requirements: PHP 5.4 or newer (PHP 7.2 recommended) MySQL 5.5 and newer (Also compatible with MariaDB/Percona etc.) All of the official add-ons require XenForo 2.0. Enhanced Search requires at least Elasticsearch 2.0. Installation and Upgrade Instructions for XenForo 2.0 Full details of how to install and upgrade XenForo can be found in the XenForo 2 Manual. Note that when upgrading from XenForo 1.x, all add-ons will be disabled and style customizations will not be maintained. New versions of add-ons will need to be installed and customizations will need to be redone. We strongly recommended that you make a backup before attempting an upgrade. Once upgraded, you will not be able to downgrade without restoring from a backup.
xenforo_2.0.12_full.zip
source https://xenforoleaks.com/topic/307-xenforo-2012-full-install/
0 notes