I have a custom redux store using createReduxStore in my Gutenberg block and I need to access some of the store data on the server side in php.
Let's say my store has a value called css which I would access in javascript like this
wp.data.select('mystore/css').getCss();
Now I need to access this data on the server side using PHP so I can save a file using the filesystem.
How would I go about accessing the store css data?
Related
I am new to Sapper and am trying to figure out how to handle data from an API that should be shared across multiple routes.
Take for example a logged in user object from an API. There are multiple routes where I would need this data and want it to be preloaded, but don't want to fetch the data from my API more than once (I believe I am right in thinking that the preload function will run on each page navigation).
In an SPA built with plain Svelte, I would fetch this kind of data once on the client and use a store to share the data between the pages.
It doesn't seem possible to access stores in my preload function, so how do I share this data between routes?
I'm building a UI in Google Appmaker to manage the Domain Shared Contacts API. I can read and display data from the API in appmaker using a calculated model, but I cannot save data back into the API.
I tried adding a form widget with the calculated model as a datasource, but this is a read / view only form. This is when i found out calculated data sources are always read-only in app maker.
I then created an SQL datasource and made an event that queries the Domain Shared Contact API which then creates records and saves them to the SQL Model. I was thinking about using the standard form widget and then in the events beforeSave, beforeDelete, etc to write the record to the API.
However this feels dirty to me, since now I have to keep the SQL model synchronized with the API, need to have an SQL server running, etc.
Does anyone have any tips on the best way to write data from a form in appmaker to a REST API? I can't be only one with this use case.
You have to write app script function for this. https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app
I want to use my own url to interact with my Firebase database REST API. I understand that you cannot alter the default "https://myapp.firebaseio.com/" from within the app. I am wondering if it is possible to do this externally through some form of url-rewriting?
If so, what are the elements required & are there any complications to overcome (particularly with https)?
I have a WordPress website with custom tables that I store data into that was entered by customers. The site owner wants to develop a barcode app that can access this data. When I need the data from these fields to display within the site, I request it from a PHP script running on the server that make calls like get_post_meta().
The owner has hired a mobile app consultant who believes that, if he just has the password to the account where the site is hosted, he can access all of these database fields from the app.
I'm not seeing how this is possible. My understanding is that a mobile app can only access a site by making HTTP requests to it. It has no way of running on the server and executing things like get_post_meta().
Am I missing something?
Thanks
I think you are missing something. Wordpress now has a rest api https://developer.wordpress.org/rest-api/ that can allow a mobile application get at data in your database by making http requests.
The developer will need to be able to enable the Rest Api, but if you give her the password, she will probably be able to do so. Typically this is done using a plugin like: WP Rest API which enables a set of default endpoints which includes post meta data and allows you to add other endpoints
Depending on how the custom tables are set up, they might not be automatically available to the Rest API. However, if you are able to access them using get_post_meta() then I would expect that they would be accessible to the Rest API as well, most likely by adding endpoints.
What is the recommended way of disabling a template from loading in the client that depends on a boolean server variable?
I want to switch on/off certain features of a website whether if it's on staging or production, I am doing this with server variables, but I wonder what is the safest way to get this info on the client side, I wouldn't want to be possible to a client user to activate a certain functionality on the client side.
I'm using Blaze + iron router + no user accounts
Three possibilities:
Create a utility collection that is automatically published to all users with Meteor.publish(null,function(){}). Include documents and keys that will control the UI. Disable client-side updates, except possibly from your admin panel.
Add keys to the user object that control the UI. Make sure these are published to the client and then check them in your helpers.
Create a utility collection that is indexed by userId and/or session id and that contains the required keys. Sync that to the server for the current user and/or session.
It's always going to be preferable to synchronize the state of the server using pubsub rather than with repeated method calls. The former will be reactive, the latter will not.