مايسترو للعوازل وكشف الخرير
69906299
50406620
- سرعة الانجاز 100%
- رضا المراجعين 100%
- مستوى الجودة 100%
نسعى دائما للتطوير وإضافة مايطلبه عملائنا الكرام،
![](https://maestro-kw.com/wp-content/uploads/2022/05/عازل-3.jpeg)
مايسترو للعوازل وكشف الخرير
69906299
=== Better Search Replace === Contributors: wpengine, deliciousbrains, mattshaw Tags: search replace, search and replace, update urls, database, search replace database, update database urls, update live url, better search replace, search&replace Requires at least: 3.0.1 Tested up to: 6.1.1 Stable tag: 1.4.2 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html A simple plugin to update URLs or other text in a database. == Description == When moving your WordPress site to a new domain or server, you will likely run into a need to run a search/replace on the database for everything to work correctly. Fortunately, there are several plugins available for this task, however, all have a different approach to a few key features. This plugin consolidates the best features from these plugins, incorporating the following features in one simple plugin: * Serialization support for all tables * The ability to select specific tables * The ability to run a "dry run" to see how many fields will be updated * No server requirements aside from a running installation of WordPress * WordPress Multisite support > **Time-saving features available in the Pro version:** > > * View exactly what changed during a search/replace > * Backup and import the database while running a search/replace > * Priority email support from the developer of the plugin > * Save or load custom profiles for quickly repeating a search/replace in the future > * Support and updates for 1 year > > **[Learn more about Better Search Replace Pro](https://bettersearchreplace.com/)** The search and replace functionality is heavily based on interconnect/it's great and open-source Search Replace DB script, modified to use WordPress native database functions to ensure compatibility. **Supported Languages** * English * French * German * Spanish **Want to contribute?** Feel free to open an issue or submit a pull request on [GitHub](https://github.com/deliciousbrains/better-search-replace/). == Installation == Install Better Search Replace like you would install any other WordPress plugin. Dashboard Method: 1. Login to your WordPress admin and go to Plugins -> Add New 2. Type "Better Search Replace" in the search bar and select this plugin 3. Click "Install", and then "Activate Plugin" Upload Method: 1. Unzip the plugin and upload the "better-search-replace" folder to your 'wp-content/plugins' directory 2. Activate the plugin through the Plugins menu in WordPress == Frequently Asked Questions == = Using Better Search Replace = Once activated, Better Search Replace will add a page under the "Tools" menu page in your WordPress admin. = Is my host supported? = Yes! This plugin should be compatible with any host. = Can I damage my site with this plugin? = Yes! Entering a wrong search or replace string could damage your database. Because of this, it is always adviseable to have a backup of your database before using this plugin. = How does this work on WordPress Multisite? = When running this plugin on a WordPress Multisite installation, it will only be loaded and visible for Network admins. Network admins can go to the dashboard of any subsite to run a search/replace on just the tables for that subsite, or go to the dashboard of the main/base site to run a search/replace on all tables. = How can I use this plugin when changing URLs? = If you're moving your site from one server to another and changing the URL of your WordPress installation, the approach below allows you to do so easily without affecting the old site: 1. Backup the database on your current site 2. Install the database on your new host 3. On the new host, define the new site URL in the `wp-config.php` file, as shown [here](http://codex.wordpress.org/Changing_The_Site_URL#Edit_wp-config.php) 4. Log in at your new admin URL and run Better Search Replace on the old site URL for the new site URL 5. Delete the site_url constant you added to `wp-config.php`. You may also need to regenerate your .htaccess by going to Settings -> Permalinks and saving the settings. More information on moving WordPress can be found [here](http://codex.wordpress.org/Moving_WordPress). == Screenshots == 1. The Better Search Replace page added to the "Tools" menu 2. After running a search/replace dry-run. == Changelog == = 1.4.2 - January 10, 2023 = * Security: Arbitrary tab templates in the `templates` directory can no longer be loaded using a query parameter. = 1.4.1 - July 25, 2022 = * Security: Selected tables are now confirmed to exist before processing the request = 1.4 - April 7, 2022 = * New: Better Search Replace has a brand new user interface * Improvement: Default capability required to use the plugin has changed from "install_plugins" to "manage_options" for compatibility with DISALLOW_FILE_MODS = 1.3.4 - December 7, 2020 = * Improvement: WordPress 5.6 and PHP 8 compatible * Fix: Strings that have been serialized twice showing up as false-positives = 1.3.3 - February 26, 2019 = * Fix: Some special characters interfering with search/replace * Security: Pass template filenames through `sanitize_file_name()` * Security: Verify nonce when downloading diagnostic info = 1.3.2 - January 3, 2018 = * Fix: Only one table searched on some environments (props @Ov3rfly) * Tweak: Update text in sidebar = 1.3.1 - September 14, 2017 = * Security: Check if data is serialized before unserializing it * Improvement: Increased size of table select = 1.3 - November 10, 2016 = * Improvement: Updated sidebar and added pro version discount * Fix: Outdated links to old website * Fix: Prevent requests to invalid tabs = 1.2.10 - June 2, 2016 = * Fix: CSS not loaded on details page = 1.2.9 - December 8, 2015 = * Fix: Bug with case-insensitive searches in serialized objects * Fix: Bug with early skip due to lack of primary key = 1.2.8 - November 25, 2015 = * Fix: Bug with report details = 1.2.7 - November 24, 2015 = * Fix: Untranslateable string * Tweak: Check BSR_PATH instead of ABSPATH to be consistent * Tested with 4.4 = 1.2.6 = * Removed unused code/small cleanup = 1.2.5 = * Improved progress bar info and styles * Small cleanup = 1.2.4 = * Added "Settings saved" notice when saving settings * Fixed bug with wp_magic_quotes interfering with some search strings = 1.2.3 = * Fixed bug with searching for backslashes * Fixed potential bug with getting tables in large multisites * Fixed potential notice in append_report * Improved handling of missing primary keys = 1.2.2 = * Fixed AJAX conflict with WooCommerce * Fixed a few issues with translations * Tweaked "System Info" to use get_locale() instead of WP_LANG constant * Updated German translation (props @Linus Ziegenhagen) = 1.2.1 = * Fixed minor issue with display of progress bar * Updated translation file = 1.2 = * Switched to AJAX bulk processing for search/replaces * Decreased minimum "Max Page Size" to 1000 * Added "Help" tab with system info for easier troubleshooting = 1.1.1 = * Added ability to change max page size * Decreased default page size to prevent white screen issue on some environments = 1.1 = * Added ability to change capability required to use plugin * Small bugfixes and translation fixes = 1.0.6 = * Added table sizes to the database table listing * Added French translation (props @Jean Philippe) = 1.0.5 = * Added support for case-insensitive searches * Added German translation (props @Linus Ziegenhagen) = 1.0.4 = * Potential security fixes = 1.0.3 = * Fixed issue with searching for special characters like '\' * Fixed bug with replacing some objects = 1.0.2 = * Fixed untranslateable strings on submit button and submenu page. = 1.0.1 = * Fixed issue with loading translations and added Spanish translation (props Eduardo Larequi) * Fixed bug with reporting timing * Updated to use "Dry Run" as default * Added support for WordPress Multisite (see FAQs for more info) = 1.0 = * Initial release # Query Builder ## Product Knowledge Base: - [Laravel's Query Builder](https://laravel.com/docs/master/queries) ## Introduction: Elementor's database Query Builder provides a convenient, fluent interface to creating and running database queries. It can be used to perform most database operations and is heavily inspired by [Laravel's Query Builder](https://laravel.com/docs/master/queries). It integrates flawlessly with `WPDB` and automatically prepares and binds the SQL queries in order to prevent SQLi. ## Available Methods: Most of the methods are self-explanatory, and those which have some caveats will be explained below. - [`table()` / `from()`](#retrieve-all-rows-from-a-table---table--from) - [`select()`](#retrieve-specific-columns-from-a-table---select) - [`select_raw()`](#select-raw-columns---select_raw) - [`add_sub_select()`](#add-a-sub-select---add_sub_select) - [`add_count_select()`](#select-column-count---add_count_select) - [`when()`](#add-conditional-query-operations---when) - [`where()`](#filter-rows-by-conditions---where) - `or_where()` - [`where_null()`](#compare-to-null---where_null) - `or_where_null()` - [`where_column()`](#compare-column---where_column) - `or_where_column()` - [`where_in()`](#where-in---where_in) - `or_where_in()` - `where_not_in()` - `or_where_not_in()` - [`where_exists()`](#where-exists---where_exists) - `or_where_exists()` - `where_not_exists()` - `or_where_not_exists()` - `having_raw()` - `or_having_raw()` - [`join()`](#join-tables---join) - `left_join()` - `right_join()` - [`limit()`](#limit-results---limit-offset) - [`offset()`](#limit-results---limit-offset) - [`order_by()`](#order-results---order_by) - [`group_by()`](#group-results---group_by) - [`find()`](#find--get-the-first-row-by-a-single-condition---find) - [`first()`](#get-the-first-row-from-the-results---first) - [`get()`](#get-query-results---get) - [`to_sql()`](#get-sql-for-the-current-query---to_sql) - [`insert()`](#insert-new-row-to-a-table---insert) - [`update()`](#update-rows-in-a-table---update) - [`delete()`](#delete-rows-from-a-table---delete) ## Running Database Quries: Writing queries using the Query Builder is very similar to standard SQL syntax, just using composable functions. > *Note:* All of the examples below are assumed to have `$query = new Query_Builder()`. > *Note:* The Query Builder results always return a `Collection` instance (expect for `find()` & `first()` which return the first result). ### Retrieve All Rows From A Table - `table()` / `from()`: Select data from a specific table using the `table()` method: ```PHP $users = $query->table( 'users' )->get(); // Equivalent to: SELECT * FROM `users` ``` In addition, the method can receive a second parameter to define an alias: ```PHP $users = $query->table( 'users', 'test' )->get(); // Equivalent to: SELECT * FROM `users` AS `test` ``` ### Retrieve Specific Columns From A Table - `select()`: By default, when a `select()` isn't provided, all of the columns are selected. But sometimes only specific columns are needed: ```PHP $users = $query->select( [ 'id', 'user_name' ] ) ->from( 'users' ) ->get(); // Equivalent to: SELECT `id`, `user_name` FROM `users` ``` ### Select Raw Columns - `select_raw()`: When selecting raw columns, the `Query_Builder` won't prepare / bind the values, so it might cause SQLi - USE WITH CAUTION. ```PHP $data = $query->select_raw( [ 1, 'AVG( id )', 'DATE( "1970-01-01" )' ] ) ->from( 'users' ) ->get(); // Equivalent to: SELECT 1, AVG( id ), DATE( "1970-01-01" ) FROM `users` ``` ### Add A Sub Select - `add_sub_select()`: Add a sub select (e.g. `(SELECT ... ) AS alias`) to the query. This method expects a closure as a first parameter. The closure will receive a new instance of `Query_Builder` where a new query can be created. The second parameter is an alias of the sub select: ```PHP $data = $query->from( 'users' ) ->select( [ 'id' ] ) ->add_sub_select( function ( Query_Builder $q ) { $q->from( 'comments' ) ->select_raw( [ 'COUNT( `replies`.`id` )' ] ) ->where_column( 'comments.author_id', '=', 'users.id' ); }, 'comments_count' ) ->get(); /** * Equivalent to: * * SELECT `id`, * ( * SELECT COUNT( `replies`.`id` ) * FROM `comments` * WHERE `comments`.`author_id` = `users`.`id` * ) AS `comments_count` * * FROM `users` */ ``` ### Select Column count - `add_count_select()`: ```PHP $data = $query->from( 'users' ) ->select( [ 'id' ] ) ->add_count_select( 'id', 'users_count' ) ->get(); // Equivalent to: SELECT `id`, COUNT( `id` ) FROM `users` ``` ### Add Conditional Query Operations - `when()`: Sometimes query operations need to be added based on conditions, so in order to be able to continue the functions concatenation flow with `if`s, there is a way to execute those operations on the fly. This method expects a condition as a first parameter, and 2 closures as the other parameters. The closures will receive the current instance of the `Query_Builder` in order to modify it, and will also receive the condition as a second parameter. The first callback is required and will be executed when the condition is truthy, while the second one is optional and will be executed when the condition is falsy. ```PHP $users_ids = [ 1, 2, 3 ]; $data = $query->from( 'users' ) ->select( [ 'id', 'user_name' ] ) ->when( $users_ids, function( Query_Builder $q, $users_ids ) { $q->where_in( 'id', $users_ids ); }, function( Query_Builder $q ) { $q->where( 'id', '=', 1 ); } ) ->get(); /** * When `$users_ids` is truthy, it's equivalent to: * SELECT `id`, `user_name` FROM `users` WHERE `id` IN ( 1, 2, 3 ) * * When `$users_ids` is falsy, it's equivalent to: * SELECT `id`, `user_name` FROM `users` WHERE `id` = 1 */ ``` ### Filter Rows by conditions - `where()`: The `where()` method can filter the results and has multiple options depends on the provided parameters. #### Simple - `where( string $column, string $operator, string $value )` ```PHP $users = $query->from( 'users' ) ->where( 'id', '=', 1 ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `id` = 1 ``` #### Nested - `where( callable $callback )` Used to support nested conditions. ```PHP $users = $query->from( 'users' ) ->where( 'user_name', 'like', '%a%' ) ->where( function ( Query_Builder $q ) { $q->where( 'id', '=', 1 ) ->or_where( 'id', '=', 2 ); } ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `id` LIKE "%a%" AND ( `id` = 1 OR `id` = 2 ) ``` #### Sub select - `where( string $column, string $operator, callable $callback )` Used to support sub selects in `WHERE` statements. ```PHP $users = $query->from( 'users' ) ->where( 'user_name', '=', function ( Query_Builder $q ) { $q->select( [ 'author_name' ] ) ->from( 'posts' ) ->where( 'id', '=', 1 ); } ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `user_name` = ( SELECT `author_name` FROM `posts` WHERE `id` = 1 ) ``` #### Compare To NULL - `where_null()` ```PHP $users = $query->from( 'users' ) ->where_null( 'user_name' ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `user_name` IS NULL ``` #### Compare Columns - `where_column()` ```PHP $users = $query->from( 'users' ) ->where_column( 'user_name', '=', 'display_name' ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `user_name` = `display_name` ``` #### Where in - `where_in()` ```PHP $users = $query->from( 'users' ) ->where_in( 'id', [ 1, 2, 3 ] ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `id` IN ( 1, 2, 3 ) ``` #### Where exists - `where_exists()` Used to support `WHERE EXISTS` queries. The method expects a callback which receives a new instance of `Query_Builder`. ```PHP $users = $query->from( 'users' ) ->where_exists( function ( Query_Builder $q ) { $q->from( 'posts' ) ->select_raw( [ 1 ] ) ->where( 'posts.author_id', '=', 'users.id' ); } ) ->get(); // Equivalent to: SELECT * FROM `users` WHERE `id` IN ( 1, 2, 3 ) ``` ### Join Tables - `join()`: The `join()` methods expects a callback which receives a new instance of `Join_Clause`. ```PHP $users = $query->from( 'users' ) ->join( function ( Join_Clause $q ) { $q->table( 'posts' ) ->on_column( 'users.id', '=', 'posts.author_id' ); } ) ->get(); // Equivalent to: SELECT * FROM `users` JOIN `posts` ON `users`.`id` = `posts`.`author_id` ``` ### Limit Results - `limit()`, `offset()`: ```PHP $users = $query->from( 'users' ) ->limit( 10 ) ->offset( 2 ) ->get(); // Equivalent to: SELECT * FROM `users` LIMIT 10 OFFSET 2 ``` ### Order Results - `order_by()`: ```PHP $users = $query->from( 'users' ) ->order_by( 'id', 'asc' ) ->get(); // Equivalent to: SELECT * FROM `users` ORDER BY `id` ASC ``` ### Group Results - `group_by()`: ```PHP $users = $query->from( 'users' ) ->group_by( 'id' ) ->group_by( 'user_name' ) ->get(); // Equivalent to: SELECT * FROM `users` GROUP BY `id`, `user_name` ``` ### Find & Get The First Row By A Single Condition - `find()`: ```PHP $users = $query->table( 'users' )->find( 1 ); // Equivalent to: SELECT * FROM `users` WHERE `id` = 1 ``` The default column is `id`, but it can be overridden by passing a second parameter: ```PHP $users = $query->table( 'users' )->find( 1, 'user_id' ); // Equivalent to: SELECT * FROM `users` WHERE `user_id` = 1 ``` ### Get The First Row From The Results - `first()`: ```PHP $users = $query->table( 'users' ) ->where( 'id', '=', 1 ) ->first(); // Equivalent to: SELECT * FROM `users` WHERE `id` = 1 LIMIT 1 ``` ### Get Query Results - `get()`: ```PHP var_dump( $query->table( 'users' )->get() ); // Output: Collection with all of the users inside. ``` ### Get SQL For The Current Query - `to_sql()`: Get the SQL string *without bindings*: ```PHP echo $query->from( 'users' ) ->where( 'id', '=', 1 ) ->to_sql(); // Output: SELECT * FROM `users` WHERE `id` = %d ``` ### Insert New Row To A Table - `insert()`: Insert data to a table. The data should be an associative array with `column_name => value` pairs. Unlike any other SQL action in the Query Builder, under the hood this function uses `WPDB`'s built-in `insert()` method. ```PHP $inserted_id = $query->table( 'users' ) ->insert( [ 'user_name' => 'admin', 'password' => 'super_secret', ] ); // Equivalent to: INSERT INTO `users` ( `user_name`, `password` ) VALUES ( 'admin', 'super_secret' ) ``` ### Update Rows In A Table - `update()`: Update rows in a table. The data should be an associative array with `column_name => value` pairs. ```PHP $inserted_id = $query->table( 'users' ) ->where( 'id', '=', 1 ) ->update( [ 'email' => 'new_email@elementor.com', ] ); // Equivalent to: UPDATE `users` SET `email` = 'new_email@elementor.com' WHERE `id` = 1 ``` ### Delete Rows From A Table - `delete()`: ```PHP $inserted_id = $query->table( 'users' ) ->where( 'id', '=', 1 ) ->delete(); // Equivalent to: DELETE FROM `users` WHERE `id` = 1 ``` /*! @elementor/editor-documents */ /*! @elementor/editor-v1-adapters */ /*! @elementor/locations */ /*! @elementor/query */ /*! @elementor/store */ /*! @elementor/ui */ /*! @wordpress/i18n */ /*! react */ /*! react-dom */ /*! react-dom/client */ /*!**************************!*\ !*** external ["React"] ***! \**************************/ /*!*****************************!*\ !*** external ["ReactDOM"] ***! \*****************************/ /*!******************************!*\ !*** external ["wp","i18n"] ***! \******************************/ /*!*************************************!*\ !*** external ["elementorV2","ui"] ***! \*************************************/ /*!****************************************!*\ !*** external ["elementorV2","query"] ***! \****************************************/ /*!****************************************!*\ !*** external ["elementorV2","store"] ***! \****************************************/ /*!******************************************!*\ !*** ./node_modules/react-dom/client.js ***! \******************************************/ /*!********************************************!*\ !*** external ["elementorV2","locations"] ***! \********************************************/ /*!**************************************************!*\ !*** external ["elementorV2","editorDocuments"] ***! \**************************************************/ /*!***************************************************!*\ !*** external ["elementorV2","editorV1Adapters"] ***! \***************************************************/ /*!*******************************************************!*\ !*** ./node_modules/@elementor/editor/dist/index.mjs ***! \*******************************************************/
69906299
نسعى دائما للتطوير وإضافة مايطلبه عملائنا الكرام،
69906299