php – How can I stop ActionScheduler recurring task running after 5 runs?

I am using the ActionScheduler library from WooCommerce as_schedule_recurring_action() function, and am trying to find a way to stop recurring tasks running after 5 runs.

I have not seen any parameter that allows for this sort of recurring limit.

Is there a way to do it that I’m simply not aware of? Or will there be a need to create a wrapper around this to enable that particular functionality.

Using IIS 10 (PHP yes) what is the best practice for allowing iframes of a site?

I have a W2016 server with IIS 10 running on it and I am having problems implementing policy (used to apache) on how to add in the correct headers for Content Security Policy/CORS/X-frame. It seems that IIS has gone out of its way already to add SAMEORIGIN by default, as I don’t see it listed anywhere (the server or the site in question).

So what is the best way to ensure that mysite.example.com can be iframed into any site and also if I want to lock down iframing can I have a policy to allow iframing on the wildcard of the root – so *.example.com.

php – WordPress schedule event function not running

I am totally new with the schedule event from WordPress.
For my theme I created a function that must run every minute.
To test my scheduler I created a test function that send me an email.
But I do not receive an email and I think my scheduler is not working.
Please who can help me a bit?
Below my code so far

add_action( 'my_test', 'test_scheduler');
add_filter( 'cron_schedules', function ( $schedules ) {
   $schedules('per_minute') = array(
       'interval' => 60,
       'display' => __( 'One Minute' )
   );
   return $schedules;
} );

//create event after theme setup
add_action("after_setup_theme", function(){
    if (! wp_next_scheduled ( 'my_test' )) {
        wp_schedule_event( time(), 'per_minute', 'my_test' );
    }
});

//delete event if theme is deactivated
add_action('switch_theme', function(){
    wp_clear_scheduled_hook( 'my_test' );
});

The code above is in the functions.php file.

php – error en mediasmoviles chartseries en RStudio

Una manera para analizar cambios de
tendencia sobre las criptomonedas es utilizando
medias móviles sobre las series temporales.
Por cada moneda debe construir tres nuevas series,
considerando una media móvil a 40, 20 y 10 días.
Construya una función en R que retorne una nueva
serie construida a partir de medias móviles. Esta
función debe recibir como parámetros de entrada: la
serie de datos original de la moneda en análisis y el
número de días a considerar en la media móvil.
Genere un gráfico de líneas que considere la serie
original y las tres series con medias móviles. Analice
las tendencias de las tres medias móviles y describa
sus hallazgos.
Denomine a su función:
“funcion_medias_moviles”

al intentar de solucionar este problema pongo esto:

candleChart(df_bitcoin,name="MEDIAMOVIL",theme = "white",
            subset = "2020-03-01": "2021-02-28",
            TA="addVo();addSMA(n=40,col=2);addSMA(n=20,col=3);addSMA(n=10,col=4)")

y siempre me aparece este error:

Error in try.xts(x, error = "chartSeries requires an xtsible object") : 
  chartSeries requires an xtsible object

por favor si alguen sabe solucionar en que parte me estoy equivocando

php – WordPress VS React?

Our website is currently built on WordPress…most of the website (homepage, blogs, pages, etc…)
We use React for parts of the website (product and equipment pages that use facets/filters to sort through products).

WordPress is fairly simple to work with, but can get buggy with conflicting plugins, updating WordPress versions, etc… However creating page templates, pages, blogs, etc… is fairly simple and quick to work with. All pages are fully responsive for desktop and mobile.

I want to keep elements of the website with WordPress (homepage, blogs, pages, etc…) due to their ease of use and great page speed.
Some people at our company want to convert everything to React and get rid of WordPress.

Any reasons why we should keep parts of the website in WordPress and not convert to React?

Create PHP contact form using php

Hi, I’m a new intern at a company and I’m trying to create a website with a contact form that emails a specific address when filled out. I d… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1843761&goto=newpost

php – Searching for best practice – Long calculating method

I’m working on a Laravel project for engineers. The software calculates the stability and pressure for specific wooden connections.
As you can imagine, depending on the connection, there are many calculations with many values to be done.

