=== Dev Theme – Theme Development & Backups ===
Contributors: galpeaceman, bashari
Tags: theme development, theme preview, staging, deployment, backups
Requires at least: 4.9
Tested up to: 7.1.4
Stable tag: 2.0.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Develop and preview a separate theme copy, publish verified files, and restore previous versions with built-in backups.

== Description ==

= Your next theme update. With a way back. =

**Dev Theme – Theme Development & Backups** gives your WordPress theme a dedicated development copy, browser previews, verified publishing and a version history you can restore from.

Work on your theme files while regular visitors keep using the main theme. When your changes are ready, publish them from one focused dashboard. Need to revisit an earlier version? Choose a backup and restore it; the current files are backed up first.

**Develop → Preview → Publish → Restore.** One workflow for the files that shape your site.

= What you can do =

* **Create a development copy.** Start with your active theme files, or refresh an existing development copy. The previous development version is backed up before replacement.
* **Preview in your browser.** Enable Dev Theme for your WordPress account, or use a browser cookie to share a preview with a tester.
* **Publish verified files.** The new copy is prepared and checked before the destination is replaced. An operation lock prevents overlapping Dev Theme copy and recovery actions.
* **Keep your history.** Save 10 backups per destination by default, or choose between 1 and 50. Backups are listed with their date, destination, size and the action they preceded.
* **Restore a version.** Browse, filter, restore or delete backups from the dashboard. Restoring first saves the current version, so it can be revisited too, subject to your retention setting.
* **Work with child themes.** Develop the child theme while keeping its original parent in place.
* **Stay oriented.** A responsive dashboard separates development, publishing and recovery, with confirmation dialogs and support for RTL layouts.

= Built for theme-file workflows =

Dev Theme is designed for developers, freelancers and site maintainers who want to test theme-file changes against the site's existing content, without maintaining a second content database.

**Content, plugins and the database are shared by design.** Dev Theme does not clone the entire site or copy database settings between themes. Changes to content, or development code that writes to the database, affect the live database. Browser-cookie previews are intentionally available without login; they are not private access links.

= Before your first publish =

Test the development copy before publishing. File verification checks the copied files, not whether the theme's PHP or design works correctly. Directory replacement has a brief transition between renames, so coordinate publishing with traffic and other file editors.

Keep backup storage outside the public web root where possible. Apache and IIS denial files are provided; Nginx needs server-level rules. Exclude the dev_theme cookie from server and CDN page caches. WP Rocket cookie exclusions and cache refreshes are attempted when its APIs are available; WP Engine integration is also included.

= עברית — פיתוח תבניות, תצוגה מקדימה וגיבויים =

**מפתחים את העיצוב הבא של האתר — עם אפשרות לחזור לגרסה קודמת.**

Dev Theme יוצר עותק פיתוח של קובצי התבנית הפעילה, כדי שתוכלו לערוך ולבדוק אותם מול התוכן הקיים. המבקרים הרגילים ממשיכים לראות את התבנית הראשית, ובדפדפן שלכם אפשר להציג את גרסת הפיתוח.

כשהשינויים מוכנים, מפרסמים אותם מתוך מסך ניהול אחד. רוצים לחזור אחורה? בוחרים גיבוי ומשחזרים. לפני השחזור נשמר גם המצב הנוכחי, בהתאם להגדרת מספר הגיבויים.

**פיתוח ← תצוגה מקדימה ← פרסום ← שחזור**

* **עותק פיתוח נפרד לקובצי התבנית:** יצירה או רענון של העותק, עם גיבוי לפני החלפת עותק קיים.
* **תצוגה לפי משתמש או דפדפן:** הפעלה דרך פרופיל המשתמש או Cookie בדפדפן לצורך בדיקה.
* **פרסום עם בדיקת קבצים:** הכנת העותק ואימותו לפני החלפת התבנית, ונעילה שמונעת פעולות מקבילות של התוסף.
* **היסטוריית גרסאות בממשק:** תאריך, יעד, גודל ואפשרויות סינון, שחזור ומחיקה.
* **בחירה כמה לשמור:** 10 גיבויים לכל יעד כברירת מחדל, עם אפשרות לבחור בין 1 ל־50.
* **תמיכה בתבניות בת:** עותק הפיתוח משתמש בתבנית האב המקורית.
* **ממשק נוח גם ב־RTL:** כרטיסי פיתוח ופרסום, חלונות אישור ותצוגה מותאמת למובייל.

