Data being passed around in WooCommerce functions - woocommerce

Since PHP isn't strongly typed, is there a central documentation I can read to figure out data being passed around in woocommerce functions?
P.S. - woocommerce.github.io and classes reference did not help

Related

Relationships between custom taxonomies in WordPress

I’m interested in defining relationships between custom taxonomies but I’ve been unable to find much in the way of documentation on this topic. Perhaps this can be done using the Pods framework (?), but I'm not sure. What I’d like to be achieved is the following:
There’s the ‘found_object’ custom post type.
There’s the ‘materials’ custom taxonomy for terms like plastic, wood, glass, etc. attached to the ‘found_object’ post type.
There’s also the ‘physical_properties’ custom taxonomy for, say, electrical conductivity and other properties that a given material is known to possess.
I would like to assign the above properties to my materials so that the physical_properties taxonomy terms for each of the found_objects get auto-populated once the materials of an object are selected. Or to reiterate: if an object has one or more materials assigned to it manually this will automatically assign all the properties of these materials to the object and different materials should obviously be allowed to share the same properties.
I need this to let the user arrive at these objects by filtering them by physical properties directly (not by materials per se) using the FacetWP plugin.
I vaguely understand that this can hopefully be done using the Pods plugin by setting up a relationship between my taxonomies by creating a relationship field. But other than that I don’t quite understand what to do.
I would greatly appreciate your help or suggestions.
Kind regards, Svetlana.
The problem can be solved by using the Pods framework in tandem with the FacetWP plugin (by taking advantage of one of its indexer hooks) as is demonstrated here (with the link to the relevant code snippet included).

Add same child object in different parents firebase

I am trying to add objects into firebase real time database, so far, i have been creating the same object for different parents. My question is how to save the same object in different parents. So far I am not saving with code, just in firebase console.
Pic to help understand.
This is the structure Pais>Belgica>Partidos>2>Estadio and this stadium is Spartak Stadium
And I want to add the same Stadium that is in Belgica into my Tunez>Partidos>Estadio>2 with out creating a new Object, is there a way to tell firebase that this object is the same as the on in Belgica. Thanks in advance.
There is no real way to relate something elsewhere in the database to
what you are doing unless you save it yourself in both places.
However, there is another option. Cloud Functions are extremely powerful tools and are fantastic for data consistency. You can take a look at some of the samples Firebase has put out there for just this instance:
https://github.com/firebase/functions-samples/blob/master/README.md

Which WordPress Developer Documentation is More Up-to-date? codex.wordpress.org or developer.wordpress.org

I have come across WordPress developer documentation at codex.wordpress.org and developer.wordpress.org. They both have documentation on plugins and themes. Since I don't know the history of the wordpress.org website, I don't know which set of documentation is most up-to-date.
developer.wordpress.org is newer and more up-to-date than codex.wordpress.org. The latter exists because it's more complete documentation wise. Codex is likely to go away once the former catches up.
Either one you use should be fine, though. Most deprecated functions have been clearly identified / documented in Codex.
I have now confirmed what #cabrerahector and others have said is correct.
If you are looking for tutorial-like (aka handbook) information (useful when learning WordPress), then developer.wordpress.org does a better job.
If you are looking for reference information then both are useful, in its current state. I usually reach out to developer.wordpress.org first.
I've found that the codex.wordpress.org variation does a better job at listing related functions. When looking at a function reference in developer.wordpress.org, there is a "Related" section that lists the functions used by the function and a list of functions that call the function but it rarely gives a complete list of the related functions. Take the documentation for the get_stylesheet_directory function as an example. See the developer.wordpress.org variation at https://developer.wordpress.org/reference/functions/get_stylesheet_directory/ and the codex variation at https://codex.wordpress.org/Function_Reference/get_stylesheet_directory. Notice that the developer.wordpress.org variation does NOT list any of the following related functions: get_stylesheet_directory_uri, get_stylesheet_uri, get_template_directory, get_template_directory_uri, get_theme_file_path, or get_theme_file_uri among others.
The developer.wordpress.org variation appears to be auto-generated from the source code. Some functions have an #see annotation which shows up in the online documentation.
The developer.wordpress.org variation includes the source code which has been useful.
It looks like the server two different purposes. The codex contains a lot of information in and around wordpress. The developer documentation seems to be a quick reference to functions and source code locations, likely for those hardcore wordpress developers who don't want to wade through the full codex.
Thats what it appears to me, but I simple just compared wp_query on both, and received vastly different results.
https://codex.wordpress.org/Class_Reference/WP_Query
https://developer.wordpress.org/reference/classes/wp_query/
in fact https://developer.wordpress.org is a handbook for those who don't want to read a page with details and explanation (https://codex.wordpress.org).
developer.wordpress has a quick reference for developers.

How do I use the Frama-C WP plugin to calculate weakest precondition formulae?

I'm implementing a static anaylsis as a plugin for Frama-C and as a part of this analysis I need to generate weakest precondition formulae.
I have found this related question, How do I use the results of WP in another plug-in? , however the answer only amounts to that there is an API for the WP plugin, not how to use it for this specific task.
The WP API documentation is mostly a reference list of types, functions and classes and contains very little information about how the different parts fit together and how they are intended to be used (I'm new to Ocaml so maybe I have missed something "obvious" here). I have spent some time with the API documentation, the WP Plugin Manual as well as the Frama-C Developer Manual but I have only been able to get the verification conditions generated by the WP plugin, not a raw weakest precondition formula as the result of a wp predicate transformer.
Is there a way, preferably exposed in the WP API, to generate a weakest precondition formula for a given function and input formula?
If there is a way to do this, what modules should I be looking at and roughly what would the workflow look like? E.g. should I run the WP plugin normally and somehow extract the result or invoke only some select functions needed for wp calculation?
Edit:
My search has led me to investigate the following function which looks promising:
Calculus.Cfg.compute : Cil2cfg.t ->
WpStrategy.strategy ->
W.t_prop list * (Format.formatter -> Cil2cfg.edge -> unit)
Is using this function for an instantiation of the Calculus.Cfg functor a correct approach? If this is the case, what is the purpose of a WpStrategy.strategy in this context and how do I properly construct it? (These are different from the strategies mentioned in the manual, right?)

Kotlin KFunction reflection - get parameter values

In order to create a simple annotation that logs function calls, I'm trying to grab the following attributes from a function that has said annotation:
Function name
Parameter names
Parameter values
What I have so far uses KCallable as a value, which makes grabbing the name and names from the list of KParameter fairly simple. However, I cannot figure out how to get the values of said parameters to make the log statement more contextual.
Does anyone have ideas on grabbing these parameters values within the annotation? It doesn't need to use KCallable, that just seemed like the most intuitive receiver.
You will need a different approach. Annotations and parameter type are a compile time features while values are a runtime feature.
What you will have to do is use a bytecode processing framework like ASM or google "aspect oriented programming". That allows you to examine the generated bytecode and modify if before the JVM tries to execute it.
The other approach is to write a Kotlin compiler plugin which generates the necessary code (google "Writing Your First Kotlin Compiler Plugin")
This blog post contains an example for Java and Spring using the AOP approach: https://solocoding.dev/blog/eng_spring_centrlize_logging_with_aop
I recommend the compiler plugin because the other approach is much more complicated, brittle and badly documented. Use AOP only if you find a framework which already contains all the features you need.

Resources