First, there was the approach make one calculation function / method for one connection type (inside the connection type class), where all neccessary fields are calculated.
Then it came up to my mind, to create a method to calculate each value seperately:

public function calculateConnection($connectionValues) {
   $connection->a = $this->getAValue($connectionValues);
   $connection->b = $this->getBValue($connectionValues);
   ...
}

public function getAValue($connectionValues) {
   return ...
}

public function getBValue($connectionValues) {
   return ...
}

I have a much better overview about the specific values, when creating a function for each value instead of calculating everything in one method, but the issue is, that the values are depending on each other. So value a is needed to calculate b.

So all methods need to be called in the correct order. Of course, I can do a check, if a is already been calculated, before doing the calculation of b, but this will blow up the code so much.

I’m interested, what is best-practice in this kind of situation.

php – No me accede al array

Tengo un problemilla acerca del foreach y es que creo que no me accede al Array donde tengo almacenado el usuario y contraseña, por lo tanto no consigo que se loguee.

PD: Adjunto archivo del foreach y el archivo de usuarios

require_once(“functions.php”); require_once(“usuarios.php”);

   $errores = "";     if(isset($_POST('enviar'))) {
  $user = $_POST('usuarioname');
  $password = $_POST('contraseña');
  if(!empty($user && $password)) {
     $user = trim($user);
     $password = trim($password);
     if(UsuarioValidado($user)) {    
        foreach ($users as $login => $valor) {                
           if ($user == $login && $password == $valor) {
              session_start();
              $_SESSION("usuario") = $user;
              header("Location: paneladministracion.php"); 
           }
           else {
              $errores .=  "Usuario o contraseña incorrectos";
              break;
           }
        }
     }
     else {
        $errores .= "En el campo usuario, solo se admiten cadenas de texto";
     }
  }
  else {
     $errores .=  "Por favor rellene los campos"; 
  }    }

‘admin’,
‘pwd’ => ‘123456’,

);

?>

Php string not working in WordPress Function

I tried multiple options to add the second block code to the first block at the line ".wp_get_post_categories ($post_id)." but I could not find any solution. Please help me with that and if you need closer to the code just let me know.

$related_blog .="<div class='related-blog'>
                            <div class='row'>
                                <a href=".get_the_permalink().">
                            
                                    <div class='col-lg-4 col-md-4 col-xs-4 blog-image'>
                                        <img src=".$image_related(0).">
                                    </div>

                                    <div class='col-lg-8 col-md-8 col-xs-8 blog-text'>
                                        <strong><p class='related-blog-title'>".get_the_title()."</p></strong>
                                </a>
                                <span class='related-blog-sidebar-content '>".substr(get_the_content(),0,250)."...</span>
                                
                                <p class='related-blog-sidebar-category'>
                                ".wp_get_post_categories ($post_id)."                               
                                </p>
                                
                                <a class='related-blog-sidebar-link' href=".get_the_permalink().">Read More
                                </a>

                                    </div>
                            </div>
                        </div>";
<?php $category = get_the_category(); ?>
<a  href="<?php echo get_category_link($category(0)->cat_ID); ?> ">
<?php echo $category(0)->cat_name; ?> </a>

mysql – insert into table with default values from a select statement in php

this is the code without the variables

$sql1 = "INSERT INTO new_table (st_id,t_id,date,status) SELECT s_id, 't1234','1000-10-10','0' 
        FROM student_courses WHERE course1 = 'cs402' OR course2 = 'cs402' OR course4 = 'cs402' OR course4 = 'cs402'; ";

this works
but when i put in the variables it doesn’t

this is the sql code i have written

$course_name = "Data Mining and Ware Housing";

$table_name = "new_table";

$t_id = 't1234';

$time = time();

$c_id = 'cs402';

$sql1 = "  INSERT INTO " . $table_name . "(st_id,t_id,date,status)
        SELECT s_id, '" . $t_id . "', '" . $time . "'  ,'0' 
        FROM student_courses WHERE course1= '" . $c_id . "'  OR course2= '" . $c_id . "'  OR course3= '" . $c_id . "' OR course4='" . $c_id . "';";

but the details are not getting entered

new_table(id,st_id,t_id ,date ,status)
student_courses(s_id,course1,course2,course3,course4)