User interface editor for live websites

Is there an online tool or a Chrome extension where I can add / modify the user interface / CSS of a live website? I'm looking for a tool with more visual capabilities such as drag and drop with the Bootstrap support.

unit – Collisions work in the editor but not in the compilation

This has been asked several times, but none of the responses worked; also, the other questions are very old. I have an object with a mesh collider on it. In the editor, collisions work perfectly. However, in the compiled game, there is no collision. It is important to note that other colliders (box collider, sphere collider, etc.) work perfectly well in the compiled game, as well as in the editor.

The mesh is as follows:
enter description of image here

What I have tried:

  • Recreate the entire prefab that has the collider.
  • Redo the mesh for the mesh collider.
  • Using a different format for the mesh (.fbx, .obj, etc.)

Additional details:
– The object has a rigid body and a convex mesh collider.

  • The object is moved via a script, using the speed of the rigid body.

  • It worked perfectly fine until I reduced each factor in the scene by a factor of 2. So, I opened Blender to half the size of the mesh. Whatever it is, the problem is not the mesh but the fact that it works in the editor and only the editor.

block editor – Gutenberg CSS Issue

I have the CSS code below but it is not on the post page:

(I'm talking about the font size and color)

/* gutenberg */
blockquote {
    text-align: center;
    margin: 20px;
    font-family: epicride;
    color: red;
    font-size: 90px;
}

wp-block-quote {
    font-size: 90px;
}

This is a page, it works:

http://www.oneclick.deniz-tasarim.site/sample-page/

This one is post, it doesn't work:

http://www.oneclick.deniz-tasarim.site/2020/03/27/best-places-in-africa/

I have CSS below but the font family is not read.

@import url('https://fonts.googleapis.com/css?family=Love+Ya+Like+A+Sister&display=swap');

  figcaption {
    font-size: 30px;
    text-align: center;
    font-family: 'Love Ya Like A Sister', cursive;
      border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
      box-shadow: 20px 38px 34px -26px hsla(0,0%,0%,.2);
      border:solid 2px #41403E;
}
figcaption:hover {
    box-shadow: 2px 8px 4px -6px hsla(0, 0%, 0%, .3);
}

you can look at the same post page to check it out.

The figcaption code also affects my post plugin on the home page. How can I limit the code control area with the gutenberg element?

the home page: (you will see a black border on the thumbnail)

Home

Thank you

functions – Filter comments from other users. View only your own comments and comments from users of the editor role

I have a similar request to the question, but I'm not at all in php and I wouldn't know where to start to make such changes based on the answer provided.

It would be great if someone could help here. It is a simple school project where teachers can share homework with their students. Students should not be able to see other students' comments on an assignment.

Is there anyone who could help you with this task? The functions.php can be found on the link

Thanks in advance

python 3.x – Self-encrypting text editor

I wrote an auto-encrypting text editor (github link). The reasons why I wrote this program instead of using vim + gpg are:

  1. This is more convenient than vim + gpg (the user only needs to enter the password once).
  2. It is more secure than vim + gpg (see CVE-2010-2547 and CVE-2019-12735).
  3. The user cannot accidentally change the file password.
  4. My program checks that the file written on the disk can be decrypted again.
  5. My program makes a copy of the file each time it is written to the disk and checks that the copy is bit by bit identical to the original, in order to protect myself from corruption of the disk sector.

The reason I ask for a code review is to make sure I haven't messed up these properties in one way or another (especially crypto, that’s ; is the part that worries me the most), and also I would like to know what I can do to improve the security and reliability of my program against the most common threats such as bad analysis of entries (the same type of errors as the Vim and GPG vulnerabilities mentioned above), disk sector failures and memory errors (due to non-use of ECC RAM). I also assume that I cannot defend myself against an opponent who is already running a program on the machine that can read the clipboard, record keystrokes or read my process memory. I also assume that python, tkinter and pynacl are not hijacked, since packages (other than python) are not signed.

If you don't have time to read all of the code, the most important functions that I would like to have looked at are encrypt, decrypt, and savefile.

Cryptographic functions (cryptotest.py):

import os
import base64
import nacl.pwhash
import nacl.secret
import nacl.utils

def _keygen(password: str): #key generation algorithm, not used outside this file
    """
    Takes a password string and returns a key.

    We don't need to salt the password since we're not storing it anywhere in any form.

    Parameters are hardcoded so you don't have to store or pass them.
    """
    password = password.encode('utf-8')
    kdf = nacl.pwhash.argon2i.kdf
    salt = b'1234567812345678' #salt must be exactly 16 bytes long
    ops = 4 #OPSLIMIT_INTERACTIVE
    mem = 33554432 #MEMLIMIT_INTERACTIVE

    return kdf(nacl.secret.SecretBox.KEY_SIZE, password, salt,
                 opslimit=ops, memlimit=mem)

def encrypt(plaintext: str, password: str) -> bytes:
    """
        pynacl includes the nonce (iv), tag, and ciphertext in the result from box.encrypt.

        According to the pynacl docs, the returned value will be exactly 40 bytes longer
        than the plaintext as it contains the 24 byte random nonce and the 16 byte MAC.
    """
    plaintext = plaintext.encode('utf-8')
    key = _keygen(password)
    box = nacl.secret.SecretBox(key)
    encrypted = box.encrypt(plaintext)
    return encrypted

def decrypt(encrypted: bytes, password: str) -> str:
    """
        We first decrypt the ciphertext using pynacl into a bytes object.

        We then use Python's UTF-8 decoder to convert that to a string.

        This function is only used in sopen.py. It is not used in screate.py.

        WARNING: This function NEEDS to be wrapped in a try-catch block, because decryption and decoding can and will raise exceptions.
    """
    key = _keygen(password)
    box = nacl.secret.SecretBox(key)
    plaintext = box.decrypt(encrypted)
    plaintextstring = plaintext.decode('utf-8')
    return plaintextstring

Create a file function (screate.py):

import os, sys, getpass
from cryptotest import encrypt

def getpassword() -> str:
    """
        This function has been manually tested.

        It successfully detects and exits when user enters a blank password,
        or when the user enters 2 passwords that don't match.
    """
    password1 = getpass.getpass("Enter a password: ")
    password2 = getpass.getpass("Enter the password again: ")
    if password1 != password2:
        print("Passwords do not match.")
        exit(1)
    if not password1:
        print("YOU MUST ENTER A PASSWORD!")
        exit(1)
    return password1

def createfile(filename: str) -> str:
    # create the file
    print("You will now be asked to enter a password for the new file.")
    try:
        password = getpassword()
    except Exception as e:
        print(e)
        exit(1)
    try:
        with open(filename, 'xb') as f:
            ciphertext = encrypt("You can write your stuff in this file.", password)
            f.write(ciphertext)
            print("File " + filename + " was successfully created.")
            print("You can open the file with the following command:")
            print("    python3 sopen.py " + filename)
    except Exception as e:
        print(e)
        print("An error occurred while creating the file. See above.")
        exit(1)

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: screate.py filename")
        exit(0)
    fn = sys.argv(1)
    fn = os.path.abspath(fn) # just for insurance.
    createfile(fn)

File open function (sopen.py):

import sys
import os.path, getpass
import shutil
import filecmp
import random

class bcolors:
    HEADER = '33(95m'
    OKBLUE = '33(94m'
    OKGREEN = '33(92m'
    WARNING = '33(93m'
    FAIL = '33(91m'
    ENDC = '33(0m'
    BOLD = '33(1m'
    UNDERLINE = '33(4m'

TEAL = '#008080'
BROWN = '#800000'
GREY = '#808080'

def goodmsg(msg):
    print(bcolors.OKGREEN + msg + bcolors.ENDC)

def badmsg(msg):
    print(bcolors.FAIL + msg + bcolors.ENDC)

def error_out(msg: str):
    badmsg("Error: " + msg)
    getpass.getpass("Press enter to exit.") # This is to capture the user's password if he enters it inadvertently.
    exit(1)

if sys.version_info(0) < 3:
    error_out("You must use Python 3")

from cryptotest import encrypt, decrypt

class WindowManager(object):
    def getSearchboxContents(self):
        return self.searchbox.get()

    def getTextboxContents(self):
        return self.text.get("1.0", "end-1c")

    def savefile(self, event=None):
        """
            When we save a file, we need to make sure it can be decrypted again.

            To this end, we first try to save it in a tmp file, once that succeeds, 
            we then replace the original with the tmp file.
        """
        plaintext = self.getTextboxContents()
        self.curSavedFileContents = plaintext
        # We need to check that we can open the file again. If not, we need to re-save the file.
        # This loop exits once we've confirmed that we can decrypt the file we've just saved, or when we've tried 10 times.
        # To this end, we use a temporary file so that we don't lose the original.
        tempfilename = self.filename + ".tmp"
        success = False
        for i in range(10):
            # Since we immediately close the file, this should force a write to disk on save.
            with open(tempfilename, "wb") as f:
                f.write(encrypt(plaintext, self.password))
            # We then open the file to check if we can decrypt it.
            with open(tempfilename, "rb") as f:
                wholetext = f.read()
            try:
                if plaintext == decrypt(wholetext, self.password):
                    self.dirty = False
                    # We only change the window color after the file has been written to and closed successfully.
                    self.frame.configure(bg=TEAL)
                    goodmsg("Temp file saved successfully.")
                    success = True
                    break
            except Exception as e:
                badmsg(e)
                badmsg("Error encountered trying to decrypt/decode file, see above.")
                badmsg("This is attempt #" + str(i))
        if success:
            # successful, replace original file with tmp file.
            # we also update the backup copy, and check that they are bit-for-bit identical.
            os.remove(self.filename)
            os.rename(tempfilename, self.filename)
            goodmsg("Original successfully replaced by temp file.")
            backupfilename = self.filename+".backup"
            for _ in range(5):
                shutil.copy(self.filename, backupfilename)
                if not filecmp.cmp(self.filename, backupfilename):
                    badmsg("ERROR: backup file is not identical to original.")
                else:
                    goodmsg("Backup file successfully saved and checked.")
                    break
            else:
                badmsg("Warning: File was not backed up.")
        else:
            # failed, delete temporary file.
            os.remove(tempfilename)
            badmsg("ERROR: FILE NOT SAVED.")

    def checkUnsavedChanges(self, event=None):
        # check if saving
        # if not:
        if self.dirty:
            if messagebox.askyesno("Exit", "THERE ARE UNSAVED CHANGES! Do you want to quit the application?"):
                if messagebox.askokcancel("Exit", "THERE ARE UNSAVED CHANGES!! ARE YOU SURE you want to quit the application?"):
                    win = tk.Toplevel()
                    win.title('warning')
                    message = "This will delete stuff"
                    tk.Label(win, text=message).pack()
                    buttons = (
                        tk.Button(win, text='No!', command=win.destroy),
                        tk.Button(win, text='Delete', command=self.root.destroy),
                        tk.Button(win, text='Noo!', command=win.destroy),
                        tk.Button(win, text='Don't delete!!', command=win.destroy)
                    )
                    random.shuffle(buttons)
                    for button in buttons:
                        button.pack()
        else:
            self.root.destroy()

    def ismodified(self, event):
        plaintext = self.getTextboxContents()
        if plaintext != self.curSavedFileContents:
            self.frame.configure(bg=BROWN)
            self.dirty = True
        else:
            self.frame.configure(bg=TEAL)
            self.dirty = False
        self.text.edit_modified(0)  # IMPORTANT - or <> will not be called later.

    def on_focus_out(self, event):
        if event.widget == self.root:
            self.frame.configure(bg=GREY)

    def on_focus_in(self, event):
        if event.widget == self.root:
            if self.dirty:
                self.frame.configure(bg=BROWN)
            else:
                self.frame.configure(bg=TEAL)

    def focus_search(self, event):
        self.searchbox.focus()
        self.select_all_searchbox(event)

    def clear_highlights(self, event):
        self.in_search = False
        self.srch_idx = '1.0'
        self.text.tag_remove('found', '1.0', tk.END)
        self.text.tag_remove('found_cur', '1.0', tk.END)
        self.msglabel('text') = ''

    def search_highlight(self, s):
        """
            Given a search string s, highlight all occurrances of it in the text.
        """
        self.text.tag_remove('found', '1.0', tk.END)
        if s:
            idx = '1.0'
            while 1:
                idx = self.text.search(s, idx, nocase=1, stopindex=tk.END)
                if not idx: break
                lastidx = '%s+%dc' % (idx, len(s))
                self.text.tag_add('found', idx, lastidx)
                idx = lastidx
            self.text.tag_config('found', background='magenta') #firefox search highlight colors
            self.text.tag_raise("sel") # allow highlighted text to be seen over search highlights

    def find_next(self, needle):
        self.text.tag_remove('found_cur', '1.0', tk.END)
        idx = self.text.search(needle, self.srch_idx, nocase=1, stopindex=tk.END)
        if not idx:
            self.srch_idx = '1.0'
            self.msglabel('text') = 'No more search results.'
            return
        self.msglabel('text') = ''
        lastidx = '%s+%dc' % (idx, len(needle))
        self.srch_idx = lastidx
        self.text.tag_add('found_cur', idx, lastidx)
        self.text.tag_config('found_cur', foreground='red', background='green') #firefox search highlight colors
        self.text.tag_raise("sel") # allow highlighted text to be seen over search highlights
        self.text.see(idx) # scroll the textbox to where the found text is.

    def text_search(self, event):
        needle = self.getSearchboxContents()
        if not self.in_search:
            self.in_search = True
            self.search_highlight(needle)
        self.find_next(needle)

    # This is to move the cursor to the end of the line when you click on some empty space at the end of the line.
    # Default behavior is really annoying as it moves the cursor to the beginning of the next line if you click past half of the whitespace.
    def on_text_click(self, event):
        line = event.x
        column = event.y
        index = self.text.index("@%d,%d" % (event.x, event.y))
        self.text.mark_set("insert", index)

    # Select all the text in textbox
    def select_all(self, event):
        self.text.tag_add(tk.SEL, "1.0", tk.END)
        return 'break'

    # Select all the text in searchbox
    def select_all_searchbox(self, event):
        self.searchbox.select_range(0, tk.END)
        return 'break'

    # Select current line in textbox
    def select_line(self, event):
        tk.current_line = self.text.index(tk.INSERT)
        self.text.tag_add(tk.SEL, "insert linestart", "insert lineend+1c")
        return 'break'
        #after(interval, self._highlight_current_line)

    def __init__(self, root, filename, contents, password):
        # initialize "global" variables
        # These variables refer to the elements inside the UI
        # For example, self.text refers to the main text box, self.searchbox refers to the search box, and so on.
        self.root = root
        self.filename = filename
        self.curSavedFileContents = contents
        self.password = password
        self.dirty = False
        self.frame = tk.Frame(root, bg=TEAL)
        self.text = tkst.ScrolledText(
            master=self.frame,
            wrap='word',  # wrap text at full words only
            width=80,      # characters
            height=30,      # text lines
            bg='beige',        # background color of edit area
            undo=True
        )
        self.searchframe = tk.Frame(root)
        self.searchlabel = tk.Label(self.searchframe, text='Search text:')
        self.searchbox = tk.Entry(self.searchframe)
        saveframe = tk.Frame(root)
        self.msglabel = tk.Label(saveframe, text='')

        # initialize text editor window UI
        self.root.wm_title("sedit")
        self.frame.pack(fill='both', expand='yes')
        self.text.bind('<>', self.ismodified)
        self.root.bind("", self.on_focus_in)
        self.root.bind("", self.on_focus_out)
        self.searchlabel.pack(side=tk.LEFT)
        self.searchbox.pack(side=tk.LEFT, expand=True, fill='both')
        self.msglabel.pack(side=tk.LEFT)
        self.searchframe.pack(fill=tk.X)
        button = tk.Button(saveframe, text="Save", command=self.savefile, padx=8, pady=8)
        button.pack(side=tk.RIGHT)
        saveframe.pack(fill=tk.X)
        # the padx/pady space will form a frame
        self.text.pack(fill='both', expand=True, padx=8, pady=8)
        self.text.insert('insert', contents)
        self.frame.configure(bg=TEAL)
        # On Mac, Command binds to the cmd key. On Windows it binds to the ctrl key.
        self.root.bind_all("", self.checkUnsavedChanges)
        self.root.bind_all("", self.savefile)
        self.text.bind("", self.select_all)
        self.text.bind("", self.select_line)
        self.in_search = False
        self.srch_idx = '1.0'
        self.text.bind("", self.focus_search)
        self.searchbox.bind("", self.text_search)
        self.root.bind("", self.clear_highlights)
        self.searchbox.bind("", self.select_all_searchbox)
        self.root.bind("", self.on_text_click)
        self.root.protocol('WM_DELETE_WINDOW', self.checkUnsavedChanges)  # root is your root window





def openfile(filename: str, password: str):
    #1. Open file and try to decrypt it.
    with open(filename,"rb") as f:
        s = f.read()
    contents = decrypt(s,password) # An exception here is fine as we can terminate here no problems.

    #2. Main window setup
    root=tk.Tk()
    WindowManager(root, filename, contents, password)

    #3. main loop
    root.mainloop()





if __name__ == "__main__":
    if len(sys.argv) != 2:
        error_out("You must supply exactly one command line argument to open.py")

    filename = sys.argv(1)
    filename = os.path.abspath(filename) # just for insurance.

    # Check if file exists
    if not os.path.isfile(filename):
        error_out("File not found.")

    goodmsg("sedit: Found file "+filename+".")

    password = getpass.getpass("Enter the password to decrypt the file: ")

    # All these GUI imports take a while, so we only do it after the user enters the right password.
    # This is to allow the user to enter the password immediately after starting this program.
    import tkinter as tk
    from tkinter import messagebox
    import tkinter.scrolledtext as tkst

    openfile(filename, password)

the screate.py and sopen.py the files are intended to be executed alone, with a file name provided as a parameter. The user first creates a file using screate.py filename then he opens it with sopen.py filename, which will open the GUI. The keyboard shortcuts for the GUI are:

  • Ctrl-s to save the file
  • Ctrl-w to close the editor
  • Ctrl-a to select all
  • Ctrl-l to select the current line
  • Ctrl-f to enter search mode and search for text
  • Esc to exit search mode

block editor – custom wordpress gutenberg URL popover options

So basically I want a link to be only clickable / active on the mobile display window. I have CSS that works, but it's just implementing it now. So I think there are 2 options for this:

Option 1:
The way I see it is that I could create a new button on the editor format toolbar with the same functionality as the link insert button, but in the custom button, it has a class.

Option 2:
or the other way could be to add another toggle option to be able to add a class to the current url popover. I have seen this in some plugins. I just don't know how to do it.

Any advice would be helpful.

also has a picture to explain it better.

enter description of image here

plugins – dynamically add editable fields from the wordpress editor using elementor

I am a designer working with the elementor plugin and my goal is to get the ability to dynamically add as many fields of a certain element as I need in a page template made with elementor and make these fields individually editable as well.

For example, I have an accordion element and I want to have nested accordions with custom text in each nested accordion. I know i can add accordions inside other accordions using elementor templates and shortcuts but what i want is to make this content editable individually… so if I add 3 of these nested accordions I want everyone to have their own different content
On top of that, I want to know if there is a way to make adding dynamic content dynamic.

Edit default template in block editor (Gutenberg)

I want to replace the default template of my pages with a template called fullwidthpage.php.

I saw this question posted and answered for pre-Gutenberg WordPress, but I did not find a working answer for Gutenberg WordPress (version 5.3.2 at the time of this question).

This is the non-functional answer that I have found. When I try the non-functional response, the model is set to fullwidthpage.php but when I try to update the page, I get a message that says "The update failed".

filters – add_filter (allowed_block_types) -> added basic bugs / Gutenberg editor paragraph

I'm facing a strange problem with the "core / paragraph" block:
An already functional "allowed_filter_types" (see code below), with basic and custom blocks, starts to shake up the Gutenberg editor, once I add the "kernel / paragraph" to the table $ allowed_blocks.

My problem :
The block appender at the bottom of the editor disappears, so I can't easily add a new block.

The paragraph block itself works well however.

I also have a custom container block, which works well.
But, in the same way, once I add "core / paragraph" in its authorized blocks, the block-appender inside of it also disappears.

Could anyone know where it could come from?
(I'm building a theme from scratch, maybe I should call this kernel / paragraph first somewhere else? I didn't have to do it with the other kernels / blocks though.)

Thanks for reading, I hope you can help!

Here is the code:

For the add_filter:

add_filter( "allowed_block_types", "filter_allowed_block_types", 10, 2 );
function filter_allowed_block_types( $allowed_blocks, $post ) {

   if( $post->post_type == "my_post_type" ) {
      $allowed_blocks = array(
         "core/heading",
         "core/image",
         "core/gallery",
         "core/video",

         "core/paragraph",

         'my-custom-container'
      );
   }
return $allowed_blocks;
}

For my custom container: (did not add attribute content, works)

edit( { attributes, setAttributes } ) {

   let allowedBlocks = (
      'core/heading',
      'core/paragraph',
      'core/image',
      'core/gallery',
      'core-embed/instagram',

      'core/video',
      'core-embed/youtube',
      'core-embed/vimeo'
   );

   return((
      
)); }, save( { attributes } ) { return (
); }