**מסד הנתונים המשותף הוא חלק מהתכנון.** זהו כלי לפיתוח קובצי תבנית בתוך האתר הקיים, ולא שכפול מלא של האתר. תוכן, תוספים, משתמשים והגדרות במסד הנתונים נשארים משותפים. תצוגה באמצעות Cookie אינה פרטית ואינה דורשת התחברות.

לפני פרסום יש לבדוק את הקוד והעיצוב בעותק הפיתוח. אימות קבצים אינו בדיקת תקינות של קוד PHP, ובזמן החלפת התיקיות יש מעבר קצר. מומלץ לאחסן גיבויים מחוץ לתיקייה הציבורית ולהגדיר החרגת מטמון לבקשות עם Cookie הפיתוח.

= Support / תמיכה =

Have a question or found an issue? Visit the [Dev Theme support forum](https://wordpress.org/support/plugin/dev-theme/). Include your WordPress and PHP versions, theme type and the action that failed. Do not post passwords or private backup files.

לשאלות ולדיווח על תקלות אפשר לפנות ל[פורום התמיכה של התוסף](https://wordpress.org/support/plugin/dev-theme/). כדאי לציין את גרסאות WordPress ו־PHP, האם זו תבנית בת, ואיזו פעולה נכשלה.

== Installation ==

1. Install and activate Dev Theme. WordPress 4.9+, PHP 7.4+ and direct filesystem write access are required.
2. Configure a dedicated private backup directory, or the appropriate HTTP denial rules for your hosting. Configure server/CDN cache exclusions for the dev_theme cookie.
3. Open **DEV Theme** in your WordPress dashboard and choose **Create development copy**.
4. In your user profile, enable **Use the development theme for my account** and save. Alternatively, set the browser cookie dev_theme=enabled and reload.
5. Edit and test the files under wp-content/themes/dev-theme. Check the main theme in a browser without development preview enabled.
6. Choose **Publish to main theme** when ready. Use **Version history** to restore a backup or adjust how many versions are retained.

= התקנה בעברית =

1. מתקינים ומפעילים את התוסף. נדרשות WordPress 4.9 ומעלה, PHP 7.4 ומעלה והרשאת כתיבה לתיקיות המתאימות.
2. מגדירים אחסון גיבויים מוגן והחרגת מטמון לבקשות עם Cookie הפיתוח, בהתאם לשרת.
3. נכנסים ל־**DEV Theme** ויוצרים עותק פיתוח.
4. מפעילים תצוגת פיתוח בפרופיל המשתמש, או באמצעות Cookie בשם dev_theme עם הערך enabled, ומרעננים את הדף.
5. עורכים ובודקים את קובצי העותק. כשהכול מוכן, מפרסמים לתבנית הראשית. שחזור גרסאות נעשה דרך **Version history**.

== Frequently Asked Questions ==

= Is this a full staging site? / האם זו סביבת staging מלאה? =

No. Dev Theme copies theme files only. Content, plugins, users and the database remain shared. Theme settings stored in the database are not synchronized between theme directory names.

לא. התוסף מעתיק קובצי תבנית בלבד. התוכן, התוספים, המשתמשים ומסד הנתונים משותפים. הגדרות תבנית שנשמרות במסד הנתונים אינן מועתקות בין שמות התבניות.

= Who can see the development theme? / מי יכול לראות את גרסת הפיתוח? =

An account with development preview enabled, or any browser with dev_theme=enabled. The cookie works without login and is not an access-control mechanism. Clear it and disable the profile setting to return to the main theme.

משתמש שהפעיל את האפשרות בפרופיל, או דפדפן עם Cookie הפיתוח. ה־Cookie עובד גם בלי התחברות. כדי לחזור לתבנית הראשית יש לבטל גם את ההעדפה בפרופיל וגם את ה־Cookie.

= How many backups are kept? / כמה גיבויים נשמרים? =

The default is 10 per destination; choose 1–50 in the dashboard. Older versions are removed only after a successful replacement of that destination. Existing legacy -bk folders are preserved but are not imported into the new history.

ברירת המחדל היא 10 לכל יעד, וניתן לבחור בין 1 ל־50. גיבויים ישנים מעבר לכמות שנבחרה נמחקים אחרי החלפה מוצלחת של אותו יעד. תיקיות גיבוי ישנות עם הסיומת -bk נשארות ללא שינוי ואינן מיובאות להיסטוריה החדשה.

= What happens if publishing fails? / מה קורה אם הפרסום נכשל? =

The copy is prepared and verified before replacement. A failed swap attempts to restore the previous directory. A recovery journal helps the next authorized operation recover an interrupted swap. If files no longer match the recorded versions, recovery stops and preserves them for inspection.

העותק מוכן ונבדק לפני ההחלפה. אם ההחלפה נכשלת, מתבצע ניסיון להחזיר את התיקייה הקודמת. אחרי תהליך שנקטע, הפעולה המורשית הבאה מנסה להתאושש בעזרת יומן. אם הקבצים השתנו באופן לא צפוי, הם נשמרים לבדיקה במקום להימחק.

= Are child themes supported? / האם יש תמיכה בתבניות בת? =

Yes. Dev Theme copies the active child theme and keeps using its original parent. Changes to the parent itself remain shared.

כן. מועתקת תבנית הבת הפעילה, ותבנית האב המקורית נשארת בשימוש. שינויים בתבנית האב עצמה משותפים.

= Where are backups stored? / איפה נשמרים הגיבויים? =

By default, in a dedicated randomized directory under wp-content. Prefer a directory outside the public web root using the dev_theme_backup_directory filter. On Nginx, explicitly deny HTTP access to backup and working directories. Configure exclusions in any cache that serves pages before WordPress loads.

ברירת המחדל היא תיקייה ייעודית עם שם אקראי תחת wp-content. עדיף לבחור תיקייה מחוץ לשורש הציבורי באמצעות המסנן dev_theme_backup_directory. ב־Nginx נדרשת חסימת HTTP לתיקיות הגיבויים והעבודה, ובמטמון השרת נדרשת החרגה מתאימה.

= Who can publish or restore? / למי יש הרשאה לפרסם ולשחזר? =

Users need manage_options and edit_theme_options, and WordPress must allow file modifications. Multisite requires a Super Admin because theme files are shared across the network. Symbolic links and Windows junctions are not supported in theme copies.

נדרשות הרשאות manage_options ו־edit_theme_options, ו־WordPress צריך לאפשר שינוי קבצים. במולטיסייט נדרשת הרשאת Super Admin. העתקת תבניות עם symlinks או junctions אינה נתמכת.

== Screenshots ==

1. The development and publishing dashboard, with version history below. מסך הפיתוח והפרסום, עם היסטוריית הגיבויים.
2. Filter saved versions and choose a backup to restore. סינון גרסאות שמורות ובחירת גיבוי לשחזור.

== Changelog ==

= 2.0.1 =
* Added a clear plugin name: Dev Theme – Theme Development & Backups.
* Added the missing short description and expanded the plugin page with English and Hebrew explanations, installation steps and FAQs.
* Added a new plugin icon, English and Hebrew banners, and dashboard screenshots for WordPress.org.
* Theme copying, publishing, backups and recovery behavior are unchanged from 2.0.0.

= 2.0.0 =
* Added a redesigned responsive dashboard with version history, destination filters and confirmation dialogs.
* Added verified, timestamped backups, restoration and deletion. Keep 1-50 backups per destination (default: 10).
* Added staged, hash-verified copying, operation locks, rollback and recovery journals.
* Replaced GET deployment links with permission-checked POST actions and nonces.
* Added checked filesystem operations, path validation and safe symlink deletion; copies containing symlinks are rejected.
* Added fallback to the main theme when the development copy is unavailable.
* Fixed profile checkbox saving, preview detection and WP Engine method checks.
* Added WP Rocket cookie exclusion, configuration refresh and cache clearing after copies and restores.
* Requires PHP 7.4+ and WordPress 4.9+. Direct filesystem write access is required.
* Existing -bk folders are preserved, but are not imported into version history.
* Pre-commit review fixes: Windows junction detection, recovery hash validation, OPcache invalidation, numeric filenames, early preview initialization and stale-form protection.
* Management honors WordPress file-modification policy and requires Super Admin on Multisite. Dedicated backup storage is bound to its themes directory.

= 1.2.0 =
* Added WP Rocket auto cache clearing.
* Added option to enable Dev Theme via cookie for non logged in tests.

= 1.1.0 =
* Added WP Engine auto cache clearing and auto file permissions resetting.

= 1.0.7 =
* Added function dth_is_dev_theme(), returns true if Dev Theme is actually working.

== Upgrade Notice ==

= 2.0.1 =
New bilingual plugin page and visual identity. No change to the theme publishing and recovery workflow.

= 2.0.0 =
Requires PHP 7.4+. Adds versioned backups and a new recovery workflow. Legacy -bk folders remain untouched and are not imported into history.
