17 lines
730 B
Python
17 lines
730 B
Python
import re
|
|
|
|
with open('_get_instance_details.php', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
pattern = r'<button id="startNewProcessBtn"([^>]+)>.*?</button>\s*</div>\s*<script>.*?</script>'
|
|
replacement = r'''<button id="restartProcessBtn" class="btn btn-sm btn-primary" data-person-id="<?= $person_id ?>" data-process-code="<?= htmlspecialchars($process['code']) ?>" data-mode="create_new_run">
|
|
<?= t('modal.start_new_instance', 'Rozpocznij od nowa') ?>
|
|
</button>
|
|
</div>'''
|
|
|
|
new_content, count = re.subn(pattern, replacement, content, flags=re.DOTALL)
|
|
|
|
with open('_get_instance_details.php', 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
|
|
print(f"Replaced {count} instances.") |