Hook automatic_updates_complete to autoupdate plugin

I found a solution: function my_function_to_run_on_autoupdate(array $results ): void { // Iterate through the plugins being updated and check if ours is there. foreach ( $results[‘plugin’] as $plugin ) { if ( isset( $plugin->item->slug ) && strlen( $plugin->item->slug ) > 0 // ‘your-plugin-slug’ is usually the folder name of your plugin && $plugin->item->slug === ‘your-plugin-slug’ … Read more

How can I send api calls from my plugin?

You can check this: $api_endpoint=”https://url_to_API”; $api_args = array( ‘method’ => ‘GET’, ‘headers’ => array( ‘Accept’ => ‘application/json’, ‘any’ => ‘other’ ) ); $queries = array( ‘your_query’ => 1, ‘another_query’ => 5, ); $api_endpoint = add_query_arg( $queries, $api_endpoint ); $response = wp_remote_request( $api_endpoint, $api_args ); $response_code = wp_remote_retrieve_response_code( $response ) $data = json_decode( wp_remote_retrieve_body( $response ), … Read more

PHP Creating a formula from mysql db values and db stored math operator

ok, i managed to get it to work with this $amount1 = $invoice_amount; $operator = $invoice_operator; $amount2 = $invoice_multiplier; $rvalue = mcalc ($amount1,$operator,$amount2); function mcalc ($amount1,$operator,$amount2) { if($operator==”+”) $result=$amount1+$amount2; else if($operator==”-“) $result=$amount1-$amount2; else if($operator==”x”) $result=$amount1*$amount2; else if($operator==”/”) $result=$amount1/$amount2; return $result; } echo $rvalue;