Snippets Collections
 Sales::query()->where('this', $that)->get()->groupBy('product.name'); // OR

 Sales::query()->where('this', $that)->get()->groupBy('product.status.name');
/* Dynamic Button for Simple & Variable Product */

/**
 * Main Functions
*/

function sbw_wc_add_buy_now_button_single()
{
    global $product;
    printf( '<button id="sbw_wc-adding-button" type="submit" name="sbw-wc-buy-now" value="%d" class="single_add_to_cart_button buy_now_button button alt">%s</button>', $product->get_ID(), esc_html__( 'Buy Now', 'sbw-wc' ) );
}

add_action( 'woocommerce_after_add_to_cart_button', 'sbw_wc_add_buy_now_button_single' );



/*** Handle for click on buy now ***/

function sbw_wc_handle_buy_now()
{
    if ( !isset( $_REQUEST['sbw-wc-buy-now'] ) )
    {
        return false;
    }

    WC()->cart->empty_cart();

    $product_id = absint( $_REQUEST['sbw-wc-buy-now'] );
    $quantity = absint( $_REQUEST['quantity'] );

    if ( isset( $_REQUEST['variation_id'] ) ) {

        $variation_id = absint( $_REQUEST['variation_id'] );
        WC()->cart->add_to_cart( $product_id, 1, $variation_id );

    }else{
        WC()->cart->add_to_cart( $product_id, $quantity );
    }

    wp_safe_redirect( wc_get_checkout_url() );
    exit;
}

add_action( 'wp_loaded', 'sbw_wc_handle_buy_now' );

/* Dynamic Button for Simple & Variable Product Closed */
விடுப்பா விடுப்பா இமயமலையில் அதிசயம் இருக்கரதும் 🙋🏻🙋🏻
இனிப்பு கடையில் அதிரசம் இருக்கரதும் சகஜம் தானபா..😍
$host = '127.0.0.1';
$db   = 'test';
$user = 'root';
$pass = '';
$charset = 'utf8mb4';

$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$options = [
    PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES   => false,
];
try {
     $pdo = new PDO($dsn, $user, $pass, $options);
} catch (\PDOException $e) {
     throw new \PDOException($e->getMessage(), (int)$e->getCode());
}
if ($mentor->first()) { } 
if (!$mentor->isEmpty()) { }
if ($mentor->count()) { }
if (count($mentor)) { }
if ($mentor->isNotEmpty()) { }
<?php

//The example selects and prints a specific row.

$dsn = "mysql:host=localhost;dbname=mydb";
$user = "user12";
$passwd = "12user";

$pdo = new PDO($dsn, $user, $passwd);

$id = 12;

//This time we use named placeholder (:id) and bindParam.
$stm = $pdo->prepare("SELECT * FROM countries WHERE id = :id");
$stm->bindParam(":id", $id, PDO::PARAM_INT);
$stm->execute();

$row = $stm->fetch(PDO::FETCH_ASSOC);

echo "Id: " . $row['id'] . PHP_EOL;
echo "Name: " . $row['name'] . PHP_EOL;
echo "Population: " . $row['population'] . PHP_EOL;

?>
<?php

//In the example, we use bindValue to create a parameterized query. We use question mark placeholder.

$dsn = "mysql:host=localhost;dbname=mydb";
$user = "root";
$passwd = "andrea";

$pdo = new PDO($dsn, $user, $passwd);


$id = 12;

//Say this input comes from a user.
$stm = $pdo->prepare("SELECT * FROM countries WHERE id = ?");
$stm->bindValue(1, $id);
$stm->execute();

//The select statement fetches a specific row from the table. We bind the value with bindValue to a question mark placeholder.
$row = $stm->fetch(PDO::FETCH_ASSOC);

echo "Id: " . $row['id'] . PHP_EOL;
echo "Name: " . $row['name'] . PHP_EOL;
echo "Population: " . $row['population'] . PHP_EOL;

?>
<?php

//In this example, we fetch data as an associative array.

$dsn = "mysql:host=localhost;dbname=mydb";
$user = "user12";
$passwd = "12user";

$pdo = new PDO($dsn, $user, $passwd);

$stm = $pdo->query("SELECT * FROM countries");

//In the fetchAll method, we use the PDO::FETCH_ASSOC style.
$rows = $stm->fetchAll(PDO::FETCH_ASSOC);

foreach($rows as $row) {

    printf("{$row['id']} {$row['name']} {$row['population']}\n");
}

?>
<?php

//In this code example, we get data in an indexed array.

$dsn = "mysql:host=localhost;dbname=mydb";
$user = "user12";
$passwd = "12user";

$pdo = new PDO($dsn, $user, $passwd);

//We select all data from the countries table.
$stm = $pdo->query("SELECT * FROM countries");

//We pass the PDO:FETCH_NUM style to the fetchAll method.
$rows = $stm->fetchAll(PDO::FETCH_NUM);

//We go over the $rows array and print the fields. The fields are accessed via array indexes.
foreach($rows as $row) {
    printf("$row[0] $row[1] $row[2]\n");
}

?>
<?php
//The code example deletes three rows. It prints the number of affected rows.


$dsn = "mysql:host=localhost;dbname=mydb";
$user = "user12";
$passwd = "12user";

$pdo = new PDO($dsn, $user, $passwd);

$id = 12;

//In this SQL statement, we delete rows with ids 1, 2, and 3. The number of deleted rows is stored in the $nrows variable.
$nrows = $pdo->exec("DELETE FROM countries WHERE id IN (1, 2, 3)");

//We print the number of deleted rows.
echo "The statement affected $nrows rows\n";

?>
<?php

//These variables are used to create a connection string to the database. The dsn is the Data Source Name, which contains the information required to connect to the database.
$dsn = "mysql:host=localhost;dbname=mydb";
$user = "user12";
$passwd = "12user";

//A new PDO object is created. We pass the constructor the data source name and the user name and password. The PDO class represents a connection between PHP and a database server.
$pdo = new PDO($dsn, $user, $passwd);

//The query method executes an SQL statement in a single function call. It returns the result set.
$stm = $pdo->query("SELECT VERSION()");

//The PDO statement's fetch method fetches the next row from a result set. In our case it is a version of MySQL.
$version = $stm->fetch();

//The $version is an array; we get its first value.
echo $version[0] . PHP_EOL;

?>
<?php

$id = 5;
try {
  $conn = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
  $stmt = $conn->prepare('SELECT * FROM minhaTabela WHERE id = :id');
  $stmt->execute(array('id' => $id));

  $result = $stmt->fetchAll();

  if ( count($result) ) {
    foreach($result as $row) {
      print_r($row);
    }
  } else {
    echo "Nennhum resultado retornado.";
  }
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}

 ?>
<?php

$stmt->execute(array('id' => $id));

# Pega um array contendo todos os resultados
$result = $stmt->fetchAll();

# Se um ou mais resultados forem retornados...
if ( count($result) ) {
    foreach($result as $row) {
        print_r($row);
    }
} else {
    echo "Nenhum resultado retornado.";
}

 ?>
<?php
/*
 * Melhor prática usando Prepared Statements
 *
 */

$id = 5;
try {
    $conn = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $stmt = $conn->prepare('SELECT * FROM minhaTabela WHERE id = :id');
    $stmt->execute(array('id' => $id));

    while($row = $stmt->fetch()) {
        print_r($row);
    }
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}

 ?>
<?php
/*
 * Método de conexão sem padrões
 */

$name = 'Ricardo';

try {
    $conn = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $data = $conn->query('SELECT * FROM minhaTabela WHERE nome = ' . $conn->quote($name));

    foreach($data as $row) {
        print_r($row);
    }
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}

 ?>
<?php
try {
  $conn = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
    echo 'ERROR: ' . $e->getMessage();
}
?>
<?php
$conn = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
?>
<?php
$consulta = $pdo->query("SELECT nome, usuario FROM login;");


while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) {
    echo "Nome: {$linha['nome']} - Usuário: {$linha['usuario']}<br />";
}
?>
<?php
$id = 5;

try {
  $pdo = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $pdo->prepare('DELETE FROM minhaTabela WHERE id = :id');
  $stmt->bindParam(':id', $id);
  $stmt->execute();

  echo $stmt->rowCount();
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();
}
?>
<?php
    $id = $_GET["id"];
    include_once 'conexao.php';

    $sql = "delete from cliente where idcliente = ".$id;

    if(mysql_query($sql,$con)){
        $msg = "Deletado com sucesso!";
    }else{
        $msg = "Erro ao deletar!";
    }
    mysql_close($con);

    ?>
<?php

$id = 5;
$nome = "Novo nome do Ricardo";

try {
  $pdo = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $pdo->prepare('UPDATE minhaTabela SET nome = :nome WHERE id = :id');
  $stmt->execute(array(
    ':id'   => $id,
    ':nome' => $nome
  ));

  echo $stmt->rowCount();
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();
}
?>
<?php

    $nome = $_POST["nome"];
    $email = $_POST["email"];
    $tel = $_POST["tel"];
    $id = $_POST["id"];

    include_once 'conexao.php';

    $sql = "update cliente set
            nome = '".$nome."', email = '".$email."',telefone = '".$tel."'
            where idcliente = ".$id;

    if(mysql_query($sql,$con)){
        $msg = "Atualizado com sucesso!";
    }else{
        $msg = "Erro ao atualizar!";
    }
    mysql_close($con);

    ?>
<?php
try {
  $pdo = new PDO('mysql:host=localhost;dbname=meuBancoDeDados', $username, $password);
  $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  $stmt = $pdo->prepare('INSERT INTO minhaTabela (nome) VALUES(:nome)');
  $stmt->execute(array(
    ':nome' => 'Ricardo Arrigoni'
  ));

  echo $stmt->rowCount();
} catch(PDOException $e) {
  echo 'Error: ' . $e->getMessage();

   ?>
<?php
    $nome = $_POST["nome"];
    $email = $_POST["email"];
    $tel = $_POST["tel"];

    include_once 'conexao.php';

    $sql = "insert into cliente values(null,
            '".$nome."','".$email."','".$tel."')";
    //echo $sql;

    if(mysql_query($sql,$con)){
        $msg = "Gravado com sucesso!";
    }else{
        $msg = "Erro ao gravar!";
    }
    mysql_close($con);
?>
<!DOCTYPE php>
<?php 
error_reporting(null);
$city = $_POST['get'];
$Url = file_get_contents("http://api.openweathermap.org/data/2.5/weather?q=".$city."&units=metric&appid=73c340f4df1ee2a07dca01d0ce48bf48");
$data=json_decode($Url,true);
// echo "<pre>";
// print_r($data);


$dataurl=file_get_contents("https://pixabay.com/api/?key=29428143-1b7675892c7e12c1f8fdd4157&q=".$_POST['get']."&image_type=photo");
$test=json_decode($dataurl,true);
// echo "<pre>";
// print_r($test);
$flag='flag';
$back=$test['hits'][rand(1,19)]['largeImageURL'];



// echo "<pre>";
// print_r($test);
// $lon=$data['coord']['lon'];
// $lat=$data['coord']['lat'];
// $newtest=file_get_contents('https://api.openweathermap.org/data/2.5/weather?lat='.$lat.'&lon='.$lon.'&appid=73c340f4df1ee2a07dca01d0ce48bf48');
// $test1=json_decode($newtest,true);
$weatherAPI="a595f443b58d4c97962234220222208";
$Weatherlink=file_get_contents('http://api.weatherapi.com/v1/current.json?key='.$weatherAPI.'&q='.$city.'');
$getdata=json_decode($Weatherlink,true);

//   echo "<pre>";
// print_r($getdata);
$cnt=$getdata['location']['country'];
$ctname="a595f443b58d4c97962234220222208";
$getct=file_get_contents("http://api.weatherapi.com/v1/current.json?key=".$ctname."&q=".$_POST['get']);
$gvdata=json_decode($getct,true);
$loc=$gvdata["location"]["country"];
$imurl=$gvdata['current']['condition']['icon'];

// echo "<pre>";
// print_r($dta);
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <script src="https://kit.fontawesome.com/3ade12e83a.js" crossorigin="anonymous"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
    <title>Weather</title>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=DynaPuff&display=swap');

       .material-symbols-outlined {
         font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD'0,
        'opsz' 48
}
       .button{
        padding: 10px;
        float: right;
        width: 100px;
        border: none;
        border-radius: 10px;
        background-color: #038cfc;
        color: white;
       }   
       .button:hover{
        background-color: #055ca3;
       }  

       .wmain{
        width:100%;
        display: flex;
        flex-direction: column;
            
            align-items: center;
            justify-content: center;
       }
        body{
           
            padding: 5%;
            font-family: 'DynaPuff', cursive;
            overflow:scroll;
          
        }
      .backg{
        margin: 0%;
        padding: 0%;
        position: absolute;
        width: 100%;
        height: 200%;
        z-index: -1;
        left:0%;
        top: 0%;
      }
      .show{
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 30px;
      }
      #box{
        display: flex;
        width: 100px;
        height: 100px;
        backdrop-filter: blur(50px);
        border-radius:15px;
        box-shadow: 1px 1px 10px black;
        color: white;
        align-items: center;
        justify-content: center;

      }
      .ico{
        display: flex;
        width: 200px;
        height: 200px;
        backdrop-filter: blur(50px);
        border-radius:15px;
        box-shadow: 1px 1px 10px black;
        color: white;
        align-items: center;
        justify-content: center;
        margin: 30px;
        flex-direction: column;

      }
      .search{
        border: none;
        border-radius: 30px;
        padding: 10px;
      }
      .sbar{
         border: none;
        border-radius: 30px;
        padding: 10px;
        width: 300px;

      }
      .heade{
        width: 200px;
        height:200px;
        backdrop-filter:blur(50px);
        border-radius: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
      }
    </style>
</head>
<img class="backg" src="<?=$back ?>">
<body>
    <div class="nav">
      <a href="signup.php">
      <button name="bt" class="button">
        Source Code
      </button>
      </a>
    </div>
    <div class="wmain">

        <form method="POST">
        <div class="search"><input class="sbar" name="get" value="india" type="search"></div>
        </form>
<div class="heade" style="box-shadow:1px 1px 50px black;">
        <div class="name"><h1 style="color: white;"><?=$_POST['get'];?></h1></div>
            <img width="50px" src="https://countryflagsapi.com/png/<?=$cnt?>">
            </div>
       <div class="ico">
       <img  src="<?=$imurl?>" >
        <div class="ne"><h1><?= $data['weather']['0']['main']?></h1></div>

          <div id="bo" class="temp"><i style="color: yellow;" class="fa-solid fa-temperature-full"></i>&nbsp<?=round($data['main']['temp']) ?>deg</div>
        </div>
        <div class="show">
     
            <div id="box" class="hum"><span style="color: skyblue;" class="material-symbols-outlined">
humidity_high
</span><?=$data['main']['humidity'] ?></div>
            <div id="box" class="press"><span style="color: orange;" class="material-symbols-outlined">
compress
</span><?=$data['main']['pressure'] ?></div>
            <div id="box" class="min"><span style="color: green;" class="material-symbols-outlined">
thermometer
</span><?=$data['main']['temp_min'] ?></div>
            <div id="box" class="max"><span style="color: red;" class="material-symbols-outlined">
thermometer
</span><?=$data['main']['temp_max'] ?></div>
            <div id="box" class="wind"><i style="color: green;"  class="fa-solid fa-wind"></i>&nbsp<?=$data['wind']['speed'] ?></div>
        </div>
        
    </div>
    
</body>

</html>

abstract class CompanyBaseRequest extends FormRequest
{
    ...
    public function rules()
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'category_id' => ['required', 'exists:company_categories,id'],
            'short_description' => ['required', 'string', 'max:2000'],
            'video' => ['nullable', 'file', 'mimes:mp4', 'max:30000'],
        ];
    }
}

And then two subclasses:

class CompanyStoreRequest extends CompanyBaseRequest
{
    ...
    public function rules()
    {
        return array_merge(parent::rules(), [
            'logo' => ['required', 'file', 'mimes:png,jpg,jpeg', 'max:1024'],
        ]);
    }
}

class CompanyUpdateRequest extends CompanyBaseRequest
{
    ...
    public function rules()
    {
        return array_merge(parent::rules(), [
            'logo' => ['nullable', 'file', 'mimes:png,jpg,jpeg', 'max:1024'],
        ]);
    }
}
abstract class CompanyBaseRequest extends FormRequest
{
    ...
    public function rules()
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'category_id' => ['required', 'exists:company_categories,id'],
            'short_description' => ['required', 'string', 'max:2000'],
            'video' => ['nullable', 'file', 'mimes:mp4', 'max:30000'],
        ];
    }
}
//Auto-update WooCommerce Cart when Quantity Changes
add_action( 'wp_footer', 'silva_cart_refresh_update_qty' ); 
 
function silva_cart_refresh_update_qty() { 
   if (is_cart()) { 
      ?> 
      <script type="text/javascript"> 
         jQuery('div.woocommerce').on('click', 'input.qty', function(){ 
            jQuery("[name='update_cart']").click();
         }); 
      </script> 
      <?php 
   } 
}
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    $acceptLang = ['fr', 'it', 'en']; 
    $lang = in_array($lang, $acceptLang) ? $lang : 'en';
    require_once "index_{$lang}.php"; 
define('WP_MEMORY_LIMIT' , '256M');
define( 'WP_MAX_MEMORY_LIMIT', '512M');
<?php 
// Custom place to add the search bar
echo do_shortcode('[display_search_form]'); 
// function.php searchbar shortcode created
function shapeSpace_display_search_form() {
	$search_form = '<form method="get" id="search-form-alt" action="'. esc_url(home_url('/')) .'">
		<input type="text" name="s" id="s" placeholder="Search..">
	</form>';
	return $search_form;
}
add_shortcode('display_search_form', 'shapeSpace_display_search_form'); ?>
add_filter( 'wp_is_application_passwords_available', '__return_false' );
// Remove wp version param | css and js
// Example: style.css?ver=5.2.2  =>  style.css
function remove_wp_ver_css_js_code_paste( $src ) {
    if ( strpos( $src, 'ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
// for css style file urls
add_filter( 'style_loader_src', 'remove_wp_ver_css_js_code_paste', 9999 );
// for js script file urls
add_filter( 'script_loader_src', 'remove_wp_ver_css_js_code_paste', 9999 );
//Disable The WordPress Heartbeat API
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat');
}
//Hide update notice for non-admin users

function hide_core_update_notifications_from_users() {
	if ( ! current_user_can( 'update_core' ) ) {
		remove_action( 'admin_notices', 'update_nag', 3 );
	}
}
add_action( 'admin_head', 'hide_core_update_notifications_from_users', 1 );
/**
 * Remove WooCommerce Marketing Hub.
 */
function disable_features( $features ) {
	$marketing = array_search( 'marketing', $features );
	unset( $features[$marketing] );
	return $features;
}
add_filter( 'woocommerce_admin_features', 'disable_features' );
//disable WooCommerce Admin Dashboard and WooCommerce Analytics
add_filter( 'woocommerce_admin_disabled', '__return_true' );
//Remove Link to the Windows Live Writer Manifest File
remove_action( 'wp_head', 'wlwmanifest_link');
//Remove WordPress & Woocommerce meta tag generator
remove_action('wp_head', 'wp_generator');
add_filter( 'the_generator', '__return_null' );
Route::get('ajax', function(){ return view('ajax'); });
add_filter( 'woocommerce_get_availability_text', 'customizing_stock_availability_text', 1, 2);
function customizing_stock_availability_text( $availability, $product ) {
    if ( ! $product->is_in_stock() ) {
        $availability = __( 'Fullbokat!', 'woocommerce' );
    }
    elseif ( $product->managing_stock() && $product->is_on_backorder( 1 ) )
    {
        $availability = $product->backorders_require_notification() ? __( 'Endast restnoteringar', 'woocommerce' ) : '';
    }
    elseif ( $product->managing_stock() )
    {
        $availability = __( 'Tillgängligt', 'woocommerce' );
        $stock_amount = $product->get_stock_quantity();

        switch ( get_option( 'woocommerce_stock_format' ) ) {
            case 'low_amount' :
                if ( $stock_amount <= get_option( 'woocommerce_notify_low_stock_amount' ) ) {
                    /* translators: %s: stock amount */
                    $availability = sprintf( __( 'Bara %s platser kvar!', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_amount, $product ) );
                }
            break;
            case '' :
                /* translators: %s: stock amount */
                $availability = sprintf( __( '%s platser kvar!', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_amount, $product ) );
            break;
        }

        if ( $product->backorders_allowed() && $product->backorders_require_notification() ) {
            $availability .= ' ' . __( '(Kan beställas via restnotering)', 'woocommerce' );
        }
    }
    else
    {
        $availability = '';
    }

    return $availability;
}

<?php
//--- GET
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, 'https://url-de-la-api/test?param1=value'); 
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
   curl_setopt($ch, CURLOPT_HEADER, 0); 
   $data = curl_exec($ch); 
   curl_close($ch); 
?>

<?php
//--- POST
    $fields = array('field1' => 'valor1', 'field2' => urlencode('valor 2'));
    $fields_string = http_build_query($fields);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://url-de-la-web/test");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string );
    $data = curl_exec($ch);
    curl_close($ch);
?>
<?php

function getAuthorizationHeader(){
    $headers = null;
    if (isset($_SERVER['Authorization'])) {
        $headers = trim($_SERVER["Authorization"]);
    }
    else if (isset($_SERVER['HTTP_AUTHORIZATION'])) { //Nginx or fast CGI
        $headers = trim($_SERVER["HTTP_AUTHORIZATION"]);
    } elseif (function_exists('apache_request_headers')) {
        $requestHeaders = apache_request_headers();
        // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
        $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders));
        //print_r($requestHeaders);
        if (isset($requestHeaders['Authorization'])) {
            $headers = trim($requestHeaders['Authorization']);
        }
    }
    return $headers;
}

/**
 * get access token from header
 * */
function getBearerToken() {
    $headers = getAuthorizationHeader();
    // HEADER: Get the access token from the header
    if (!empty($headers)) {
        if (preg_match('/Bearer\s(\S+)/', $headers, $matches)) {
            return $matches[1];
        }
    }
    return null;
}

?>
<?php

function send_file($name)
{
    $path = $name;
    $path_info = pathinfo($path);
    $basename = $path_info['basename'];
    if (!is_file($path) or connection_status() != 0) {
        return false;
    }
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Content-Type: application/octet-stream");
    header("Content-Length: " . (string) filesize($path));
    header("Content-Disposition: inline; filename={$basename}");
    header("Content-Transfer-Encoding: binary\n");
    if ($file = fopen($path, 'rb')) {
        while (!feof($file) and connection_status() == 0) {
            print fread($file, 1024 * 8);
            flush();
        }
        fclose($file);
    }
    return connection_status() == 0 and !connection_aborted();
}
<?php

$url = "https://reqbin.com/echo";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Authorization: Basic bG9naW46cGFzc3dvcmQ=", /*base64_encode(user:pass)*/
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);

?>

<?php
require_once('jSignature_Tools_Base30.php');
function base30_to_jpeg($base30_string, $output_file) {

    $data = str_replace('image/jsignature;base30,', '', $base30_string);
    $converter = new jSignature_Tools_Base30();
    $raw = $converter->Base64ToNative($data);
//Calculate dimensions
$width = 0;
$height = 0;
foreach($raw as $line)
{
    if (max($line['x'])>$width)$width=max($line['x']);
    if (max($line['y'])>$height)$height=max($line['y']);
}

// Create an image
    $im = imagecreatetruecolor($width+20,$height+20);


// Save transparency for PNG
    imagesavealpha($im, true);
// Fill background with transparency
    $trans_colour = imagecolorallocatealpha($im, 255, 255, 255, 127);
    imagefill($im, 0, 0, $trans_colour);
// Set pen thickness
    imagesetthickness($im, 2);
// Set pen color to black
    $black = imagecolorallocate($im, 0, 0, 0);   
// Loop through array pairs from each signature word
    for ($i = 0; $i < count($raw); $i++)
    {
        // Loop through each pair in a word
        for ($j = 0; $j < count($raw[$i]['x']); $j++)
        {
            // Make sure we are not on the last coordinate in the array
            if ( ! isset($raw[$i]['x'][$j])) 
                break;
            if ( ! isset($raw[$i]['x'][$j+1])) 
            // Draw the dot for the coordinate
                imagesetpixel ( $im, $raw[$i]['x'][$j], $raw[$i]['y'][$j], $black); 
            else
            // Draw the line for the coordinate pair
            imageline($im, $raw[$i]['x'][$j], $raw[$i]['y'][$j], $raw[$i]['x'][$j+1], $raw[$i]['y'][$j+1], $black);
        }
    } 

//Create Image
    $ifp = fopen($output_file, "wb"); 
    imagepng($im, $output_file);
    fclose($ifp);  
    imagedestroy($im);

    return $output_file; 
}

//test
$imgStr='image/jsignature;base30,7U010100010000000001_1G88b8ace99aab756856_bE2000000010000000101_1D6689cbaa9b956558564_8w757698987766566556545_3PZ2110101010100000000Y10_fF0000Z2100001000Y110_1V9789cb86966655475_fK_1x';
base30_to_jpeg($imgStr, 'test.png');

?>
<?php

$someBigString = gzencode('blahblah...blah');

header("Content-type: text/javascript");
header('Content-Encoding: gzip'); 

echo $someBigString;

?>
<?php
$data = array (
  "limit"	=>	5,
  "api_key" =>	'YOUR_API_KEY',
  "api_secret"	=>	'YOUR_API_SECRET',
);
$method = "getCallDetails";
$url = "https://api.logmycalls.com/services/$method";
$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => "Accept: application/json\r\n" . "Content-Type: application/json\r\n",
        'content' => json_encode($data)
    )
);
$context  = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
?>
<?php
function Thumbnail($url, $width = 64, $height = 64) {

    // download and create gd image
    $image = file_get_contents($url);
    $img = new Imagick();
    $img->readImageBlob($image);
    $img->scaleImage($width,$height);
   
    echo $img->getImageBlob();
}

header("content-type: image/jpeg");
Thumbnail("https://thispersondoesnotexist.com/image#.jpg", 64, 64);

?>
server{
    :
    
    location /api {
        rewrite ^/api/(.*)$ /api/$1.php last;
        return 404;
    }
    
    :
}
<?php

$xml = file_get_contents('post_xml.xml');
$url = 'http://url.com';


$post_data = array(
    "xml" => $xml,
);

$stream_options = array(
    'http' => array(
       'method'  => 'POST',
       'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
       'content' => http_build_query($post_data),
    ),
);

$context  = stream_context_create($stream_options);
$response = file_get_contents($url, null, $context);
<?php

//===========notifier.sql:
    
/*
CREATE OR REPLACE FUNCTION public.notify_channel()
RETURNS trigger
AS $function$
  BEGIN
	  PERFORM pg_notify('channel_name', row_to_json(NEW)::text);
	  RETURN NULL;
  END;
$function$
LANGUAGE plpgsql;

CREATE TRIGGER trigger_on_insert AFTER INSERT ON mytable
FOR EACH ROW EXECUTE PROCEDURE notify_channel();
*/

set_time_limit(0);

//-- using PDO:

$db = new PDO(
    'pgsql:dbname=dbname host=host port=5432;options=--application_name=APPLICATION_NAME',
    'user',
    'password',
    [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    ]
);

$db->exec('LISTEN channel_name');

while (true) {
    while ($db->pgsqlGetNotify(PDO::FETCH_ASSOC, 30000)) {
        echo json_encode($result).PHP_EOL;
    }
}

//-- using pg_connect:
//<?php

include '../conn.php';
set_time_limit(0);
ob_end_clean();
pg_query($conn, 'LISTEN table_changed;');

while(true){
    
    $notify = pg_get_notify($conn);
    
	if (!$notify) {
        echo json_encode(array('result'=>false, 'data'=>'No messages')).PHP_EOL;
        ob_flush();
        flush();
        sleep(1);
	} else {
        echo json_encode(array('result'=>true, 'process_id'=>$pid , 'pid' => pg_get_pid($conn), 'data' => $notify)).PHP_EOL;
	}
}

<?php

/*==========  install at ubuntu: ==============

sudo apt install php-sybase


//==================================

append this into /etc/freetds/freetds.conf:
(192.168.0.250:2638 is an example:)

//==================================

sudo nano /etc/freetds/freetds.conf

[connName]
    host = 192.168.0.250  
    port = 2638
    tds version = 7.4
    database = MYDB
    
//======  php: */

$connName = "connName";
$user = "myuser";
$pass = "mypass";

$st="dblib:host=$connName;charset=iso8859-1";
$conn = new PDO($st,$user,$pass);

/* $conn->prepare($sql_query);
...etc
*/
<?php 

$sql = 'select fielda, fieldb, fieldc from table1
order by field, fieldb, fieldc
union all
select field1, field2, field3 from table2
order by field1, field2 desc, field3 asc';


print_r($sql2 = invert_order($sql));


function invert_order($str){
    $re = '/(?<=order\sby\s)(.*)(?=)/mi';

    preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
    
    $mat = $matches[sizeof($matches)-1]; //-- get only last order field list
    $mat=$mat[sizeof($mat)-1];
    $mat=explode(",",$mat);
    
    
    for($i=0; $i<sizeof($mat); $i++){   //-- reverse each pair of order field/direction 
        $duet = preg_split("/\s+/", trim($mat[$i]));
        if (sizeof($duet)<2) $duet[1]="";
        switch(strtolower($duet[1])) {
            case "desc":
                $duet[1] = "asc";
                break;
            default:
                $duet[1] = "desc";
                break;
        }
        $mat[$i] = implode(" ",$duet);
    }
    
    $re2 = '/(order\s+by\s+.*)*$/i';    //-- replace last order by with new inverted order by:
    $subst = "order by ".implode(", ",$mat);
    $result = preg_replace($re2, "", $str);
    return $result . " $subst";
}


?>
<?php

shell_exec("php Server.php > /dev/null 2>/dev/null &");
<?php

// sudo apt install php7.0-sybase


header("content-type: text/plain; charset=iso-8859-1");
ini_set("display_errors","1");
error_reporting(E_ALL);

$host="localhost";
$db="test";
$uid="sa";
$pwd="mypassword";

$query = "select top 10 * from testtable";

$conn = new PDO( "dblib:host=$host:1433;dbname=$db;", $uid, $pwd);
$stmt = $conn->prepare( $query );
$stmt->execute();

while ($r=$stmt->fetch(PDO::FETCH_ASSOC)){
	print_r($r);
}

?>
<?php

//create menu link

//Resgiter Settings
//fill in the settings menu

function mf_menu_create_link()
{

    /*

    add_submenu_page(
    string   $parent_slug,
    string   $page_title,
    string   $menu_title,
    string   $capability,
    string   $menu_slug,
    callable $function = ''
    );

     */

    add_options_page(
        'Facebook Footer Link',
        'Facebook Footer Link',
        'manage_options',
        'mf_optioins',
        'mf_options_content'
    );

}
function mf_options_content()
{

    //init global myf_options
    global $myf_options; //declare global myf_options in main class //Global Options Variables
    //$myf_options = get_option('myf_settings');

    ob_start(); ?>
<div class="wrap">
    <h2><?php _e('Facebook Footer Link Settings' . 'mf_domain'); ?></h2>

    <p><?php _e('Facebook Footer Link plugin ', 'mf_domain'); ?></p>

    <!-- set the action attribute to ""options.php-->
    <form method="post" action="options.php">

        <!--  // Output the hidden fields, nonce, etc. -->
        <?php settings_fields('myf_settings_group'); ?>
        <table class="form-table">
            <tbody>
                <tr>
                    <th scope="row"><label for="myf_settings[enable]">
                            <?php _e('enable', 'mf_domain'); ?>
                        </label>
                    </th>
                    <td><input type="checkbox" name="myf_settings[enable]" id="myf_settings[enable]" value="1"
                            <?php checked('1', $myf_options['enable']); ?>></td>
                </tr>

                <tr>
                    <th scope="row"><label for="myf_settings[facebook_url]">
                            <?php _e('Facebook url', 'mf_domain'); ?>
                        </label>
                    </th>
                    <td><input type="text" class="regular-text" name="myf_settings[facebook_url]"
                            id="myf_settings[facebook_url]" value="<?php echo $myf_options['facebook_url']; ?>">
                        <p class="description"> <?php _e('Enter your facebook url', 'mf_domain'); ?></p>
                    </td>
                </tr>

                <tr>
                    <th scope="row"><label for="myf_settings[link_color]">
                            <?php _e('Facebook url', 'mf_domain'); ?>
                        </label>
                    </th>
                    <td><input type="text" class="regular-text" name="myf_settings[link_color]"
                            id="myf_settings[link_color]" value="<?php echo $myf_options['link_color']; ?>">
                        <p class="description"> <?php _e('Enter your facebook link_color', 'mf_domain'); ?></p>
                    </td>
                </tr>

                <tr>
                    <th scope="row"><label for="myf_settings[enable]">
                            <?php _e('show_in_feed', 'mf_domain'); ?>
                        </label>
                    </th>
                    <td><input type="checkbox" name="myf_settings[show_in_feed]" id="myf_settings[show_in_feed]"
                            value="1" <?php checked('1', $myf_options['show_in_feed']); ?>></td>
                </tr>

            </tbody>
        </table>

        <p class="submit"><input name="submit" class="button button-primary" type="submit"
                value="<?php _e('save changes'); ?>" </p>
    </form>

</div>
<?php echo ob_get_clean();

}

function mf_register_settings()
{
    register_setting('myf_settings_group', 'myf_settings');
}

add_action('admin_init', 'mf_register_settings');
add_action('admin_menu', 'mf_menu_create_link');
*> sudo visudo

#find 'root ALL(...' and append this line below:

www-data ALL=NOPASSWD:/usr/local/bin/myscript.sh

#Save

*> sudo cp myscript.sh /usr/local/bin/
*> sudo chmod 777 /usr/local/bin/myscript.sh

#at php script:

<?php

$cmd = shell_exec("/usr/local/bin/myscript.sh params");
echo $cmd;

?>
<?php


$wavfile=$_REQUEST['wav'];
$wav=file_get_contents($wavfile);

$descriptorspec = array(
    0 => array( "pipe", "r" ),
    1 => array( "pipe", "w" ),
    2 => array( "file", "/dev/null", "w" )
);

$process = proc_open( "/usr/bin/lame - -", $descriptorspec, $pipes );

fwrite( $pipes[0], $wav );
fclose( $pipes[0] );

$mp3 = stream_get_contents( $pipes[1] );
fclose( $pipes[1] );

proc_close( $process );

header('Content-Type: audio/mpeg');
echo $mp3;
<?php

class PHPSocketServer
{
  const ERROR = 0;
  const LOG   = 1;
  const DEBUG = 2;

  private $aConfig       = NULL;
  private $hSocket       = NULL;
  private $aClients      = array();
  private $iRunning      = 0;
  private $iStartTime    = 0;
  private $iLastActivity = 0;

  private static $aDefaults = array
  (
    'main' => array
    (
      'address'          => 'localhost',
      'port'             => 15151,
      'backlog'          => 200,
      'select_timeout'   => 1,
      'pid_file'         => 'phpserver.pid'
    ),

    'verbosity' => array
    (
      'echo_log'         => 1,
      'echo_debug'       => 0,
      'echo_errors'      => 1,
      'log_errors'       => 1
    )
  );

  public function getPidFile()
  {
    return $this->aConfig['main']['pid_file'];
  }

  private static function getName( $hSocket )
  {
    return socket_getpeername( $hSocket, $sAddress, $iPort ) ? "$sAddress:$iPort" : "?????:???";
  }

  private function log( $sMessage, $iType )
  {
    $sTimeStamp = @strftime( '%c' );

    if( $iType == self::ERROR )
    {
      $aBacktrace = debug_backtrace();
      $aBacktrace = $aBacktrace[1];
      $sMessage   = sprintf( '[%s] [E] %s%s%s [%d] : %s', $sTimeStamp, $aBacktrace['class'], $aBacktrace['type'], $aBacktrace['function'], $aBacktrace['line'], $sMessage );

      if( $this->aConfig['verbosity']['echo_errors'] )
        printf( "$sMessage\n" );

      if( $this->aConfig['verbosity']['log_errors'] )
        error_log( $sMessage );
    }
    else if( $iType == self::DEBUG && $this->aConfig['verbosity']['echo_debug'] )
    {
      echo sprintf( '[%s] [D] : %s', $sTimeStamp, $sMessage )."\n";
    }
    else if( $iType == self::LOG && $this->aConfig['verbosity']['echo_log'] )
    {
      echo sprintf( '[%s] [L] : %s', $sTimeStamp, $sMessage )."\n";
    }
  }

  /*
   * Handle clients here.
   */
  private function handleClientRequest( $hClient, $iClientIndex )
  {
    /*
     * ...
     */

    $this->disconnect( $iClientIndex );
  }

  private function disconnect( $i )
  {
    socket_close( $this->aClients[ $i ] );
    $this->aClients[ $i ] = NULL;
  }

  private function loadConfiguration( $sConfigFile )
  {
    if( !is_file( $sConfigFile ) || !is_readable( $sConfigFile ) )
      die( "Could not read $sConfigFile.\n" );

    else if( !( $this->aConfig = parse_ini_file( $sConfigFile, TRUE ) ) )
      die( "Could not parse $sConfigFile.\n" );

    foreach( self::$aDefaults as $sSection => $aDefaultValues )
    {
      if( !isset( $this->aConfig[ $sSection ] ) )
        $this->aConfig[ $sSection ] = array();

      foreach( $aDefaultValues as $sName => $sValue )
      {
        if( !isset( $this->aConfig[ $sSection ][ $sName ] ) )
          $this->aConfig[ $sSection ][ $sName ] = $sValue;
      }
    }
  }

  public function setConfig( $sSectionName, $sConfigName, $mValue )
  {
    if( !isset( $this->aConfig[ $sSectionName ] ) )
      $this->aConfig[ $sSectionName ] = array();

    $this->aConfig[ $sSectionName ][ $sConfigName ] = $mValue;
  }

  public function __construct( $sConfigFile )
  {
    $this->loadConfiguration( $sConfigFile );

    if( !( $this->hSocket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ) ) )
      $this->log( 'Could not create main socket ( '.socket_strerror( socket_last_error() ).' ).', self::ERROR );

    else if( socket_set_option( $this->hSocket, SOL_SOCKET, SO_REUSEADDR, 1 ) === FALSE )
      $this->log( 'Could not set SO_REUSEADDR flag ( '.socket_strerror( socket_last_error() ).' ).', self::ERROR );
  }

  public function start()
  {
    if( !socket_bind( $this->hSocket, $this->aConfig['main']['address'], $this->aConfig['main']['port'] ) )
      $this->log( 'Could not bind on '.$this->aConfig['main']['address'].':'.$this->aConfig['main']['port'].' ( '.socket_strerror( socket_last_error() ).' ).', self::ERROR );

    else if( !socket_listen( $this->hSocket, $this->aConfig['main']['backlog'] ) )
      $this->log( 'Could not put main socket in listening mode ( '.socket_strerror( socket_last_error() ).' ).', self::ERROR );

    else if( !socket_set_nonblock( $this->hSocket ) )
      $this->log( 'Could not set main socket in non-blocking mode ( '.socket_strerror( socket_last_error() ).' ).', self::ERROR );

    else
    {
      $this->iStartTime = time();

      $this->log( 'Server started on '.$this->aConfig['main']['address'].':'.$this->aConfig['main']['port'].' .', self::LOG );

      for(;;)
      {
        $aRead = array_merge( array( $this->hSocket ), $this->aClients );

        if( socket_select( $aRead, $aWrite, $aExcept, $this->aConfig['main']['select_timeout'] ) )
        {
          if( in_array( $this->hSocket, $aRead ) )
          {
            if( ( $hClient = @socket_accept( $this->hSocket ) ) )
            {
              $this->aClients[ microtime(TRUE) ] = $hClient;
              $this->iLastActivity = time();

              $this->log( 'New incoming connection '.self::getName( $hClient ), self::DEBUG );
            }
            else
              $this->log( 'Could not accept a new connection ( '.socket_strerror( socket_last_error() ).' ).', self::ERROR );
          }
        }

        /*
         * Search for readable clients.
         */
        foreach( $this->aClients as $i => $hClient )
        {
          if( in_array( $hClient, $aRead ) )
          {
            $this->handleClientRequest( $hClient, $i );
          }
        }

        /*
         * Remove closed connections.
         */
        $this->aClients = array_filter( $this->aClients );
      }
    }
  }

  public function __destruct()
  {
    if( $this->hSocket )
    {
      $this->log( 'Shutting down ...', self::LOG );

      foreach( $this->aClients as $sId => $hClient )
      {
        if( $hClient )
          socket_close( $hClient );
      }

      socket_close( $this->hSocket );
    }

    @unlink( $this->getPidFile() );
  }
}
/* put in functions.php */
function register_navwalker() {
   require_once get_template_directory() . '/wp-bootstrap5-walker.php';
  //or place code directly in functions.php
}
add_action( 'after_setup_theme', 'register_navwalker' );


/* place in header of theme */
<nav class="navbar navbar-expand-md navbar-light bg-light">
    <div class="container-fluid">
        <a class="navbar-brand" href="#">Navbar</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-menu" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        
        <div class="collapse navbar-collapse" id="main-menu">
            <?php
            wp_nav_menu(array(
                'theme_location' => 'main-menu',
                'container' => false,
                'menu_class' => '',
                'fallback_cb' => '__return_false',
                'items_wrap' => '<ul id="%1$s" class="navbar-nav me-auto mb-2 mb-md-0 %2$s">%3$s</ul>',
                'depth' => 2,
                'walker' => new bootstrap_5_wp_nav_menu_walker()
            ));
            ?>
        </div>
    </div>
</nav>

  
 /* Nav walker menu code - place in file or functions.php */
  
 <?php
// bootstrap 5 wp_nav_menu walker
class bootstrap_5_wp_nav_menu_walker extends Walker_Nav_menu
{
  private $current_item;
  private $dropdown_menu_alignment_values = [
    'dropdown-menu-start',
    'dropdown-menu-end',
    'dropdown-menu-sm-start',
    'dropdown-menu-sm-end',
    'dropdown-menu-md-start',
    'dropdown-menu-md-end',
    'dropdown-menu-lg-start',
    'dropdown-menu-lg-end',
    'dropdown-menu-xl-start',
    'dropdown-menu-xl-end',
    'dropdown-menu-xxl-start',
    'dropdown-menu-xxl-end'
  ];

  function start_lvl(&$output, $depth = 0, $args = null)
  {
    $dropdown_menu_class[] = '';
    foreach($this->current_item->classes as $class) {
      if(in_array($class, $this->dropdown_menu_alignment_values)) {
        $dropdown_menu_class[] = $class;
      }
    }
    $indent = str_repeat("\t", $depth);
    $submenu = ($depth > 0) ? ' sub-menu' : '';
    $output .= "\n$indent<ul class=\"dropdown-menu$submenu " . esc_attr(implode(" ",$dropdown_menu_class)) . " depth_$depth\">\n";
  }

  function start_el(&$output, $item, $depth = 0, $args = null, $id = 0)
  {
    $this->current_item = $item;

    $indent = ($depth) ? str_repeat("\t", $depth) : '';

    $li_attributes = '';
    $class_names = $value = '';

    $classes = empty($item->classes) ? array() : (array) $item->classes;

    $classes[] = ($args->walker->has_children) ? 'dropdown' : '';
    $classes[] = 'nav-item';
    $classes[] = 'nav-item-' . $item->ID;
    if ($depth && $args->walker->has_children) {
      $classes[] = 'dropdown-menu dropdown-menu-end';
    }

    $class_names =  join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args));
    $class_names = ' class="' . esc_attr($class_names) . '"';

    $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args);
    $id = strlen($id) ? ' id="' . esc_attr($id) . '"' : '';

    $output .= $indent . '<li ' . $id . $value . $class_names . $li_attributes . '>';

    $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
    $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
    $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
    $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';

    $active_class = ($item->current || $item->current_item_ancestor || in_array("current_page_parent", $item->classes, true) || in_array("current-post-ancestor", $item->classes, true)) ? 'active' : '';
    $nav_link_class = ( $depth > 0 ) ? 'dropdown-item ' : 'nav-link ';
    $attributes .= ( $args->walker->has_children ) ? ' class="'. $nav_link_class . $active_class . ' dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"' : ' class="'. $nav_link_class . $active_class . '"';

    $item_output = $args->before;
    $item_output .= '<a' . $attributes . '>';
    $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
    $item_output .= '</a>';
    $item_output .= $args->after;

    $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
  }
}
// register a new menu
register_nav_menu('main-menu', 'Main menu');
echo "<pre>"; print_r(); "</pre>";
function p($data){
    echo "<pre>";
    print_r($data);
    exit;
}
<?php 

// Envoyer l'e-mail seulement si on est en production
if( wp_get_environment_type() == 'production' ) {
    wp_mail( $address, $subject, $content );     
}
<?php

class Elemento{

	//Instance variables
	private $tag; //string exemplo:link
	private $atributos; // um elemente tem um array de atributos
	private $temtagfinal; //booleano
	private $subelementos; // um array de elemntos, porque por exemplo, dentro do html leva head e o body.
	private $numtabs; // numero de tabs à esquerda
	
	//Construct
	public function __construct($tag,$temtagfinal,$atributos) {	
		$this->tag=$tag; // para falarmos de uma variavel de instância usa-se $this
		$this->temtagfinal=$temtagfinal;
		$this->atributos=$atributos;
		$this->subelementos=array();
		$this->numtabs=0;
	}


	//Methods
	public function getCodigo(){
		
		$codigo="";
		for ($i=0;$i<$this->numtabs;$i++){ //este ciclo tem tantas iteracoes quanto o num de tabs definidos
			$codigo.="  ";
		}
		
		$codigo.="<".$this->tag." ";
		foreach($this->atributos as $atributo){
			$codigo.=$atributo." ";
		}
		if (!$this->temtagfinal) $codigo.="/>"."\n";
		else $codigo.=">"."\n";
		
		
		if ($this->temtagfinal) {
			foreach ($this->subelementos as $subelemento){
				$codigo.=$subelemento->getCodigo(); 
			}
			
			for ($i=0;$i<$this->numtabs;$i++){ //
			$codigo.="  ";
			}
			
			$codigo.="</".$this->tag.">"."\n";
		}
		
		
		return $codigo;
	}
	
	public function addSubElemento($subelemento){
		$subelemento->setNumTabs($this->numtabs+1);
		$this->subelementos[count($this->subelementos)]=$subelemento; //count no array da-nos o n de posiçoes do array 	
	}
	
	public function setNumTabs($numtabs) {
		$this->numtabs=$numtabs;
	}


} 

?>
// Disable Gutenberg on the back end.
add_filter( 'use_block_editor_for_post', '__return_false' );

// Disable Gutenberg for widgets.
add_filter( 'use_widgets_blog_editor', '__return_false' );

add_action( 'wp_enqueue_scripts', function() {
    // Remove CSS on the front end.
    wp_dequeue_style( 'wp-block-library' );

    // Remove Gutenberg theme.
    wp_dequeue_style( 'wp-block-library-theme' );

    // Remove inline global CSS on the front end.
    wp_dequeue_style( 'global-styles' );
}, 20 );
function my_acf_repeater($atts, $content='') { 

extract(shortcode_atts(array( "field" => null,

"sub_fields" => null,

"post_id" => null

), $atts));

if (empty($field) || empty($sub_fields)) {

// silently fail? is that the best option? idk

return "";

}

$sub_fields = explode(",", $sub_fields);

​

$_finalContent = '';

if( have_rows($field, $post_id) ):

while ( have_rows($field, $post_id) ) : the_row();

 $_tmp = $content;

foreach ($sub_fields as $sub) {

$subValue = get_sub_field(trim($sub));

$_tmp = str_replace("%$sub%", $subValue, $_tmp);

}

 $_finalContent .= do_shortcode( $_tmp );

endwhile;

else :  

$_finalContent = "$field does not have any rows";

endif;

return $_finalContent;

}

add_shortcode("acf_repeater", "my_acf_repeater");
<?php

    $codigo="<!DOCTYPE html>"."\n";
    $codigo.="<html lang='pt-pt'>"."\n";

    $codigo.="  <head>"."\n";
    $codigo.="    <meta charset='UTF-8'>"."\n";
    $codigo.="    <meta http-equiv='X-UA-Compatible' content='IE=edge'>"."\n";
    $codigo.="    <meta name='viewport' content='width=device-width, initial-scale=1.0'>"."\n";
    $codigo.="    <title></title>"."\n";
    $codigo.="  </head>"."\n";


    $codigo.="  <body>"."\n";
    
    $codigo.="  </body>"."\n";

    $codigo.="</html>"."\n";

    echo $codigo;
?>
// Option 1:
<?php echo substr(get_the_excerpt(), 0, 150); ?>

// Option 2: ends with ...
<?php echo wp_trim_words(get_the_excerpt(), 15); ?> 
// cleaned/stripped text only
<?php echo strip_tags(get_the_term_list($post->ID,'custom_tax','',', ')); ?>
  
  //alternate: <?php echo get_the_term_list($post->ID,'custom_tax','',', '); ?>
 $(document).on("scroll", onScroll);

        //smoothscroll
        $('.page-template-cannabis-101 .c-secondary-nav a[href^="#"]').on('click', function (e) {
            // e.preventDefault();
            // $(document).off("scroll");

            // $('.page-template-cannabis-101 .c-secondary-nav a').each(function () {
            //     $(this).removeClass('active');
            // })
            // $(this).addClass('active');

            // var target = this.hash,
            //     menu = target;
            // $target = $(target);
            $('html, body').stop().animate({
                'scrollTop': $target.offset().top + 2
            }, 500, 'swing', function () {
                window.location.hash = target;
                $(document).on("scroll", onScroll);
            });
        });
resources/lang/en/auth.php

This is the line:

'failed' => 'These credentials do not match our records.',
/**
 * Plugin Name:       My Basics Plugin
 * Plugin URI:        https://example.com/plugins/the-basics/
 * Description:       Handle the basics with this plugin.
 * Version:           1.10.3
 * Requires at least: 5.2
 * Requires PHP:      7.2
 * Author:            John Smith
 * Author URI:        https://author.example.com/
 * License:           GPL v2 or later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Update URI:        https://example.com/my-plugin/
 * Text Domain:       my-basics-plugin
 * Domain Path:       /languages
 */
/* Change WooCommerce products per page */
add_filter( 'loop_shop_per_page', 'my_new_products_per_page', 9999 );
 
function my_new_products_per_page( $pr_per_page ) {
  $pr_per_page = 20;
  return $pr_per_page;
}
$uriSegments = explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
    if (isset($lookup_table[$key])) {
        return $lookup_table[$key];
    } else {
        return;
    }

or 

return array_key_exists($key, $table) ? $table[$key] : null;

or 

return $table[$key] ?? null;
$promises = Http::pool(function (Pool $pool) use ($schoolId, $filter, $batch, $studentGroupId) {
            $pool->as('schoolStaff')->withToken(Auth::user()->token())
                ->get(Api::schoolStaff()->index($schoolId, [], true), $filter);
            $pool->as('schoolBatchStudentGroup')->withToken(Auth::user()->token())
                ->get(Api::schoolBatchStudentGroup()->detail($schoolId, $batch, $studentGroupId, true));
        });

        $staffDatas = json_decode($promises['schoolStaff']->getBody(), true)['data'] ?? [];
        $studentGroup = json_decode($promises['schoolBatchStudentGroup']->getBody(), true)['data'] ?? [];
<ul class="navbar-nav mx-auto">
  <li class="nav-item ">
  		<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='index.php'){ ?>active <?php } ?>" href="index.php">Home  </a>
  </li>
  <li class="nav-item">
  		<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='mestropolis.php'){ ?>active <?php } ?>" href="mestropolis.php">Neotropolis</a>
  </li>
  <li class="nav-item">
    	<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='story.php'){ ?>active <?php } ?>" href="story.php">Story</a>
  </li>
  <li class="nav-item">
    	<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='cards.php'){ ?>active <?php } ?>" href="cards.php">Cards</a>
  </li>
  <li class="nav-item">
    	<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='packs.php'){ ?>active <?php } ?>" href="packs.php">Packs</a>
  </li>
  <li class="nav-item">
    	<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='Collectibles.php'){ ?>active <?php } ?>" href="Collectibles.php">Collectibles</a>
  </li>
  <li class="nav-item">
    	<a class="nav-link <?php if(substr($_SERVER['PHP_SELF'],1,15)=='faq.php'){ ?>active <?php } ?>" href="faq.php">FAQ</a>
  </li>
</ul>
add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_add_to_cart_button', 10, 2 );
function replace_add_to_cart_button( $button, $product ) {
  if (is_product_category() || is_shop()) {
    $button_text = __("View Product", "woocommerce");
    $button_link = $product->get_permalink();
    $button = '<a class="button" href="' . $button_link . '">' . $button_text . '</a>';
    return $button;
  }
}
$page = isset($_GET['page']) ? $_GET['page'] : '1' // setting the default value to '1'
 
or in php 7 the more shortcut way is
 
$page = $_GET['page'] ?? '1';
$projects = Project::

when($request->year_from, function($query) use ($request){
    $query->where('delivery_year', '>=', $request->year_from);
})
->when($request->year_to, function($query) use ($request){
    $query->where('delivery_year', '<=', $request->year_to);
})
->when( $request->delivery_month_from, function($query) use ($request){
    $query->where('delivery_month', '>=', $request->delivery_month_from);
})
->when( $request->delivery_month_to, function($query) use ($request){
    $query->where('delivery_month', '<=', $request->delivery_month_to);
})
->when( $request->product_group, function($query) use ($request){
    $query->whereHas('products', function($q) use ($request) {
        $q->whereHas('group', function($qi) use ($request){
            $qi->whereIn('id', $request->product_group);
        });
    });
})
->get();
define( 'AUTOMATIC_UPDATER_DISABLED', true );
define('WP_DEBUG', true);
if (WP_DEBUG) {
  define('WP_DEBUG_LOG', true);
  define('WP_DEBUG_DISPLAY', true);
  define('SCRIPT_DEBUG', true);
  @ini_set('display_errors',0);
}
define('EMPTY_TRASH_DAYS', 7);
define('EMPTY_TRASH_DAYS', 0);
add_action( 'admin_init', 'gkp_remove_editor_menu' );
function gkp_remove_editor_menu() {
    remove_submenu_page( 'themes.php', 'theme-editor.php' );
}
define('DISALLOW_FILE_EDIT',true);
define('WP_POST_REVISIONS', 3);

or 

define('WP_POST_REVISIONS', false);
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );
define( 'WP_CONTENT_URL', 'http://local.wordpress-test/blog/wp-content');
// Changer le dossier 'plugins' de place
define('WP_PLUGIN_DIR',$_SERVER['DOCUMENT_ROOT'].'/blog/wp-content/plugins');
define('WP_PLUGIN_URL','http://local.wordpress-test/blog/wp-content/plugins');
// Changer le dossier 'uploads' de place
define('UPLOADS','/blog/wp-content/uploads');
// Renommer le dossier 'wp-content'
define ('WP_CONTENT_FOLDERNAME', '/wp-services');
define( 'WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME );
define( 'WP_SITEURL', 'http://' . $_SERVER[ 'HTTP_HOST' ] );
define( 'WP_CONTENT_URL', WP_SITEURL . WP_CONTENT_FOLDERNAME );
/**
 * Register a custom post type called "book".
 *
 * @see get_post_type_labels() for label keys.
 */
function wpdocs_codex_book_init() {
    $labels = array(
        'name'                  => _x( 'Books', 'Post type general name', 'textdomain' ),
        'singular_name'         => _x( 'Book', 'Post type singular name', 'textdomain' ),
        'menu_name'             => _x( 'Books', 'Admin Menu text', 'textdomain' ),
        'name_admin_bar'        => _x( 'Book', 'Add New on Toolbar', 'textdomain' ),
        'add_new'               => __( 'Add New', 'textdomain' ),
        'add_new_item'          => __( 'Add New Book', 'textdomain' ),
        'new_item'              => __( 'New Book', 'textdomain' ),
        'edit_item'             => __( 'Edit Book', 'textdomain' ),
        'view_item'             => __( 'View Book', 'textdomain' ),
        'all_items'             => __( 'All Books', 'textdomain' ),
        'search_items'          => __( 'Search Books', 'textdomain' ),
        'parent_item_colon'     => __( 'Parent Books:', 'textdomain' ),
        'not_found'             => __( 'No books found.', 'textdomain' ),
        'not_found_in_trash'    => __( 'No books found in Trash.', 'textdomain' ),
        'featured_image'        => _x( 'Book Cover Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', 'textdomain' ),
        'set_featured_image'    => _x( 'Set cover image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', 'textdomain' ),
        'remove_featured_image' => _x( 'Remove cover image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', 'textdomain' ),
        'use_featured_image'    => _x( 'Use as cover image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', 'textdomain' ),
        'archives'              => _x( 'Book archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'textdomain' ),
        'insert_into_item'      => _x( 'Insert into book', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'textdomain' ),
        'uploaded_to_this_item' => _x( 'Uploaded to this book', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', 'textdomain' ),
        'filter_items_list'     => _x( 'Filter books list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', 'textdomain' ),
        'items_list_navigation' => _x( 'Books list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', 'textdomain' ),
        'items_list'            => _x( 'Books list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', 'textdomain' ),
    );
 
    $args = array(
        'labels'             => $labels,
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array( 'slug' => 'book' ),
        'capability_type'    => 'post',
        'has_archive'        => true,
        'hierarchical'       => false,
        'menu_position'      => null,
        'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
    );
 
    register_post_type( 'book', $args );
}
 
add_action( 'init', 'wpdocs_codex_book_init' );

//OR

 public function create_course()
        {
            $labels = array(
                'name' => 'Exams',
                'singular_name' => 'Exam',
                'menu_name' => 'Exams',
                'name_admin_bar' => 'exam',
                'add_new' => 'Add New',
                'add_new_item' => 'Add New Exam',
                'new_item' => 'New Exam',
                'edit_item' => 'Edit Exam',
                'view_item' => 'View Exam',
                'all_items' => 'All Exams',
                'search_items' => 'Search Exams',
                'parent_item_colon' => 'Parent Exams:',
                'not_found' => 'No exams found.',
                'not_found_in_trash' => 'No exams found in Trash.',
                'featured_image' => 'Exam Cover Image',
                'set_featured_image' => 'Set cover image',
                'remove_featured_image' => 'Remove cover image',
                'use_featured_image' => 'Use as cover image',
                'archives' => 'Exam archives',
                'insert_into_item' => 'Insert into exam',
                'uploaded_to_this_item' => 'Uploaded to this exam',
                'filter_items_list' => 'Filter exams list',
                'items_list_navigation' => 'exams list navigation',
                'items_list' => 'exams list',
            );
            $args = array(
                'labels' => $labels,
                'public' => true,
                'publicly_queryable' => true,
                'show_ui' => true,
                'show_in_menu' => true,
                'query_var' => true,
                'rewrite' => array('slug' => 'exam'),
                'capability_type' => 'post',
                'has_archive' => true,
                'hierarchical' => false,
                'menu_position' => null,
                'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'),
            );
            register_post_type('exam', $args);
        }
"php-cs-fixer.executablePath": "${extensionPath}\\php-cs-fixer.phar",
"[php]": {
    "editor.defaultFormatter": "junstyle.php-cs-fixer",
    "editor.formatOnSave": true
},
"php-cs-fixer.rules": "@PSR2",
"php-cs-fixer.formatHtml": true,
/**
 * @snippet       Remove Add Cart, Add View Product @ WooCommerce Loop
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
// First, remove Add to Cart Button
 
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
 
// Second, add View Product Button
 
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_view_product_button', 10 );
 
function bbloomer_view_product_button() {
   global $product;
   $link = $product->get_permalink();
   echo '<a href="' . $link . '" class="button addtocartbutton">View Product</a>';
}
use Illuminate\Validation\ValidationException;

throw ValidationException::withMessages(['field_name' => 'This value is incorrect']);
domtoimage.toJpeg(imageCard, {
    width: 1080,
    height: 1080,
    quality: 0.5,
  }).then(dataUrl => {
  domtoimage
    .toJpeg(imageCard, {
      width: 1080,
      height: 1080,
      quality: 0.5,
    })
    .then(dataUrl2 => {
      //Do your all stuff with dataUrl2...
    });
  });
#!/bin/sh
set -e
 
echo "Deploying application ..."
 
# Enter maintenance mode
(php artisan down --message 'The app is being (quickly!) updated. Please try again in a minute.') || true
    # Update codebase
    git fetch origin deploy
    git reset --hard origin/deploy
 
    # Install dependencies based on lock file
    composer install --no-interaction --prefer-dist --optimize-autoloader
 
    # Migrate database
    php artisan migrate --force
 
    # Note: If you're using queue workers, this is the place to restart them.
    # ...
 
    # Clear cache
    php artisan optimize
 
    # Reload PHP to update opcache
    echo "" | sudo -S service php7.4-fpm reload
# Exit maintenance mode
php artisan up
 
echo "Application deployed!"
Artisan::command('logs:clear', function() {
    
    exec('rm -f ' . storage_path('logs/*.log'));

    exec('rm -f ' . base_path('*.log'));
    
    $this->comment('Logs have been cleared!');
    
})->describe('Clear log files');
public static function docurl($url, $json, $post = true)
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_POST, $post);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
        $res = curl_exec($ch);
        curl_close($ch);
        return json_decode($res, true);
    }
   /**
     * create construct method.
     * @return object
     */
    private static function getCall() {
      try {
        $mailchimp = new MailchimpMarketing\ApiClient();
        $mailchimp->setConfig([
            'apiKey' => env('MAILCHIMP_API_KEY'),
            'server' => env('MAILCHIMP_SERVER')
        ]);
      } catch (Exception $e) {
        return array('error' => true, 'error_message' => $e->getMessage());
      }

      return $mailchimp;
    }
function DC_renommer_projets_divi() {

/* Renommer le custom post type */
    register_post_type( 'project',
        array(
            'labels' => array(
              'name' => __( 'Véhicules', 'divi' ),
              'singular_name' => __( 'Véhicule', 'divi' ),

        ),
        'has_archive' => true,
        'hierarchical' => true,
        'public' => true,
        'rewrite' => array( 'slug' => 'vehicule', 'with_front' => false ),
        'supports' => array(),
        'menu_icon' => 'dashicons-marker',
    ));

/* Renommer la catégorie */
    register_taxonomy( 'project_category', array( 'project' ),
      array(
        'labels' => array(
          'name' => _x( 'Catégories de véhicules', 'Catégories de véhicules', 'Divi' ),
      ),
        'hierarchical' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
    ) );

/* Renommer les étiquettes */
    register_taxonomy( 'project_tag', array( 'project' ),
      array(
        'labels' => array(
          'name' => _x( 'Étiquettes des véhicules', 'Étiquettes des véhicules', 'Divi' ),
      ),
        'hierarchical' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
    ) );

}
add_action( 'init', 'DC_renommer_projets_divi' );
foreach($array1 as &$val1){  //Paso el array1 como referencia
    foreach ($array2 as $val2){
        if($val1['email']==$val2['email']){
            $val1['status']=$val2['status'];  //Agrego al array1 el status
        }
    }
}
unset($val1); //Se elimina la referencia
print_r($array1);
server {
    listen 80;
    listen [::]:80;
    server_name example.com;
    root /srv/example.com/public;
 
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";
 
    index index.php;
 
    charset utf-8;
 
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
 
    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }
 
    error_page 404 /index.php;
 
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }
 
    location ~ /\.(?!well-known).* {
        deny all;
    }
}
/**
* Sorting out of stock WooCommerce products - Order product collections by stock status, in-stock products first.
*/
class iWC_Orderby_Stock_Status
{
public function __construct()
{
// Check if WooCommerce is active
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
add_filter('posts_clauses', array($this, 'order_by_stock_status'), 2000);
}
}
public function order_by_stock_status($posts_clauses)
{
global $wpdb;
// only change query on WooCommerce loops
if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag())) {
$posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) ";
$posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby'];
$posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where'];
}
return $posts_clauses;
}
}
new iWC_Orderby_Stock_Status;
/**
* END - Order product collections by stock status, instock products first.
*/


Go to directory laravel/bootstrap/cache and delete config.php file.


How did I solve this issue? After running those commands and not getting the solution.


composer dump-autoload
composer install
php artisan cache:clear
php artisan config:clear
php artisan optimize
php artisan clear-compiled
composer create-project laravel/laravel test_laravel
echo '<pre>';
var_dump();
echo '</pre>';
function debug($msg)
	{
		$ip = $_SERVER["REMOTE_ADDR"];
		$t = date("Y-m-D h:i:s");
		$log_file = storage_path("tmp/debug.log");
		if (is_array($msg)) {
			$msg = var_export($msg, true);
		}
		file_put_contents($log_file, "\n----------\n$t ($ip): $msg \n", FILE_APPEND);
	}
http://192.168.0.111:80/BlogApp/service.php

Postman post
Body
Type JSON
<?php
	$connection = mysqli_connect('localhost','root','','db_blogs_app')
?>
      
      //right most octet for database name present on local host
<?php
	include 'config/db_config.php';

	$data = file_get_contents("php://input");

	$request = json_decode($data);

	$response = array();

	$isValidRequest = false;

	//{"action": "REGISTER_USER","userName":"Mr. Ahmed"}

	if(isset($request->{'action'})){
		if($request->{'action'} == 'REGISTER_USER'){
			$isValidRequest = true;

			$userName = $request -> {'userName'};
			$query = "INSERT INTO user(name) values('".$userName."'')";
			$result = mysqli_query($connection,$query);
			if($result){
				$response['userId'] = mysqli_insert_id($connection);
				$response['status'] = true; 
				$response['responseCode'] = 0;  //success
				$response['message'] = "User registered successfully";
			}
			else{
				$response['status'] = false; 
				$response['responseCode'] = 102;  // registeration failed
				$response['message'] = "User registeration failed";

			}

		}
		if($request->{'action'} == 'ADD_BLOG'){
			$isValidRequest = true;
			
		}
		if($request->{'action'} == 'GET_BLOG'){
			$isValidRequest = true;
			
		}
		if($request->{'action'} == 'UPDATE_BLOG'){
			$isValidRequest = true;
			
		}
		if($request->{'action'} == 'DELETE_BLOG'){
			$isValidRequest = true;
			
		}
		if(!isValidRequest){
			$response['status'] = false; 
			$response['responseCode'] = 101;  //Invalid request action
			$response['message'] = "Request action not defined";
		}

	}
	else{
		$response['status'] = false; 
		$response['responseCode'] = 100;  //Request action not defined
		$response['message'] = "Request action not defined";
	}

	echo json_encode($response);
?>
<?php 

add_action('admin_bar_menu', 'devlinks_add_toolbar_items', 90);
function devlinks_add_toolbar_items($admin_bar){
    $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar',
        'title' => '<span class="dev-icon"></span>'.__( 'Dev Links'),
        'href'  => '/wp-admin',
        'meta'  => array(
            'title' => __('Dev Links'),            
        ),
    ));
    $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_wpcodebox',
        'parent' => 'devlinks_adminbar',
        'title' => 'WPCodeBox',
        'href'  => '/wp-admin/admin.php?page=wpcb_menu_page_php',
        'meta'  => array(
            'title' => __('WPCodeBox'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_wpcodebox'
        ),
    ));
          $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_automaticcss',
        'parent' => 'devlinks_adminbar',
        'title' => 'AutomaticCSS',
        'href'  => '/wp-admin/admin.php?page=automatic-css',
        'meta'  => array(
            'title' => __('AutomaticCSS'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_automaticcss'
        ),
    ));
        $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_oxygentemplates',
        'parent' => 'devlinks_adminbar',
        'title' => 'Oxygen Templates',
        'href'  => '/wp-admin/edit.php?post_type=ct_template',
        'meta'  => array(
            'title' => __('Oxygen Templates'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_oxygentemplates'
        ),
    ));
           $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_plugins',
        'parent' => 'devlinks_adminbar',
        'title' => 'Plugins',
        'href'  => '/wp-admin/plugins.php',
        'meta'  => array(
            'title' => __('Plugins'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_plugins top-separator'
        ),
    ));
               $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_pages',
        'parent' => 'devlinks_adminbar',
        'title' => 'Pages',
        'href'  => '/wp-admin/edit.php?post_type=page',
        'meta'  => array(
            'title' => __('Seiten'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_pages'
        ),
    ));
                $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_posts',
        'parent' => 'devlinks_adminbar',
        'title' => 'Posts',
        'href'  => '/wp-admin/edit.php',
        'meta'  => array(
            'title' => __('Beiträge'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_posts'
        ),
    ));
   $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_mbposttypes',
        'parent' => 'devlinks_adminbar',
        'title' => 'Meta Box Post Types',
        'href'  => '/wp-admin/edit.php?post_type=mb-post-type',
        'meta'  => array(
            'title' => __('Post Types'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_mbposttypes top-separator'
        ),
    ));
       $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_mbtaxonomies',
        'parent' => 'devlinks_adminbar',
        'title' => 'Meta Box Taxonomies',
        'href'  => '/wp-admin/edit.php?post_type=mb-taxonomy',
        'meta'  => array(
            'title' => __('Taxonomies'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_mbtaxonomies'
        ),
    ));
           $admin_bar->add_menu( array(
        'id'    => 'devlinks_adminbar_mbcustomfields',
        'parent' => 'devlinks_adminbar',
        'title' => 'Meta Box Custom Fields',
        'href'  => '/wp-admin/edit.php?post_type=meta-box',
        'meta'  => array(
            'title' => __('Custom Fields'),
            'target' => '_self',
            'class' => 'devlinks_adminbar_mbcustomfields'
        ),
    ));
}
resources/lang/en/auth.php


this is a line:

'failed' => 'These credentials do not match our records.',

/*Ocultar elementos del Menú de Administración*/
add_action('admin_init', 'oxygenados_admin_init');
function oxygenados_admin_init()
{
    // Menús que se eliminan
    $menus_to_stay = array(
        // Entradas
        'edit.php',
        // Usuarios
        'users.php',
    );
    foreach ($GLOBALS['menu'] as $key => $value) {
        if (in_array($value[2], $menus_to_stay)) remove_menu_page($value[2]);
    }
} 
<?php
if (!defined('ABSPATH')) exit;
/*
* Crea un shortcode para mostrar los Quizes
*/

// [quizbook preguntas="" orden=""]
function quizbook_shortcode($atts)
{
    $args = array(
        'posts_per_page' => $atts['preguntas'],
        'orderby' =>  $atts['orden'],
        'post_type' => 'quizes',
    );

    $quizbook = new WP_Query($args); ?>
    <form name="quizbook_enviar" id="quizbook_enviar">
        <div id="quizbook" class="quizbook">
            <ul>
                <?php while ($quizbook->have_posts()) : $quizbook->the_post(); ?>
                    <li>
                    <?php the_title('<h2>', '</h2>');
                    echo '<p>'.the_content().'</p>';

                    $opciones = get_post_meta(get_the_ID());

                    foreach ($opciones as $llave => $opcion) :
                    $resultado = quizbook_filtrar_preguntas($llave);
                    //unset($resultado['qb_correcta']);
                    $numero = explode('_', $llave);

                    if ($resultado === 0) {
                      if ($numero[2] > 0) { ?>
                         <div id="<?php echo get_the_ID() . ":" . $numero[2]; ?>" class=" respuesta ">
                            <?php
                              echo $opcion[0];
                            ?>
                           </div>
                        <?php
                                }
                        }
                        endforeach;
                        ?>
                    </li>

                <?php endwhile;
                wp_reset_postdata() ?>
            </ul>
        </div>
        <!--#quizbook-->

        <input type="submit" value="Enviar" id="quizbook_btn_submit">

        <div id="quizbook_resultado"></div>
    </form>
    <!--form-->
<?php
}


add_shortcode('quizbook', 'quizbook_shortcode');
//get Date diff as intervals 
$d1 = new DateTime("2018-01-10 00:00:00");
$d2 = new DateTime("2019-05-18 01:23:45");
$interval = $d1->diff($d2);
$diffInSeconds = $interval->s; //45
$diffInMinutes = $interval->i; //23
$diffInHours   = $interval->h; //8
$diffInDays    = $interval->d; //21
$diffInMonths  = $interval->m; //4
$diffInYears   = $interval->y; //1

//or get Date difference as total difference
$d1 = strtotime("2018-01-10 00:00:00");
$d2 = strtotime("2019-05-18 01:23:45");
$totalSecondsDiff = abs($d1-$d2); //42600225
$totalMinutesDiff = $totalSecondsDiff/60; //710003.75
$totalHoursDiff   = $totalSecondsDiff/60/60;//11833.39
$totalDaysDiff    = $totalSecondsDiff/60/60/24; //493.05
$totalMonthsDiff  = $totalSecondsDiff/60/60/24/30; //16.43
$totalYearsDiff   = $totalSecondsDiff/60/60/24/365; //1.35
<!-- @yield only use one time from @section

So use @push @stack in you main layout and many @push in multiple views

In your layout.blade.php add @stack('scripts')

And in index.blade.php add-->




@push('scripts')
    <script src="/index.js"></script>
@endpush



<!--And in contact.blade.php add-->


@push('scripts')
    <script src="/contact.js"></script>
@endpush


<!--You can push multiple css or js or content with @push and @stacks

See https://laravel.com/docs/5.8/blade#stacks


In web.php add route name to contact page

Add this to layout.app.php-->


@if(request()->route()->getName() != "contact")
  Load your css here as page not contact
@endif


<!--So if you open contact page the css not loaded as route name is contact-->
/**
*   WooCommerce woocommerce_order_item_line_item_html action hook registeration.
*/
add_action('woocommerce_order_item_line_item_html', 'woocommerce_order_item_line_item_html', 1, 3);


/**
* Callback Listener for customised line item functionality in the admin.
*/
function woocommerce_order_item_line_item_html($item_id, $item, $order){
    // Add your custom line item functionality.
    // A good example would be order fulfillment for a line item.
}
<?php
add_action( 'pre_get_posts', 'pagination_fix_static_homepage' );
function pagination_fix_static_homepage( $query ) {
    $front_page_id        = get_option( 'page_on_front' );
    $current_page_id      = $query->get( 'page_id' );
    $is_static_front_page = 'page' === get_option( 'show_on_front' );
    
    if ( $is_static_front_page && $front_page_id == $current_page_id  ) {
        if ( get_query_var( 'paged' ) ) {
            $paged = get_query_var( 'paged' );
        } elseif ( get_query_var( 'page' ) ) {
            $paged = get_query_var( 'page' );
        } else {
            $paged = 1;
        }
        $paged = intval( $paged );
        $query->set( 'paged', $paged );
    }
    return $query;
}
add_filter( 'woocommerce_product_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
add_filter( 'woocommerce_product_variation_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
function custom_get_stock_quantity( $value, $product ) {
    $value = 15; // <== Just for testing
    return $value;
}
    $_product = wc_get_product( $post_id );

    if( $_product->is_type( 'simple' ) ) {
    // do stuff for simple products
    } else {
    // do stuff for everything else
    }
function theme_customizer_function($wp_customize)
{
	$wp_customize->add_panel('theme_options', array(
		'title' => 'Theme Options',
		'priority' => 10,
		'capability' => 'edit_theme_options',
	));
	
	
	$wp_customize->add_section('landing_page_slider', array(
		'title' => 'Slider Section',
		'description' => __('Home Page Slider Customization'),
		'panel' => 'theme_options',
	));
	
	$wp_customize->add_setting('landing_main_header', array(
		'default' => __('The Design Logic')
	));
	$wp_customize->add_control('landing_main_header', array(
		'label' => 'Main Heading',
		'section' => 'landing_page_slider',
		'priority' => 1 
	));
	
    $wp_customize->add_setting('landing_slider_description', array());
    $wp_customize->add_control('landing_slider_description', array(
        'label' => 'Slider Description',
        'section' => 'landing_page_slider',
        'priority' => 2
        ));
        
        
    $wp_customize->add_section('home_abt_sec', array(
        'title' => 'About Section',
        'panel' => 'theme_options',
        'active_callback' => 'is_front_page',
        
        ));  
        
    $wp_customize->add_setting('home_abt_heading', array());    
    $wp_customize->add_control('home_abt_heading', array(
        'label' => 'Heading',
        'section' => 'home_abt_sec',
        'priority' => 1
        ));
        
    $wp_customize->add_setting('home_abt_cnt', array());
    $wp_customize->add_control('home_abt_cnt', array(
        'label' => 'About Content',
        'section' => 'home_abt_sec',
        'type' => 'textarea',
        ));
        
    $wp_customize->add_setting('home_abt_img', array());
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'home_abt_img', array(
	'label' => 'About Section Image',
	'section' => 'home_abt_sec',
	)));
        
        
    $wp_customize->add_section('footer_section', array(
        'title' => 'Footer Section',
        'priority' => 170,
        ));    
    $wp_customize->add_setting('footer_text', array());
    $wp_customize->add_control('footer_text', array(
        'label' => 'Footer Disclaimer',
        'section' => 'footer_section',
        'type' => 'textarea',
        ));
        
}
add_action('customize_register', 'theme_customizer_function');
function theme_customizer_function($wp_customize)
{
	$wp_customize->add_panel('theme_options', array(
		'title' => 'Theme Options',
		'priority' => 10,
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_section('landing_page_slider', array(
		'title' => 'Slider Section',
		'description' => __('Home Page Slider Customization'),
		'panel' => 'theme_options',
	));
	$wp_customize->add_setting('landing_main_heading', array(
		'default' => __('Some Text Here')
	));
	$wp_customize->add_control('landing_main_heading', array(
		'label' => 'Main Heading',
		'section' => 'landing_page_slider',
		'priority' => 1
	));

}
add_action('customize_register', 'theme_customizer_function');
// add a custom Coming Soon page

add_action( 'template_redirect', 'my_custom_coming_soon' );

function my_custom_coming_soon() {

    if( !is_user_logged_in() && !is_page( 'coming-soon' ) ){

        wp_redirect( site_url( 'coming-soon' ) );

        exit();

    }

}


// To disable the coming soon page, just comment out this line by adding // at the start
//add_action( 'template_redirect', 'my_custom_coming_soon' );
<?php
add_action('admin_init', function () {
    // Redirect any user trying to access comments page
    global $pagenow;
    
    if ($pagenow === 'edit-comments.php') {
        wp_redirect(admin_url());
        exit;
    }
    // Remove comments metabox from dashboard
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    // Disable support for comments and trackbacks in post types
    foreach (get_post_types() as $post_type) {
        if (post_type_supports($post_type, 'comments')) {
            remove_post_type_support($post_type, 'comments');
            remove_post_type_support($post_type, 'trackbacks');
        }
    }
});
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
// Remove comments page in menu
add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php');
});
// Remove comments links from admin bar
add_action('init', function () {
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
});
 Save
add_filter( 'mpcs_classroom_style_handles', function( $allowed_handles ) {
  $allowed_handles[] = 'elementor-icons';
  $allowed_handles[] = 'elementor-frontend';
  $allowed_handles[] = 'elementor-post-' . get_the_ID();
  $allowed_handles[] = 'elementor-pro';
  $allowed_handles[] = 'elementor-gallery';
  $allowed_handles[] = 'elementor-icons-fa-solid';
  $allowed_handles[] = 'elementor-icons-fa-brands';
  $allowed_handles[] = 'elementor-icons-fa-regular';
  $allowed_handles[] = 'prismjs_style';
  $allowed_handles[] = 'editor-preview';
  $allowed_handles[] = 'pro-editor-preview';
  $allowed_handles[] = 'flatpickr';
  $allowed_handles[] = 'select2';
  $allowed_handles[] = 'elementor-select2';
  $allowed_handles[] = 'elementor-pro-admin';
  
  return $allowed_handles;
});
'public' => [
  'driver' => 'local',
  'root' => public_path('app/public_html/'),
  'url' => env('APP_URL').'/storage',
  'visibility' => 'public',
],

if ($request->hasFile('image')) {
  $image = $request->file('image');
  $filename = 'page' . '-' . time() . '.' . $image->getClientOriginalExtension();
  $location = public_path('app/public_html/images/' . $filename);
  Image::make($image)->resize(1200, 600)->save($location);
  if(!empty($page->image)){
    Storage::delete('images/' . $page->image);
  }
  $page->image = $filename;            
}






What I did to solve this problem:

1.go inside the project folder using ssh
2.if public folder not exist, create it. If already created, then make sure the storage symlink you created in development been deleted.
3.do php artisan storage:link
4.move the storage symlink that created to the public_html folder
5.done.
<pre>
  <?php
    $taxonomies = get_taxonomies();
    print_r($taxonomies);
  ?>
</pre>
public function getSlugOptions() : SlugOptions
{
    return SlugOptions::create()
        ->generateSlugsFrom('title')
        ->saveSlugsTo('slug')
        ->usingLanguage('ar');
}
<?php
$some_long_text = // Start Text
Some long text
that has many lines
 
and paragraphs in it.
// end text
 
echo wpautop( $some_long_text );
?>
<?php
/**
* This method unzips a directory within a zip-archive
*
* @author Florian 'x!sign.dll' Wolf
* @license LGPL v2 or later
* @link http://www.xsigndll.de
* @link http://www.clansuite.com
*/

function extractZip( $zipFile = '', $dirFromZip = '' )
{   
    define(DIRECTORY_SEPARATOR, '/');

    $zipDir = getcwd() . DIRECTORY_SEPARATOR;
    $zip = zip_open($zipDir.$zipFile);

    if ($zip)
    {
        while ($zip_entry = zip_read($zip))
        {
            $completePath = $zipDir . dirname(zip_entry_name($zip_entry));
            $completeName = $zipDir . zip_entry_name($zip_entry);

            // Walk through path to create non existing directories
            // This won't apply to empty directories ! They are created further below
            if(!file_exists($completePath) && preg_match( '#^' . $dirFromZip .'.*#', dirname(zip_entry_name($zip_entry)) ) )
            {
                $tmp = '';
                foreach(explode('/',$completePath) AS $k)
                {
                    $tmp .= $k.'/';
                    if(!file_exists($tmp) )
                    {
                        @mkdir($tmp, 0777);
                    }
                }
            }

            if (zip_entry_open($zip, $zip_entry, "r"))
            {
                if( preg_match( '#^' . $dirFromZip .'.*#', dirname(zip_entry_name($zip_entry)) ) )
                {
                    if ($fd = @fopen($completeName, 'w+'))
                    {
                        fwrite($fd, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
                        fclose($fd);
                    }
                    else
                    {
                        // We think this was an empty directory
                        mkdir($completeName, 0777);
                    }
                    zip_entry_close($zip_entry);
                }
            }
        }
        zip_close($zip);
    }
    return true;
}

// The call to exctract a path within the zip file
extractZip( 'clansuite.zip', 'core/filters' );
?>
/*-----------------------------------------------------------------------------------*/
/*  ACF
/*-----------------------------------------------------------------------------------*/

add_filter('acf/settings/show_admin', '__return_false');
public function store(Request $request)
{
    // ...

    // iterate (loop) over each item in the order items collection
    $order->items->each(function ($item) {
        // deduct the quantity of the item for this order
        // from the stock of the product and update the new stock
        $item->update(['stock' => ($item->stock - $item->pivot->quantity)]);
    });

    // ...
}
/*Multiple Custom DIVI FONTS - In this Example INTER & Poppins 500 & 700*/
/* Get font & CSS from https://google-webfonts-helper.herokuapp.com/fonts */
/*File structure in this example is: 
/* CSS: root-> assets -> css -> fonts.css
/ FONT FILES: root -> assets -> fonts -> 2 folders, inter & poppins

/* This code goes in functions.php - Child-theme*/
add_filter('et_websafe_fonts', 'load_divi_custom_font',10,2);
function load_divi_custom_font($fonts) {
  wp_enqueue_style( 'divi-child', get_stylesheet_directory_uri() . '/assets/css/fonts.css' );
  // Add multiple fonts to Divi's font menu to acces them within DIVI
  $custom_font = array('Poppins' => array(
    'styles'        => '500,700',
    'character_set' => 'latin',
    'type'          => 'sans-serif',
    'standard'      => 1
  ),
  'Inter' => array(
    'styles'        => '500,700',
    'character_set' => 'latin',
    'type'          => 'sans-serif',
    'standard'      => 1
  ));

  return array_merge($custom_font,$fonts);
}

/*CSS for child-theme*/
/* poppins-500 - latin */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/poppins/poppins-v20-latin-500.eot'); /* IE9 Compat Modes */
  src: local(''),
       url('../fonts/poppins/poppins-v20-latin-500.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('../fonts/poppins/poppins-v20-latin-500.woff2') format('woff2'), /* Super Modern Browsers */
       url('../fonts/poppins/poppins-v20-latin-500.woff') format('woff'), /* Modern Browsers */
       url('../fonts/poppins/poppins-v20-latin-500.ttf') format('truetype'), /* Safari, Android, iOS */
       url('../fonts/poppins/poppins-v20-latin-500.svg#Poppins') format('svg'); /* Legacy iOS */
  font-display : swap;
}
/* poppins-700 - latin */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/poppins/poppins-v20-latin-700.eot'); /* IE9 Compat Modes */
  src: local(''),
       url('../fonts/poppins/poppins-v20-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('../fonts/poppins/poppins-v20-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
       url('../fonts/poppins/poppins-v20-latin-700.woff') format('woff'), /* Modern Browsers */
       url('../fonts/poppins/poppins-v20-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
       url('../fonts/poppins/poppins-v20-latin-700.svg#Poppins') format('svg'); /* Legacy iOS */
  font-display : swap;
}
/* inter-700 - latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/inter/inter-v11-latin-700.eot'); /* IE9 Compat Modes */
  src: local(''),
       url('../fonts/inter/inter-v11-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('../fonts/inter/inter-v11-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
       url('../fonts/inter/inter-v11-latin-700.woff') format('woff'), /* Modern Browsers */
       url('../fonts/inter/inter-v11-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
       url('../fonts/inter/inter-v11-latin-700.svg#Inter') format('svg'); /* Legacy iOS */
  font-display : swap;
}
/* inter-500 - latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/inter/inter-v11-latin-500.eot'); /* IE9 Compat Modes */
  src: local(''),
       url('../fonts/inter/inter-v11-latin-500.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('../fonts/inter/inter-v11-latin-500.woff2') format('woff2'), /* Super Modern Browsers */
       url('../fonts/inter/inter-v11-latin-500.woff') format('woff'), /* Modern Browsers */
       url('../fonts/inter/inter-v11-latin-500.ttf') format('truetype'), /* Safari, Android, iOS */
       url('../fonts/inter/inter-v11-latin-500.svg#Inter') format('svg'); /* Legacy iOS */
  font-display : swap;
}
<?php

/*************
 * 
 * Original code at https://community.automaticcss.com/c/general-discussion/another-workaround
 * Credit @Christoph Sanz
 *        @Rich Deane for the condidtions inclued in JSON file and Oxy BG variable name
 * UI and Style Updates @Lucas Pelton
 * 
 */

function acss_context_menu_enqueue_scripts() {
 
wp_register_script( 'acss-context-menu', '');
wp_enqueue_script( 'acss-context-menu' );
 
$script  =  '
jQuery(document).ready(()=>{
        console.log(\'ACSS-Context-Menu Code Snippet is active\')
let acssContextMenu = document.createElement(\'div\');

acssContextMenu.id = \'acss-context-menu\';


varGroupHelpers = [
    {\'varName\': \'space\', \'icon\': \'dashicons-controls-pause\'},
    {\'varName\': \'text\', \'icon\': \'dashicons-editor-textcolor\'},
    {\'varName\': \'width\', \'icon\': \'dashicons-image-flip-horizontal\'}
    ]
let menuStructure = [];

varGroupHelpers.forEach(varGroupHelper=>{
    menuStructure.push({
        \'icon\': varGroupHelper.icon,
    \'values\': [
        {\'niceName\': \'xs\', \'value\': `var(--${varGroupHelper.varName}-xs)`, \'unit\': \' \'},
        {\'niceName\': \'s\', \'value\': `var(--${varGroupHelper.varName}-s)`,\'unit\': \' \'},
        {\'niceName\': \'m\', \'value\': `var(--${varGroupHelper.varName}-m)`,\'unit\': \' \'},
        {\'niceName\': \'l\', \'value\': `var(--${varGroupHelper.varName}-l)`,\'unit\': \' \'},
        {\'niceName\': \'xl\', \'value\': `var(--${varGroupHelper.varName}-xl)`,\'unit\': \' \'},
        {\'niceName\': \'xxl\', \'value\': `var(--${varGroupHelper.varName}-xxl)`,\'unit\': \' \'}
        
        ]
    })
})

const acssListClass = "acss-var-list";
const acssListItemClass = "acss-var-value";
let acssContextMenuHTML="";
  
menuStructure.forEach(e=>{
    acssContextMenuHTML += `<div class="acss-context-sub"><ul class="${acssListClass}"> `
    acssContextMenuHTML += `<li class="${acssListItemClass} dashicons-before ${e.icon}"></li>`
    e.values.forEach(e=>{
        acssContextMenuHTML += `<li class="${acssListItemClass}" data-value="${e.value}" data-unit="${e.unit}">${e.niceName}</li>`
    })
    acssContextMenuHTML += `</ul></div>`
})
acssContextMenuHTML += `<div class="unset" data-value="" data-unit=" ">Unset/Delete</div>
<style>
#acss-context-menu .unset {
    background-color: black;
    border-radius: 4px;
    color: red;
    cursor: pointer;
    margin: 0.5em auto;
    padding: 0.5em;
}
    #acss-context-menu .acss-context-sub{
        align-items: center;
        text-align: center;
    }
    #acss-context-menu ul{
        border-radius: 4px;
        display: flex;
        flex-direction: row;
        gap: 0;
        useCustomTag: true;
        overflow: hidden;
        padding: unset;
        margin: 0.5em 0.5em 0;
    }
    #acss-context-menu {
        font-size: 12px;
        position: fixed;
        z-index: 9999999;
        background-color: #222b34;
        border-radius: 4px;
        color: white;
        display: flex;
        flex-wrap: nowrap;
        flex-direction: column;
        align-items: flex-start;
        box-shadow: 5px 5px 10px black;
    }
    #acss-context-menu li {
        min-width: 1.5em;
        min-height: 1.5em;
        background-color: black;
        list-style-type: none;
        cursor: pointer;
        align-items: center;
        padding: 0.75em 1.5em;
        transition: background-color .2s ease;
    }
    
    #acss-context-menu .spacing:before {
        content: "\f523";
    }
    
    #acss-context-menu .text:before {
        content: "\f215";
    }
    
    #acss-context-menu .width:before {
        content: "\f169";
    }
    
    #acss-context-menu li:hover,
    #acss-context-menu .unset:hover {
        background: #24577e;
        background: var(--oxy__input-bg);
    }
    
    #acss-context-menu li:first-child {
        border-right:1px solid #333333;
        padding: 0.75em;
        pointer-events: none;
    }
    </style>
    `

acssContextMenu.style.display = "none";

acssContextMenu.innerHTML = acssContextMenuHTML;
document.body.appendChild(acssContextMenu);

let inputItem;
document.addEventListener(\'click\', e=>{
    acssContextMenu.style.display = "none";
})
document.addEventListener(\'contextmenu\',(e)=>{
    acssContextMenu.style.display = "none";
    if(e.target.getAttribute("type") != "text" ) return
    e.preventDefault();
    
    acssContextMenu = document.querySelector(\'#acss-context-menu\');
    acssContextMenu.style.display = "flex";
    acssContextMenu.style.left = e.clientX +\'px\';
    acssContextMenu.style.top = e.clientY + \'px\';
    inputItem = e.target;
    var iframeScope = $scope.iframeScope;
    document.querySelectorAll(\'.acss-var-value, .unset\').forEach(e2=> e2.addEventListener(\'click\', varClick=>{
        iframeScope.setOptionUnit(inputItem.getAttribute("data-option"), varClick.target.getAttribute("data-unit"));
        eval(inputItem.getAttribute("ng-model") + \' = varClick.target.getAttribute("data-value")\');
        
        eval(inputItem.getAttribute("ng-change"))
        acssContextMenu.style.display = "none";
    }))
})});
';
 
wp_add_inline_script('acss-context-menu', $script, 'after');
 
}
If(isset($_GET['ct_builder'])){
If($_GET['ct_builder'] == true){
add_action('wp_enqueue_scripts', 'acss_context_menu_enqueue_scripts');
}
}
<?php

function post_count() {
    $post_type = 'unternehmer';
    $total = wp_count_posts($post_type)->publish;
    return $total;
}
add_shortcode(‘unternehmer_anzahl’,’post_count’);
<?php

add_filter( 'body_class','my_body_classes' );
function my_body_classes( $classes ) {
 
    if ( is_front_page() ) {
     
        $classes[] = 'overlay-header';
         
    }
     
    return $classes;
     
}
<?php

add_image_size( 'image-480', 480, 9999 );
add_image_size( 'image-640', 640, 9999 );
add_image_size( 'image-720', 720, 9999 );
add_image_size( 'image-960', 960, 9999 );
add_image_size( 'image-1168', 1168, 9999 );
add_image_size( 'image-1440', 1440, 9999 );
add_image_size( 'image-1920', 1920, 9999 );
  <!-- CSS links-->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
  <!-- fancybox -->
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.css'>
  <!-- magnific-popup -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css" />

<section class="portfolio-section" id="portfolio">
    <div class="container-fluid">
      <div class="row">
        <div class="col-lg-12 text-center">
          <h2>Project Gallery</h2>
          <p>Use all the same size pictures :)</p>
        </div>
      </div>
      <div class="portfolio-menu mt-2 mb-4">
        <nav class="controls">
          <button type="button" class="control outline" data-filter="all">All</button>
          <button type="button" class="control outline" data-filter=".web">Web Design</button>
          <button type="button" class="control outline" data-filter=".dev">Development</button>
          <button type="button" class="control outline" data-filter=".wp">WordPress</button>
        </nav>
      </div>
		
       <ul class="row portfolio-item">
<?php 
function get_images_from_media_library() {
	$contador = 0;
    $args = array(
        'post_type' => 'attachment',
        'post_mime_type' =>'image/jpeg',
        'post_status' => 'inherit',
        'posts_per_page' => 50000,
    );
    $query_images = new WP_Query( $args );
    $images = array();
    foreach ( $query_images->posts as $image) {
	?>
		   
        <li class="mix dev col-xl-3 col-md-4 col-12 col-sm-6 pd"><img src="<?php echo $image->guid;?>?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80"" itemprop="thumbnail">
	<div class="portfolio-overlay">
            <div class="overlay-content">
              <p class="category"><?php echo $image->id;  ?></p>
              <a href="#" title="View Project" target="_blank">
                <div class="magnify-icon">
                  <p><span><i class="fa fa-link" aria-hidden="false"></i></span></p>
                </div>
              </a>
              <a data-fancybox="item" title="click to zoom-in" href="<?php echo $image->guid; ?>">
                <div class="magnify-icon">
                  <p><span><i class="fa fa-search" aria-hidden="true"></i></span></p>
                </div>
              </a>
            </div>
          </div>
        </li>
	<?php
		$contador++;
    }
	//echo $contador;
    //return $images;
}

	 get_images_from_media_library();
?>

	      </ul>
    </div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
  <!-- Mixitup -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/mixitup/3.2.2/mixitup.min.js"></script>
  <!-- fancybox -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.20/jquery.fancybox.min.js"></script>
  <!-- Fancybox js -->
  <script>
    /*Downloaded from https://www.codeseek.co/ezra_siton/mixitup-fancybox3-JydYqm */
    // 1. querySelector
    var containerEl = document.querySelector(".portfolio-item");
    // 2. Passing the configuration object inline
    //https://www.kunkalabs.com/mixitup/docs/configuration-object/
    var mixer = mixitup(containerEl, {
      animation: {
        effects: "fade translateZ(-100px)",
        effectsIn: "fade translateY(-100%)",
        easing: "cubic-bezier(0.645, 0.045, 0.355, 1)"
      }
    });
    // fancybox insilaze & options //
    $("[data-fancybox]").fancybox({
      loop: true,
      hash: true,
      transitionEffect: "slide",
      /* zoom VS next////////////////////
      clickContent - i modify the deafult - now when you click on the image you go to the next image - i more like this approach than zoom on desktop (This idea was in the classic/first lightbox) */
      clickContent: function(current, event) {
        return current.type === "image" ? "next" : false;
      }
    });
  </script>
//Page Slug Body Class
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_slug_body_class' );
echo var_export($GLOBALS['post'], TRUE);
<pre>
  <?php
    $post_types = get_post_types();
    print_r($post_types);
  ?>
</pre>
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
<?php

// get the value of image_advanced type of custom field for the current taxonomy term 
$clients_gallery = rwmb_meta( 'clients_gallery', ['object_type' => 'term'], get_queried_object_id() );
<?php
// Disable editor for OXYGEN pages
add_action('init', 'my_remove_editor_from_post_type');
function my_remove_editor_from_post_type() {
remove_post_type_support( 'page', 'editor' );
}
// Fully Disable Gutenberg editor.
add_filter('use_block_editor_for_post_type', '__return_false', 10);
// Don't load Gutenberg-related stylesheets.
add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 );
function remove_block_css() {
wp_dequeue_style( 'wp-block-library' ); // WordPress core
wp_dequeue_style( 'wp-block-library-theme' ); // WordPress core
wp_dequeue_style( 'wc-block-style' ); // WooCommerce
wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme
}
<?php


add_action( 'woocommerce_before_cart', 'auto_select_free_shipping_by_default' );
function auto_select_free_shipping_by_default() {
    if ( isset(WC()->session) && ! WC()->session->has_session() )
        WC()->session->set_customer_session_cookie( true );

    // Check if "free shipping" is already set
    if ( strpos( WC()->session->get('chosen_shipping_methods')[0], 'woocommerce_flatrate_perpostcode' ) !== false )
        return;

    // Loop through shipping methods
    foreach( WC()->session->get('shipping_for_package_0')['rates'] as $key => $rate ){
        if( $rate->method_id === 'shipping_method_0_woocommerce_flatrate_perpostcode' ){
            // Set "Free shipping" method
            WC()->session->set( 'chosen_shipping_methods', array($rate->id) );
            return;
        }
    }
}

?>
<?php

add_filter( 'woocommerce_checkout_fields', 'xa_remove_billing_checkout_fields' );
function xa_remove_billing_checkout_fields( $fields ) {
    // change below for the method
    $shipping_method ='local_pickup:1'; 
    // change below for the list of fields
    $hide_fields = array( 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_state', 'billing_postcode' );

    $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
    // uncomment below line and reload checkout page to check current $chosen_methods
     print_r($chosen_methods);
    $chosen_shipping = $chosen_methods[0];

    foreach($hide_fields as $field ) {
        if ($chosen_shipping == $shipping_method) {
            $fields['billing'][$field]['required'] = false;
            $fields['billing'][$field]['class'][] = 'hide';
        }
        $fields['billing'][$field]['class'][] = 'billing-dynamic';
    }

    return $fields;
}

add_action( 'wp_footer', 'cart_update_script', 999 );
function cart_update_script() {
    if (is_checkout()) :
    ?>
    <style>
        .hide {display: none!important;}
    </style>
    <script>
        jQuery( function( $ ) {

            // woocommerce_params is required to continue, ensure the object exists
            if ( typeof woocommerce_params === 'undefined' ) {
                return false;
            }

            $(document).on( 'change', '#shipping_method input[type="radio"]', function() {
                // change local_pickup:1 accordingly 
                $('.billing-dynamic').toggleClass('hide', this.value == 'local_pickup:1');
            });
        });
    </script>
    <?php
    endif;
}
function mytheme_custom_excerpt_length( $length ) {
    return 15;
}
add_filter( 'excerpt_length', 'mytheme_custom_excerpt_length', 999 );
// set current category
$categories = get_the_category();
$category = $categories[0];
$cat_ID = $category->cat_ID;    

// get next post link
$next_post = get_adjacent_post( true, '', false );
if( $next_post ) {
    echo '<a href="' . get_permalink( $next_post->ID ) . '">Next post</a>';
} else {
    $first = new WP_Query( array(
        'post_type' => 'project',
        'post_status' => 'publish',
        'posts_per_page' => 1,
        'order' => 'ASC',
        'cat' => $cat_ID
    ));

    $first->the_post();
    echo '<a href="' . get_permalink() . '">Next post</a>';
    wp_reset_query();
};

// show prev post link
$prev_post = get_adjacent_post( true, '', true );
if( $prev_post ) {
    echo '<a href="' . get_permalink( $prev_post->ID ) . '">Prev post</a>';
} else {
    $last = new WP_Query( array(
        'post_type' => 'project',
        'post_status' => 'publish',
        'posts_per_page' => 1,
        'order' => 'DESC',
        'cat' => $cat_ID
    ));

    $last->the_post();
    echo '<a href="' . get_permalink() . '">Prev post</a>';
    wp_reset_query();
};
<?php 

/*
Plugin Name:  Remove Archive Prefix
Description:  Load custom fonts and inject to Oxygen
Author:       <a href="https://dplugins.com/">dPlugins</a>
Version:      1.0.1
Description:  https://dplugins.com/code_snippets/remove-archive-prefix/
Copyright:    © 2021, dPlugins
Version History:
2021-07-10  //  1.0.1  //  Fixed bug with Oxygen to load SVG Icons
2021-04-20  //  1.0.0  //  Initial Release
*/

/**
 * Add a span around the title prefix so that the prefix can be hidden with CSS
 * if desired.
 * Note that this will only work with LTR languages.
 *
 * @param string $title Archive title.
 * @return string Archive title with inserted span around prefix.
 */
function mk_hide_the_archive_title( $title ) {

    // Skip if the site isn't LTR, this is visual, not functional.
    // Should try to work out an elegant solution that works for both directions.
    if ( is_rtl() || !is_archive() ) {
        return $title;
    }

    // Split the title into parts so we can wrap them with spans.
    $title_parts = explode( ': ', $title, 2 );

    // Glue it back together again.
    if ( ! empty( $title_parts[1] ) ) {
        $title = wp_kses(
            $title_parts[1],
            array(
                'span' => array(
                    'class' => array(),
                ),
            )
        );
        $title = '<span class="screen-reader-text">' . esc_html( $title_parts[0] ) . ': </span>' . $title;
    }

    return $title;

}

add_filter( 'get_the_archive_title', 'mk_hide_the_archive_title' );

?>
<?php

add_action( 'init', 'stop_heartbeat', 1 );
 
function stop_heartbeat() {
    wp_deregister_script('heartbeat');
}

?>
<?php
function adminStylesCss() {
echo '
<style>

/* Admin BG color */
.wp-admin {
  background-color: #262626;
}

/* Revert colors and bring back links colors */
.wp-admin #wpbody {
  filter: invert(0.85) hue-rotate(185deg);
}

/* Bring back colors to the images */
.wp-admin #wpbody img {
  filter: invert(0.85) hue-rotate(-185deg);
  background: white;
}

/* Gutenberg bring it back */
.block-editor-page #wpbody {
  filter: unset;
}
/* Gutenberg topbar */
.block-editor-page .interface-interface-skeleton__header {
  filter: invert(0.85) hue-rotate(185deg);
}
.block-editor-page .is-primary {
  color: black !important;
}

/* Gutenberg sidebars */
.block-editor-page .interface-interface-skeleton__sidebar,
.block-editor-page .interface-interface-skeleton__secondary-sidebar {
  filter: invert(0.85) hue-rotate(185deg);
}

/* Gutenberg Content - Manual colors */
.block-editor-page .editor-styles-wrapper {
  color: lightgray;
  background: #262626;
}

/* Gutenberg Links */
.block-editor-page .editor-styles-wrapper a {
  filter: invert(0.85) hue-rotate(185deg);
}

/* Gutenberg Metaboxes - Bellow content */
.block-editor-page .edit-post-layout__metaboxes {
  border-top: 0px;
  background-color: #262626;
}

</style>';

}
add_action('admin_head', 'adminStylesCss');

?>
function dotirating_function( $attr ) {
91
  $args = shortcode_atts( array('id' => '',), $attr );
92
    
93
    $product_id = $args['id'];
94
    $product = new WC_product($product_id);
95
    $attachment_ids = $product->get_gallery_image_ids();
96
    
97
    if ( ! empty($attachment_ids) ) :
98
    return wp_get_attachment_image($attachment_ids[0], 'large');
99
endif;
100
    
101
}
102
​
103
add_shortcode('dotirating', 'dotirating_function');
<?php




class Dbtable {


function __construct() {
   // $this->getId();
    add_action( 'admin_notices', array( $this, 'my_update_notice'));
    add_shortcode( 'mydbtable', array( $this, 'showmytable'));

}


public function showmytable() {

    global $wpdb;
    $result = $wpdb->get_results ( "SELECT * FROM khdata_devis  ORDER BY id" );
    ob_start();
//$code = 'Hello World';



    $output = '<table>
    <tr>
      <th> name </th>
      <th>email</th>
      <th>city</th>
    </tr>';

    foreach ( $result as $print )   {
    $output .='<tr>
      <td>"'.$print->city.'"</td>
      <td>"'.$print->email.'"</td>
      <td>21</td>
    </tr>';}

    $output .='</table>';
    
  



return $output;

ob_get_clean();
}


function my_update_notice() {
    global $wpdb;
    ?>
    <div class="updated notice">
        <p><?php _e( "name of Database $wpdb->dbname", 'my_plugin_textdomain' ); ?></p>
    </div>
    <?php
}

}
function func_update_post_name( $post_id, $post ){
 
    if ( 'post-type-slug' == $post->post_type ) {
 
        remove_action( 'save_post', 'func_update_post_name',30,2 );
 
        // update the post slug
        wp_update_post( array(
            'ID' => $post_id,
            'post_name' => uniqid() 
        ));
 
       add_action( 'save_post', 'func_update_post_name', 30, 2 );
    }
}
add_action( 'save_post', 'func_update_post_name', 30, 2 );
<?php
	echo 'yahya';
?>
//hide username in comments
function remove_comment_author_class($classes)
{
	foreach ($classes as $key => $class) {
		if (strstr($class, "comment-author-")) {
			unset($classes[$key]);
		}
	}
	return $classes;
}
add_filter('comment_class', 'remove_comment_author_class');
add_action( 'admin_notices', 'bbloomer_products_no_weight_admin' );

function bbloomer_products_no_weight_admin(){
    global $pagenow, $typenow;
    if ( 'edit.php' === $pagenow && 'product' === $typenow ) {
		echo '<div class="notice notice-warning is-dismissible"><h3>Products with no weight</h3><ul>';
		$args = array(
			'status' => 'publish',
			'visibility' => 'visible',
			'limit' => -1
		);
		$products = wc_get_products( $args );
		foreach ( $products as $product ) {
			if ( ! $product->get_weight() ) {
				echo '<li><a href="' . esc_url( get_edit_post_link( $product->get_id() ) ) . '">' . $product->get_name() . '</a></li>';
			}
		}
		echo '</ul></div>';
    }
}
Gegasoft uses the following name conventions for laravel
=============================================================
Variables	=>	camelCase	=>	$articlesWithAuthor
Collection Variable	=>	descriptive, plural	=>	$activeUsers = User::active()->get()
Object Variable	=>	descriptive, singular	=>	$activeUser = User::active()->first()
View	=>	snake_case	=>	show_filtered.blade.php
Controllers	=>	singular, ProperCase	=>	ArticleController
Model Name	=>	singular, ProperCase	=>	User, FollowingRequest
Model attribute/property	=>	snake_case	=>	$model->created_at
Method	=>	camelCase	=>	getAll
Method in resource controller	=>	table	=>	store
Method in test class	=>	camelCase	=>	testGuestCannotSeeArticle
hasOne/belongsTo relation	=>	singular	=>	articleComment
Other relations	=>	plural	=>	articleComments
Table Name =>	plural	=>	article_comments
Table column	=>	snake_case without model name	=>	meta_title
Route	=>	plural	=>	articles/1
Named route	=>	snake_case with dot notation	=>	users.show_active
Primary key	=>	-	=>	id
Foreign key	=>	singular model name with _id suffix	=>	article_id
Pivot table	=>	singular model names in alphabetical order	=>	article_user
Migration	=>	-	=>	2017_01_01_000000_create_articles_table
Config and language files index	=>	snake_case	=>	articles_enabled
Config	=>	snake_case	=>	google_calendar.php
Contract (interface)	=>	adjective or noun	=>	Authenticatable
Trait	=>	adjective	=>	Notifiable
{{ $users->withQueryString()->links() }}
<?php
/*
  Plugin Name: WP Like button
  Description: WP Like button allows you to add Facebook like button to your wordpress blog.
  Author: <a href="http://crudlab.com/">CRUDLab</a>
  Version: 1.6.9
 */
$CLFBLBPath = plugin_dir_path(__FILE__);

require_once $CLFBLBPath . 'CLLBtnSettings.php';

class CLFBLBtn {

    private $CLLBtnSettings = null;
    private $table_name = null;
    public static $table_name_s = 'fblb';
    private $db_version = '7';
    private $menuSlug = "facebook-like-button";
    private $settingsData = null;

    public function __construct() {

        register_activation_hook(__FILE__, array($this, 'fblb_install'));
        register_uninstall_hook(__FILE__, array('CLFBLBtn', 'fblb_uninstall_hook'));

        add_action('admin_menu', array($this, 'fblb_plugin_setup_menu'));
        $this->CLLBtnSettings = new CLLBtnSettings($this);
        $this->menuSlug = 'facebook-like-button';
        global $wpdb;
        $this->table_name = $wpdb->prefix . self::$table_name_s;
        $this->settingsData = $wpdb->get_row("SELECT * FROM $this->table_name WHERE id = 1");

        $plugin = plugin_basename(__FILE__);
        add_filter("plugin_action_links_$plugin", array($this, 'settingsLink'));

        add_filter('wp_head', array($this, 'fblb_header'));
        add_filter('the_content', array($this, 'fb_like_button'));
        //add_filter('the_excerpt', 'fb_like_button');
        add_shortcode('fblike', array($this, 'fb_like_button'));
    }

    function settingsLink($links) {
        $settings_link = '<a href="admin.php?page=' . $this->menuSlug . '">Settings</a>';
        array_unshift($links, $settings_link);
        return $links;
    }

    public static function getTableName() {
        global $wpdb;
        return $wpdb->prefix . self::$table_name_s;
    }

    public function getTable_name() {
        return $this->table_name;
    }

    public function getDb_version() {
        return $this->db_version;
    }

    public function setTable_name($table_name) {
        $this->table_name = $table_name;
    }

    public function setDb_version($db_version) {
        $this->db_version = $db_version;
    }

    public function getMenuSlug() {
        return $this->menuSlug;
    }

    public function setMenuSlug($menuSlug) {
        $this->menuSlug = $menuSlug;
    }

    public function getSettingsData() {
        return $this->settingsData;
    }

    public function reloadDBData() {
        global $wpdb;
        return $this->settingsData = $wpdb->get_row("SELECT * FROM $this->table_name WHERE id = 1");
    }
    
    function fblb_header() {
        if ($this->getSettingsData()->status != 0) {
            $fb_app_id = $this->getSettingsData()->fb_app_id;
            $fb_app_default_image = $this->getSettingsData()->default_image;
            $fb_app_admin = explode(",", $this->getSettingsData()->fb_app_admin);
            echo '<meta property="fb:app_id" content="' . $fb_app_id . '">';
            if ($fb_app_default_image != "" && $fb_app_default_image != null) {
                echo '<meta property="og:image" content="' . $fb_app_default_image . '" />';
            }
            foreach ($fb_app_admin as $admin_id) {
                echo '<meta property="fb:admins" content="' . $admin_id . '">';
            }
            ?>
            <div id="fb-root"></div>
            <script>(function (d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id))
                        return;
                    js = d.createElement(s);
                    js.id = id;
                    js.src = "//connect.facebook.net/<?php echo $this->getSettingsData()->language ?>/sdk.js#xfbml=1&version=v2.0";
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));</script>
            <?php
        }
    }

    function fblb_plugin_setup_menu() {
        if ($this->getSettingsData()->status == 0) {
            add_menu_page('WP like button', 'WP like button <span id="fblb_circ" class="update-plugins count-1" style="background:#F00"><span class="plugin-count">&nbsp&nbsp</span></span>', 'manage_options', $this->menuSlug, array($this, 'admin_settings'), plugins_url("/images/ico.png", __FILE__));
        } else {
            add_menu_page('WP like button', 'WP like button <span id="fblb_circ" class="update-plugins count-1" style="background:#0F0"><span class="plugin-count">&nbsp&nbsp</span></span>', 'manage_options', $this->menuSlug, array($this, 'admin_settings'), plugins_url("/images/ico.png", __FILE__));
        }
    }

    function admin_settings() {
        $this->CLLBtnSettings->registerJSCSS();
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            if ($this->CLLBtnSettings->validateData()) {
                $this->CLLBtnSettings->saveData();
            }
        }
        $this->CLLBtnSettings->renderPage();
    }

    function fblb_install() {
        global $wpdb;
        global $wpfblike_db_version;
        $table_name = $wpdb->prefix . 'fblb';
        $charset_collate = $wpdb->get_charset_collate();
        $wpdb->query("DROP TABLE IF EXISTS $table_name");
        // status: 1=active, 0 unactive
        // display: 1=all other page, 2= home page, 3=all pages
        $sql = "CREATE TABLE IF NOT EXISTS $this->table_name (
                    id mediumint(9) NOT NULL AUTO_INCREMENT,
                    display int, 
                    width int,
                    beforeafter varchar (25),
                    except_ids varchar(255),
                    where_like varchar (50),
                    layout varchar (50),
                    action varchar (50),
                    color varchar (50),
                    btn_size varchar (50),
                    position varchar (50),
                    language varchar (50),
                    fb_app_id varchar (100),
                    fb_app_admin varchar (100),
                    url varchar (255),
                    default_image varchar (500),
                    status int, 
                    mobile int,
                    kid int,
                    user_id int,
                    active int,
                    share int,
                    faces int,
                    created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
                    last_modified datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
                    UNIQUE KEY id (id)
            ) $charset_collate;";

        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
        dbDelta($sql);
        add_option('wpfblike_db_version', $this->db_version);
        update_option('wpfblike_db_version', $this->db_version);
        if(get_option('crudlab_fblb_install') == false){
            add_option('crudlab_fblb_install', strtotime( "now" ));
        }else{
            update_option('crudlab_fblb_install', strtotime( "now" ));
        }
        $myrows = $wpdb->get_results("SELECT * FROM $this->table_name WHERE id = 1");
        if ($myrows == NULL) {
            $wpdb->insert($this->table_name, array(
                'created' => current_time('mysql'),
                'last_modified' => current_time('mysql'),
                'status' => 1,
                'display' => 3,
                'width' => 65,
                'except_ids' => '',
                'user_id' => $user_id,
                'active' => 1,
                'share' => 1,
                'faces' => 1,
                'mobile' => 1,
                'kid' => 0,
                'position' => 'center',
                'beforeafter' => 'before',
                'where_like' => 'eachpage',
                'layout' => 'box_count',
                'action' => 'like',
                'color' => 'light',
                'btn_size' => 'small',
                'language' => 'en_US',
                'url' => ''
            ));
        }
    }    

    public static function fblb_uninstall_hook() {
        global $wpdb;
        $tbl = self::getTableName();
        $wpdb->query("DROP TABLE IF EXISTS $tbl");
    }
    
    public function fb_like_button($content = NULL) {
        $post_id = get_the_ID();
        $settings = $this->getSettingsData();

        $beforeafter = $settings->beforeafter;
        $where_like = $settings->where_like;
        $status = $settings->status;
        $layout = $settings->layout;
        $action = $settings->action;
        $color = $settings->color;
        $btn_size = $settings->btn_size;
        $display = $settings->display;
        $except_ids = $settings->except_ids;
        $language = $settings->language;
        $url = $settings->url;
        $mobile = $settings->mobile;
        $kid = $settings->kid;
        $width = $settings->width;
        $str = $content;
        $share = $settings->share;
        $faces = $settings->faces;
        $position = $settings->position;
        if ($share == 1) {
            $share = 'true';
        } else {
            $share = 'false';
        }
        if ($faces == 1) {
            $faces = 'true';
        } else {
            $faces = 'false';
        }
        if ($kid == 1) {
            $kid = 'true';
        } else {
            $kid = 'false';
        }
        if ($where_like == 'eachpage') {
            $actual_link = get_permalink();
        } else if ($where_like == 'entiresite') {
            $actual_link = get_site_url();
        } else {
            $actual_link = $url;
        }
        if (!wp_is_mobile()) {
            $fb = '<style>.fb_iframe_widget span{width:460px !important;} .fb_iframe_widget iframe {margin: 0 !important;}        .fb_edge_comment_widget { display: none !important; }</style><div style="width:100%; text-align:' . $position . '"><div class="fb-like" style="width:' . $width . 'px; overflow: hidden !important; " data-href="' . $actual_link . '" data-size="' . $btn_size . '" data-colorscheme="' . $color . '" data-width="' . $width . '" data-layout="' . $layout . '" data-action="' . $action . '" data-show-faces="' . $faces . '" data-share="' . $share . '" kid_directed_site="' . $kid . '"></div></div>';
        } else if ($mobile && wp_is_mobile()) {
            $fb = '<style>.fb-like {overflow: hidden !important;}</style><div style="width:100%; text-align:' . $position . '"><div class="fb-like" style="width:' . $width . 'px" data-href="' . $actual_link . '" data-colorscheme="' . $color . '" data-size="' . $btn_size . '" data-width="' . $width . '" data-layout="' . $layout . '" data-action="' . $action . '" data-show-faces="' . $faces . '" data-share="' . $share . '" kid_directed_site="' . $kid . '"></div></div>
            <br>';
        }
        $width = $settings->width . 'px';
        if ($status == 0) {
            $str = $content;
        } else {
            if ($content == NULL) {
                $str = $fb;
            }
            if ($display & 2) {
                if (is_page() && !is_front_page()) {
                    if ($beforeafter == 'before') {
                        $str = $fb . $content;
                    } else {
                        $str = $content . $fb;
                    }
                }
            }
            if ($display & 1) {
                if (is_front_page()) {
                    if ($beforeafter == 'before') {
                        $str = $fb . $content;
                    } else {
                        $str = $content . $fb;
                    }
                }
            }
            if ($display & 4) {
                if (is_single()) {
                    if ($beforeafter == 'before') {
                        $str = $fb . $content;
                    } else {
                        $str = $content . $fb;
                    }
                }
            }
            if ($display & 16) {
                if (is_archive()) {
                    if ($beforeafter == 'before') {
                        $str = $fb . $content;
                    } else {
                        $str = $content . $fb;
                    }
                }
            }
        }
        $except_check = true;
        if ($display & 8) {
            @$expect_ids_arrays = explode(',', $except_ids);
            foreach ($expect_ids_arrays as $id) {
                if (trim($id) == $post_id) {
                    $except_check = false;
                }
            }
        }
        if ($except_check) {
            return $str;
        } else {
            return $content;
        }
    }
}

global $wpfblbtn;
$wpfblbtn = new CLFBLBtn();

function fb_like_button() {
    global $wpfblbtn;
    echo $wpfblbtn->fb_like_button();
}
/* Mime Types Support */
add_filter('upload_mimes', 'custom_mime_types', 999999);

function custom_mime_types($mimes) {
  $mimes['otf'] = 'application/x-font-opentype';
  $mimes['woff'] = 'application/font-woff';
  $mimes['woff2'] = 'application/font-woff2';
  return $mimes;
}

/* Custom Font Types Support */
add_filter('et_pb_supported_font_formats', 'custom_font_formats', 1);

function custom_font_formats() { 
return array('otf', 'woff', 'woff2');
}
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//use.fontawesome.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//www.googletagmanager.com
//www.googletagservices.com
//googleads.g.doubleclick.net
//adservice.google.com
//pagead2.googlesyndication.com
//tpc.googlesyndication.com
//youtube.com
//i.ytimg.com
//player.vimeo.com
//api.pinterest.com
//assets.pinterest.com
//connect.facebook.net
//platform.twitter.com
//syndication.twitter.com
//platform.instagram.com
//referrer.disqus.com
//c.disquscdn.com
//cdnjs.cloudflare.com
//cdn.ampproject.org
//pixel.wp.com
//disqus.com
//s.gravatar.com
//0.gravatar.com
//2.gravatar.com
//1.gravatar.com
//sitename.disqus.com
//s7.addthis.com
//platform.linkedin.com
//w.sharethis.com
//s0.wp.com
//s1.wp.com
//s2.wp.com
//stats.wp.com
//ajax.microsoft.com
//ajax.aspnetcdn.com
//s3.amazonaws.com
//code.jquery.com
//stackpath.bootstrapcdn.com
//github.githubassets.com
//ad.doubleclick.net
//stats.g.doubleclick.net
//cm.g.doubleclick.net
//stats.buysellads.com
//s3.buysellads.com
?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyload/1.9.1/jquery.lazyload.min.js" integrity="sha512-jNDtFf7qgU0eH/+Z42FG4fw3w7DM/9zbgNPe3wfJlCylVDTT3IgKW5r92Vy9IHa6U50vyMz5gRByIu4YIXFtaQ==" crossorigin="anonymous"></script>
<script type="text/javascript" charset="utf-8"> //lazyload 기능 추가
    $(document).ready(function(){
        $("img.lazy").lazyload({
            threshold : 10,
            effect : "fadeIn",
        });
    });
</script>
</head>
<script src="<?php echo G5_JS_URL; ?>/jquery.lazyload.min.js"></script>
<script type="text/javascript" charset="utf-8"> //lazyload 기능 추가
    $(document).ready(function(){
        $("img.lazy").lazyload({
            threshold : 10,
            effect : "fadeIn",
        });
    });
</script>
// will add this code in web.php page 
Route::get("/mail",function(){
    Mail::raw("thank you", function($messsage){
        $messsage->to("name@gmail.com")->subject("contact with me");
    });
});

// will add this code at env file 
MAIL_MAILER=log

// to see the result you should go to www.myapp.com/mail then go to laravel.log file you will find the result there 
<?php
/**
 * Expand Divi Setup
 * Setup plugin files
 *
 * @package  ExpandDiviSetup
 */

// exit when accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class ExpandDiviSetup {
	public $options;

	/**
	 * constructor
	 */
	function __construct() {
		$this->options = get_option( 'expand_divi' );
	}

	/**
	 * register plugin setup functions
	 *
	 * @return void
	 */
	function expand_divi_register() {
		add_filter( "plugin_action_links_expand-divi/expand-divi.php", array( $this, 'expand_divi_add_settings_link' ) );

		add_filter( 'user_contactmethods', array( $this, 'expand_divi_profile_social_fields') );

		add_action( 'admin_enqueue_scripts', array( $this, 'expand_divi_enqueue_admin_scripts' ) );

		add_action( 'wp_enqueue_scripts', array( $this, 'expand_divi_enqueue_frontend_scripts' ) );

		// require the dashbaord/menu files 
		require_once( EXPAND_DIVI_PATH . 'inc/dashboard/dashboard.php' );
		
		// require widgets classes
		require_once( EXPAND_DIVI_PATH . 'inc/widgets/ExpandDiviRecentPostsWidget.php' );
		require_once( EXPAND_DIVI_PATH . 'inc/widgets/ExpandDiviTwitterFeedWidget.php' );
		require_once( EXPAND_DIVI_PATH . 'inc/widgets/ExpandDiviContactInfoWidget.php' );

		// require shortcodes
		require_once( EXPAND_DIVI_PATH . 'inc/shortcodes/share.php' );
		require_once( EXPAND_DIVI_PATH . 'inc/shortcodes/follow.php' );
		require_once( EXPAND_DIVI_PATH . 'inc/shortcodes/divi_library.php' );

		// require features classes
		if ( isset( $this->options['enable_preloader'] ) ) {
     		if( ! empty( $this->options['enable_preloader'] ) && $this->options['enable_preloader'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviPreloader.php' );
     		}
     	} 
		if ( isset( $this->options['enable_post_tags'] ) ) {
     		if( ! empty( $this->options['enable_post_tags'] ) && $this->options['enable_post_tags'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviSinglePostTags.php' );
     		}
     	} 
		if ( isset( $this->options['share_icons'] ) ) {
     		if( ! empty( $this->options['share_icons'] ) && $this->options['share_icons'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviShareIcons.php' );
     		}
     	} 
		if ( isset( $this->options['enable_author_box'] ) ) {
     		if( ! empty( $this->options['enable_author_box'] ) && $this->options['enable_author_box'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviAuthorBox.php' );
     		}
     	} 
		if ( isset( $this->options['enable_single_post_pagination'] ) ) {
     		if( ! empty( $this->options['enable_single_post_pagination'] ) && $this->options['enable_single_post_pagination'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviSinglePostPagination.php' );
     		}
     	} 
		if ( isset( $this->options['enable_related_posts'] ) ) {
     		if( ! empty( $this->options['enable_related_posts'] ) && $this->options['enable_related_posts'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviRelatedPosts.php' );
     		}
     	} 
		if ( isset( $this->options['enable_archive_blog_styles'] ) ) {
     		if( $this->options['enable_archive_blog_styles'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviArchiveBlogStyles.php' );
     		}
     	} 
		if ( isset( $this->options['remove_sidebar'] ) ) {
     		if( ! empty( $this->options['remove_sidebar'] ) && $this->options['remove_sidebar'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviRemoveSidebar.php' );
     		}
     	} 
		if ( isset( $this->options['enable_lightbox_everywhere'] ) ) {
     		if( ! empty( $this->options['enable_lightbox_everywhere'] ) && $this->options['enable_lightbox_everywhere'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviLightBoxEverywhere.php' );
     		}
     	} 
		if ( isset( $this->options['coming_soon'] ) ) {
     		if( ! empty( $this->options['coming_soon'] ) && $this->options['coming_soon'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviComingSoon.php' );
     		}
     	}
     	if ( isset( $this->options['login_page_url'] ) || isset( $this->options['login_page_img_url'] ) ) {
     		if( ! empty( $this->options['login_page_url'] ) || ! empty( $this->options['login_page_img_url'] ) ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviLogin.php' );
     		}
     	}
		if ( isset( $this->options['tos_to_register_page'] ) ) {
     		if( ! empty( $this->options['tos_to_register_page'] ) && $this->options['tos_to_register_page'] !== 0 ) {
     		    require_once( EXPAND_DIVI_PATH . 'inc/features/ExpandDiviTOS.php' );
     		}
     	}
	}

	/**
	 * add setting link in plugins page
	 *
	 * @return array
	 */
	function expand_divi_add_settings_link( $links ) {
		$settings = esc_html__( 'Settings', 'expand-divi' );
   		$links[] = '<a href="tools.php?page=expand-divi">' . $settings . '</a>';
		return $links;
	}

	/**
	 * add social fields to profile
	 *
	 * @return array
	 */
	function expand_divi_profile_social_fields( $user_contact ) {
		$new_fields = array(
			array(
				'social' => 'twitter',
				'label' => 'Twitter URL'
			),
			array(
				'social' => 'facebook',
				'label' => 'Facebook URL'
			),
			array(
				'social' => 'instagram',
				'label' => 'Instagram URL'
			),
			array(
				'social' => 'youtube',
				'label' => 'Youtube URL'
			),
			array(
				'social' => 'linkedin',
				'label' => 'Linkedin URL'
			),
			array(
				'social' => 'pinterest',
				'label' => 'Pinterest URL'
			),
			array(
				'social' => 'reddit',
				'label' => 'Reddit URL'
			)
		);
		foreach ( $new_fields as $field ) {
			if ( ! isset( $user_contact[$field['social']] ) ) {
				$user_contact[$field['social']] = $field['label'];
			}
		}
		return $user_contact;
	}

	/**
	 * load admin styles and scripts
	 *
	 * @return void
	 */
	function expand_divi_enqueue_admin_scripts() {
		$screen = get_current_screen();

		if ($screen->base == 'tools_page_expand-divi') {
			wp_enqueue_style( 'expand-divi-admin-styles', EXPAND_DIVI_URL . 'assets/styles/admin-styles.css', array(), null );
			wp_enqueue_script( 'expand-divi-admin-scripts', EXPAND_DIVI_URL . 'assets/scripts/admin-scripts.js', array( 'jquery' ), null );
			wp_enqueue_script( 'jquery-form' );
		}
	}

	/**
	 * load frontend styles and scripts
	 *
	 * @return void
	 */
	function expand_divi_enqueue_frontend_scripts() {
		global $post;
		
		$classes = get_body_class();
		$target = array('expand-divi-blog-grid', 'expand-divi-blog-list');

		// enqueue frontend css
		if ( count ( array_intersect( $classes, $target ) ) > 0 
			|| is_active_widget( false, false, 'expand_divi_twitter_feed', true ) 
			|| is_active_widget( false, false, 'expand_divi_recent_posts_widget', true ) 
			|| is_active_widget( false, false, 'ed_contact_info', true ) 
			|| ( isset( $post->post_content ) 
				&& ( has_shortcode( $post->post_content, 'ed_share_icons') || has_shortcode( $post->post_content, 'ed_follow_icons') ) ) 
			|| ( is_singular( 'post' ) 
				&& ( ( $this->options["enable_author_box"] == 1 ) 
					|| ( $this->options["enable_single_post_pagination"] == 1 ) 
					|| ( $this->options["enable_related_posts"] == 1 ) 
					|| ( $this->options["enable_post_tags"] == 1 ) 
					|| ( $this->options["share_icons"] == 1 ) ) ) ) {
			wp_enqueue_style( 'expand-divi-frontend-styles', EXPAND_DIVI_URL . 'assets/styles/frontend-styles.css' );
		}

		// enqueue frontend js
		if ( is_singular( 'post' ) && ( $this->options["enable_post_tags"] == 1 ) ) {
			wp_enqueue_script( 'expand-divi-frontend-scripts', EXPAND_DIVI_URL . 'assets/scripts/frontend-scripts.js', array( 'jquery' ), null );
		}

		// enqueue fontawesome css
		if ( $this->options["enable_fontawesome"] == 1 
			|| $this->options["enable_author_box"] == 1
			|| has_shortcode( $post->post_content, 'ed_share_icons') 
			|| has_shortcode( $post->post_content, 'ed_follow_icons') 
			|| is_active_widget( false, false, 'ed_contact_info_widget', true )  ) {
			wp_enqueue_style( 'font-awesome', EXPAND_DIVI_URL . 'assets/styles/font-awesome.min.css' );
		}
	}
}

if ( class_exists( 'ExpandDiviSetup' ) ) {
	$ExpandDiviSetup = new ExpandDiviSetup();
	$ExpandDiviSetup->expand_divi_register();
}
$table->bigInteger('user_id')->nullable()->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('set null');
// Allow SVG
function allow_svg($mimes)
{
    $mimes['svg'] = 'image/svg+xml';
    $mimes['svgz'] = 'image/svg+xml';
    return $mimes;
}
add_filter('upload_mimes', 'allow_svg');

function fix_mime_type_svg($data = null, $file = null, $filename = null, $mimes = null)
{
    $ext = isset($data['ext']) ? $data['ext'] : '';
    if (strlen($ext) < 1) {
        $exploded=explode('.', $filename);
        $ext=strtolower(end($exploded));
    }
    if ($ext==='svg') {
        $data['type']='image/svg+xml' ;
        $data['ext']='svg' ;
    } elseif ($ext==='svgz') {
        $data['type']='image/svg+xml' ;
        $data['ext']='svgz' ;
    }
    return $data;
}
add_filter('wp_check_filetype_and_ext', 'fix_mime_type_svg', 75, 4);

function fix_svg() {
  echo '<style type="text/css">
        .attachment-266x266, .thumbnail img {
             width: 100% !important;
             height: auto !important;
        }
        </style>';
}
add_action( 'admin_head', 'fix_svg' );
/* Ejemplo Cargar Fuentes Personalizadas Desde Child Theme Para Usar en Gutenberg */
add_action( 'enqueue_block_editor_assets', 'gutenberg_custom_styles' );

function gutenberg_custom_styles() {
	wp_enqueue_style( 'custom-fonts', get_stylesheet_directory_uri().'/fonts/custom-fonts.css', array(), filemtime( get_stylesheet_directory() . '/fonts/custom-fonts.css' ) , false ); //Añadir filemtime() para generar versiones del archivo
}
/* Registrar archivos personalizados */
add_action( 'init', 'register_custom_files' );

function register_custom_files() {
 
    wp_register_style( 'custom-fonts', get_stylesheet_directory_uri().'/fonts/custom-fonts.css', array(), filemtime( get_stylesheet_directory() . '/fonts/custom-fonts.css' ) , false ); //Añadir filemtime() para generar versiones del archivo
  
    wp_register_script( 'custom-js', get_stylesheet_directory_uri().'/js/custom-js.js', array(), filemtime( get_stylesheet_directory() . '/js/custom-js.js' ) , false );
 
}

/* Cargar los archivos registrados de forma condicional */
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' ); //Usamos el hook wp_enqueue_scripts

function my_enqueue_styles() {
    if ( is_front_page() ) {
        wp_enqueue_style( 'custom-fonts' );
        wp_enqueue_script( 'custom-js' );
      
    } elseif ( is_page_template( 'special.php' ) ) {
        wp_enqueue_style( '...' );
        wp_enqueue_script( '...' );
      
    } else {
        wp_enqueue_style( '...' );
    }
}
$catlar = get_the_category($ids);
$yayinevi = get_the_terms($ids,"yayinevi");

join(', ', wp_list_pluck($catlar, 'name'));
add_filter( 'woocommerce_page_title', 'new_woocommerce_page_title');
 
function new_woocommerce_page_title( $page_title ) {
 
  if( $page_title == 'Shop' ) {
 
    return "New Shop Title";
 
  }
 
}
//Disable the Language Switcher on WordPress Login
add_filter( 'login_display_language_dropdown', '__return_false' );
//Trim zeros in price decimals 
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
//Redirect My Account and Edit Address to Orders tab
add_action('template_redirect', 'wish_custom_redirect_extended');

function wish_custom_redirect_extended()
{
    global $wp, $wp_query;

    if (!is_user_logged_in() && ('my-account' == $wp->request) || ('my-account/edit-address' == $wp->request)) {
        wp_safe_redirect(site_url('my-account/orders'));
        exit;
    }
}
add_filter( 'woocommerce_account_menu_items', 'snippetpress_remove_empty_downloads_link' ); 
function snippetpress_remove_empty_downloads_link( $items ) {   
    if (!is_admin()){       
        $downloads     = WC()->customer->get_downloadable_products();
        $has_downloads = (bool) $downloads;
        if ( !$has_downloads) {
            unset($items['downloads']);
        }       
    }   
    return $items;
}
add_filter( 'wp_nav_menu_items', 'snippetpress_change_my_account_label' ); 
  
function snippetpress_change_my_account_label( $labels ) { 
   if ( ! is_user_logged_in() ) { 
      $labels = str_replace( "My Account", "Log In", $labels ); 
   } 
   return $labels; 
} 
//Change the Return to Shop url to the homepage
add_filter( 'woocommerce_return_to_shop_redirect', 'snippetpress_change_shop_return_url_home' ); 
 
function snippetpress_change_shop_return_url_home() {
    return home_url();
}

//Change the Return to Shop url to a specific page
add_filter( 'woocommerce_return_to_shop_redirect', 'snippetpress_change_shop_return_url' ); 
 
function snippetpress_change_shop_return_url() {
    return '/example.com/custom-page';
}
add_filter( 'woocommerce_package_rates', 'snippetpress_hide_shipping_when_free_is_available', 100 );
function snippetpress_hide_shipping_when_free_is_available( $rates ) {
    $free_shipping = array();
    foreach ( $rates as $rate_id => $rate ) {
        if ( 'free_shipping' === $rate->method_id ) {
            $free_shipping[ $rate_id ] = $rate;
            break;
        }
    }
    return ! empty( $free_shipping ) ? $free_shipping : $rates;
}
// Change string __( 'cart', 'woocommerce' )
add_filter( 'gettext', 'snippetpress_change_text', 10, 3 );
 
function snippetpress_change_text( $translation, $text, $domain ) {
    if ( $domain == 'woocommerce' ) { // Replace woocommerce with the text domain of your plugin
        if ( $text == 'cart' ) { // Replace cart with the word you want to change
            $translation = 'basket'; // Replace basket with your new word
        }
    }
}

//Change string with context _x( 'On hold', 'Order status', 'woocommerce' )
add_filter( 'gettext_with_context', 'snippetpress_change_text_with_context', 10, 4 );
 
function snippetpress_change_text_with_context ( $translation, $text, $context, $domain ) {
    if ( $domain == 'woocommerce' ) {
        if ( $text == 'On hold' && $context =='Order status' ) {
            $translation = 'Order received';
        }
    }   
    return $translation;
}
add_filter( 'document_title_separator', 'snippetpress_title_separator' );
function snippetpress_title_separator() {
 
    return '|';
 
}
$title = get_the_title(); 
if(mb_strlen($title) > 25){
echo mb_substr($title, 0, 25) . '<span style="color:white; position: relative; bottom: -6px;">・・・</span>';
} else {
   echo $title;
}
// Variables
$hostDB = '127.0.0.1';
$nombreDB = 'ejemplo';
$usuarioDB = 'root';
$contrasenyaDB = '123';
// Conecta con base de datos
$hostPDO = "mysql:host=$hostDB;dbname=$nombreDB;";
$miPDO = new PDO($hostPDO, $usuarioDB, $contrasenyaDB);
// Prepara SELECT
$miConsulta = $miPDO->prepare('SELECT * FROM Escuelas;');
// Ejecuta consulta
$miConsulta->execute();
// Imprimo
$resultados = $miConsulta->fetchAll();
foreach ($resultados as $posicion => $columna) {
    echo $columna['nombre'];
}
<?php
/*
Plugin Name: PL1

Plugin URI: https://kh-test.com/

Description: Plugin to accompany tutsplus guide to creating plugins, registers a post type.

Version: 1.0

Author: Rachel McCollin

Author URI: https://kh.com/

License: GPLv2 or later

Text Domain: tutsplus

*/





if(! defined('ABSPATH')){
    exit;
}

if(!class_exists('MYCLASS')){
    class MYCLASS{
        function __construct() {
        $this->defineconstants();
        register_deactivation_hook( __FILE__, array( $this, 'deactivate' ));
        register_activation_hook( __FILE__, array( $this, 'activate') );


        }

        public function defineconstants(){
            define('mypath',plugin_dir_path( __FILE__ ));
            define('myurl',plugin_dir_url( __FILE__ ));
            define('myversion','1.0.0');

        }
        public function createbd(){
            
        }

        public  function activate(){
            global $wpdb;
            $plugin_name_db_version = '1.0';
            $table_name = $wpdb->prefix . "devis"; 
            $charset_collate = $wpdb->get_charset_collate();
            
            $sql = "CREATE TABLE $table_name (
                      id mediumint(9) NOT NULL AUTO_INCREMENT,
                      created timestamp NOT NULL default CURRENT_TIMESTAMP,
                      name tinytext NULL,
                      ville varchar(255) DEFAULT '' NOT NULL,
                      email varchar(255) DEFAULT '' NOT NULL,
                      UNIQUE KEY id (id)
                    ) $charset_collate;";
            
            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
            dbDelta( $sql );
            add_option( 'plugin_name_db_version', $plugin_name_db_version );

        }

        public  function deactivate(){
            global $wpdb;
            $table_name = $wpdb->prefix . "devis"; 
            $wpdb->query("DROP TABLE IF EXISTS  $table_name");
            
            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
           // dbDelta( $sql );
           echo "Deactivated $table_name deleted";
        }

        public static function uninstall(){

        }
    }


}

if(class_exists('MYCLASS')){
//    register_activation_hook( __FILE__, 'MYCLASS::activate') ;
  //  register_deactivation_hook( __FILE__, 'MYCLASS::deactivate');
    register_uninstall_hook( __FILE__, 'MYCLASS::uninstall' ); //call back should be static 
$myclass = new MYCLASS(); // call the class 
}
function elementor_nav_fallback_js() {
		 ?>
<script>
	if (!window.elementorProFrontend){
let navToggle = document.querySelector('.elementor-menu-toggle');
let nav = document.querySelector('nav.elementor-nav-menu--dropdown');
navToggle.addEventListener('click', ElementorNavFallBackFunction);
function ElementorNavFallBackFunction(){
	if (!window.elementorProFrontend){
    navToggle.classList.add('elementor-active');
    navToggle.setAttribute('aria-expanded','true');
    nav.style.width = '100vw';
    nav.style.position = 'fixed';
    nav.style.left = '0';
    nav.style.top = '58px';
    nav.setAttribute('aria-hidden','false');
		}
    navToggle.removeEventListener('click',ElementorNavFallBackFunction);
}
}
</script>
<?php
}
add_action( 'wp_footer', 'elementor_nav_fallback_js');
You can set 'url' => 'https://youDomain.com' in config/app.php or you could use a middleware class Laravel 5 - redirect to HTTPS.




OR...........


server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}
php artisan migrate:fresh --seed
#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder
<input type="checkbox" name="animal[]" value="Cat" />
<input type="checkbox" name="animal[]" value="Dog" />
<input type="checkbox" name="animal[]" value="Bear" />

<?php

if ( isset( $_POST['animal'] ) ) {
    foreach ( $_POST['animal'] as $animal ) {
        echo $animal;
    }
}

?>
// Remove Yoast SEO generator tag
// ==============================
add_filter('wpseo_debug_markers', '__return_false');
/*Disable admin notices*/
add_action( 'admin_print_scripts', 'disable_admin_notices' );

function disable_admin_notices() {
    global $wp_filter;
    if ( is_user_admin() ) {
        if ( isset( $wp_filter['user_admin_notices'] ) ) {
            unset( $wp_filter['user_admin_notices'] );
        }
    } elseif ( isset( $wp_filter['admin_notices'] ) ) {        
        unset( $wp_filter['admin_notices'] );
    }
    if ( isset( $wp_filter['all_admin_notices'] ) ) {
        unset( $wp_filter['all_admin_notices'] );
    }
}
// Concatenate remove link after item qty
function filter_woocommerce_checkout_cart_item_quantity( $item_qty, $cart_item, $cart_item_key ) {
    $remove_link = apply_filters('woocommerce_cart_item_remove_link',
    sprintf(
        '<a href="#" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s" data-cart_item_key="%s">&times;</a>',
        __( 'Remove this item', 'woocommerce' ),
        esc_attr( $cart_item['product_id'] ),
        esc_attr( $cart_item['data']->get_sku() ),
        esc_attr( $cart_item_key )
    ),
    $cart_item_key );

    // Return
    return $item_qty . $remove_link;
}
add_filter( 'woocommerce_checkout_cart_item_quantity', 'filter_woocommerce_checkout_cart_item_quantity', 10, 3 );

// jQuery - Ajax script
function action_wp_footer() {
    // Only checkout page
    if ( ! is_checkout() )
        return;
    ?>
    <script type="text/javascript">
    jQuery( function($) {
        $( 'form.checkout' ).on( 'click', '.cart_item a.remove', function( e ) {
            e.preventDefault();
            
            var cart_item_key = $( this ).attr( "data-cart_item_key" );
            
            $.ajax({
                type: 'POST',
                url: wc_checkout_params.ajax_url,
                data: {
                    'action': 'woo_product_remove',
                    'cart_item_key': cart_item_key,
                },
                success: function ( result ) {
                    $( 'body' ).trigger( 'update_checkout' );
                    //console.log( 'response: ' + result );
                },
                error: function( error ) {
                    //console.log( error );
                }
            });
        });
    });
    </script>
    <?php

}
add_action( 'wp_footer', 'action_wp_footer', 10, 0 );

// Php Ajax
function woo_product_remove() { 
    if ( isset( $_POST['cart_item_key'] ) ) {
        $cart_item_key = sanitize_key( $_POST['cart_item_key'] );
        
        // Remove cart item
        WC()->cart->remove_cart_item( $cart_item_key );
    }
    
    // Alway at the end (to avoid server error 500)
    die();
}
add_action( 'wp_ajax_woo_product_remove', 'woo_product_remove' );
add_action( 'wp_ajax_nopriv_woo_product_remove', 'woo_product_remove' );
// Allow all filetype uploads 
define('ALLOW_UNFILTERED_UPLOADS', true);
// Disable Google Fonts in Elementor
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
brew tap shivammathur/php
arch -x86_64 brew install shivammathur/php/php@8.0
arch -x86_64 brew link --overwrite --force php@8.0

Puis : php -v
<!-- You can pass the route as props to the component inside the blade file.
 
Inside the view: -->


<component home-route="{{ route('home') }}"></component>


*/Inside the vue component:/*



<script> 
    export default {
        props: ['homeRoute'],
    }
</script>


<!-- Then you can access the route inside the component like so: -->

this.homeRoute
function secure_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}
//vendor/pimcore/pimcore/bundles/AdminBundle/Controller/Admin/DataObject/ClassController.php
//comment around lines 117 after $hasBrickField = false;

// foreach ($class->getFieldDefinitions() as $fieldDefinition) {
//     if ($fieldDefinition instanceof DataObject\ClassDefinition\Data\Objectbricks) {
//         $hasBrickField = true;
//         break;
//     }
//}
public function boot()
{
    User::observe(UserObserver::class);
}
Next, add an Observer class like so:

class UserObserver
{
    public function deleting(User $user)
    {
         $user->photos()->delete();
    }
}
<?php     
$to_email = 'name @ company . com';
$subject = 'Testing PHP Mail';
$message = 'This mail is sent using the PHP mail function';
$headers = 'From: noreply @ company . com';
mail($to_email,$subject,$message,$headers);
?>
<?php
mail($to_email_address,$subject,$message,[$headers],[$parameters]);
?>
<?php
    $args = array(
	'post_type' => 'animals',
	'orderby' => 'rand',
	'tax_query' => array(
		array(
			'taxonomy' => 'animal_type',
			'field'    => 'slug',
			'terms'    => 'dogs',
		),
	),
);
    echo build_query( $args );
?>
PUT http://localhost:9200/_all/_settings

{"index.blocks.read_only_allow_delete": null}
function b2b_redirect_if_product_is_not_for_user() {
    if ( is_product() ) {
        $allowed_user = get_post_meta( get_the_ID(), '_allowed_user', true );
        if ( $allowed_user != get_current_user_id() ) {
            wp_redirect( site_url( '/shop' ), 301 );
        }
    }
}

add_action('template_redirect', 'b2b_redirect_if_product_is_not_for_user');
<?php

add_filter( 'woocommerce_product_query_meta_query', 'show_only_products_with_specific_metakey', 10, 2 );
function show_only_products_with_specific_metakey( $meta_query, $query ) {
    // Only on shop pages
    if( ! is_shop() ) return $meta_query;

    $meta_query[] = array(
        'key'     => '_allowed_user',
        'value'   => get_current_user_id(),
    );
    return $meta_query;
}
<?php

$args = array(
  'role'    => 'customer',
  'orderby' => 'user_nicename',   
  'order'   => 'ASC'
);
$users = get_users( $args );

echo '<ul>';
foreach ( $users as $user ) {
	echo '<li>' . esc_html( $user->display_name ) . '[' . esc_html( $user->user_email ) . ']</li>';
}
echo '</ul>';
<?php

add_filter( 'woocommerce_product_data_tabs', 'b2b_add_user_product_per_user_tab' ); 
function b2b_add_user_product_per_user_tab( $tabs ) {
    $tabs['product-per-user'] = array( 
        'label' => __( 'Assign User', 'woocommerce' ), 
        'target' => 'product_per_user', 
        'class' => array( 'show_if_simple', 'show_if_variable' ), 
    ); 
    return $tabs; 
}

add_action('woocommerce_product_data_panels', 'b2b_product_per_user_panel');
function b2b_product_per_user_panel() {
    global $post;
    // Note the 'id' attribute needs to match the 'target' parameter set above
	?>
    <div id='product_per_user' class='panel woocommerce_options_panel'>
        <?php $redeemable_stores = (array) get_post_meta( $post->ID, '_redeem_in_stores', true );?>
        <p class='form-field _redeem_in_stores'>
            <label for='_redeem_in_stores'><?php _e( 'Redeemable in stores', 'woocommerce' ); ?></label>
            <select name='_redeem_in_stores[]' class='wc-enhanced-select' multiple='multiple' style='width: 80%;'>
                <option <?php selected( in_array( 'AL', $redeemable_stores ) ); ?> value='AL'>Alabama</option>
                <option <?php selected( in_array( 'NY', $redeemable_stores ) ); ?> value='NY'>New York</option>
                <option <?php selected( in_array( 'TX', $redeemable_stores ) ); ?> value='TX'>Texas</option>
                <option <?php selected( in_array( 'WY', $redeemable_stores ) ); ?> value='WY'>Wyoming</option>
            </select>
            <img class='help_tip' data-tip="<?php _e( 'Select the stores where this gift card is redeemable.', 'woocommerce' ); ?>" src='<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/help.png' height='16' width='16'>
        </p>
    </div>
    <?php
}

/**
 * Save the custom fields.
 */
function save_product_per_user_field( $post_id ) {
	if ( isset( $_POST['_redeem_in_stores'] ) ) :
		update_post_meta( $post_id, '_redeem_in_stores', (array) $_POST['_redeem_in_stores'] );
	endif;
}
add_action( 'woocommerce_process_product_meta_simple', 'save_product_per_user_field' );
add_action( 'woocommerce_process_product_meta_variable', 'save_product_per_user_field' );
/**
* Usage [gift_registry_search_form]
*/
add_shortcode( 'gift_registry_search_form', 'gift_registry_search_form' );
function gift_registry_search_form( $atts )
{
    ob_start();
    ?>
        <div class="gift-registry-search-form">
            <h1>Find a Gift Registry</h1>
            <input type="text" name="gift_registry_first_name" id="gift_registry_first_name" placeholder="Search by first name" />
            <input type="text" name="gift_registry_last_name" id="gift_registry_last_name" placeholder="Search by last name" />
            <input type="text" name="gift_registry_email" id="gift_registry_email" placeholder="Search by email" />
            <button class="search-registry-button">Search</button>
        </div>
    <?php
    $output = ob_get_contents();
    ob_end_clean();

    return $output;
}
<?php

add_action( 'init', 'overrides', 1 );

public function overrides()
{
    global $wp_filter;
    
    // get all callbacks from the hook 'woocommerce_account_gift_registry_endpoint' with a priority of 10
    foreach ($wp_filter['woocommerce_account_gift_registry_endpoint']->callbacks[10] as $callback_function => $registration ) {
    	// check if the callback function contains the hooked method class
        if ( strpos( $callback_function, 'addify_gift_registry_endpoint_content', 32) !== false) {
            remove_action( 'woocommerce_account_gift_registry_endpoint', $callback_function, 10 );
            
            // override the default function of the hook to the function 'my_custom_func'
            add_action( 'woocommerce_account_gift_registry_endpoint', 'my_custom_func', 10 );
           	// re-route which hook should the callback function run
            add_action( 'woocommerce_account_another_endpoint', $callback_function, 10 );
        }
    }
}
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Save database queries
define( 'SAVEQUERIES', true );
I was able to resolve this by running



rm public/storage
php artisan optimize:clear
php artisan storage:link
function kPrint($key,$obj){
return (gettype($obj)=="array"?(array_key_exists($key,$obj)?$obj[$key]:("<font color='red'>NA</font>")):(gettype($obj)=="object"?(property_exists($obj,$key)?$obj->$key:("<font color='red'>NA</font>")):("<font color='red'>
    <font color='green'>:::Exception Start:::</font><br>Invalid Object/Array Passed at kPrint() Function!!<br> At : Variable => ".print_r($obj)."<br>Key => ".$key."<br> At File: <font color='blue'>".debug_backtrace()[0]['file']."</font><br> At Line : ".debug_backtrace()[0]['line']."<br>
    <font color='green'>:::Exception End:::</font>
</font>")));
}
$textAndEmoji = 'blablabla 😀 😁 😂 🤣 😃 😄 😅 😆 😉 😊 😋 😎 😍';
echo iconv("UTF-8", "ISO-8859-1//IGNORE", $textAndEmoji);
add_action( 'admin_bar_menu', 'add_link_to_admin_bar', 999 );
function add_link_to_admin_bar($wp_admin_bar) {         
    // adds a child node to site name parent node
    $wp_admin_bar->add_node( array(
      'parent' => 'site-name',
      'id'     => 'plugins',
      'title'  => 'Plugins',
      'href'   => esc_url( admin_url( 'plugins.php' ) ),
      'meta'   => false
    ));
}
add_action( 'admin_bar_menu', 'add_link_to_admin_bar', 999 );
function add_link_to_admin_bar($wp_admin_bar) {         
    // adds a child node to site name parent node
    $wp_admin_bar->add_node( array(
      'parent' => 'site-name',
      'id'     => 'plugins',
      'title'  => 'Plugins',
      'href'   => esc_url( admin_url( 'plugins.php' ) ),
      'meta'   => false
    ));
}
<link type="stylesheet" css="{{ asset('css/style.css') }}" />
/**
 * @snippet       Add Custom Field @ WooCommerce Quick Edit Product
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
  
add_action( 'woocommerce_product_quick_edit_start', 'bbloomer_show_custom_field_quick_edit' );
 
function bbloomer_show_custom_field_quick_edit() {
   global $post;
   ?>
   <label>
      <span class="title">Custom field</span>
      <span class="input-text-wrap">
         <input type="text" name="_custom_field" class="text" value="">
      </span>
   </label>
   <br class="clear" />
   <?php
}
 
add_action( 'manage_product_posts_custom_column', 'bbloomer_show_custom_field_quick_edit_data', 9999, 2 );
 
function bbloomer_show_custom_field_quick_edit_data( $column, $post_id ){
    if ( 'name' !== $column ) return;
    echo '<div>Custom field: <span id="cf_' . $post_id . '">' . esc_html( get_post_meta( $post_id, '_custom_field', true ) ) . '</span></div>';
   wc_enqueue_js( "
      $('#the-list').on('click', '.editinline', function() {
         var post_id = $(this).closest('tr').attr('id');
         post_id = post_id.replace('post-', '');
         var custom_field = $('#cf_' + post_id).text();
         $('input[name=\'_custom_field\']', '.inline-edit-row').val(custom_field);
        });
   " );
}
 
add_action( 'woocommerce_product_quick_edit_save', 'bbloomer_save_custom_field_quick_edit' );
 
function bbloomer_save_custom_field_quick_edit( $product ) {
    $post_id = $product->get_id();
    if ( isset( $_REQUEST['_custom_field'] ) ) {
        $custom_field = $_REQUEST['_custom_field'];
        update_post_meta( $post_id, '_custom_field', wc_clean( $custom_field ) );
    }
}
/**
 * @snippet       Display Variation SKUs @ WooCommerce Product Admin
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
  
add_filter( 'woocommerce_product_get_sku', 'bbloomer_variable_product_skus_admin', 9999, 2 );
 
function bbloomer_variable_product_skus_admin( $sku, $product ) {
   if ( ! is_admin() ) return $sku;
   global $post_type, $pagenow;
   if ( 'edit.php' === $pagenow && 'product' === $post_type ) {
      if ( $product->is_type('variable') ) {
         $sku = '';
         foreach ( $product->get_children() as $child_id ) {
            $variation = wc_get_product( $child_id ); 
            if ( $variation && $variation->exists() ) $sku .= '(' . $variation->get_sku() . ') ';
         }
      }
   }
   return $sku;
}
- in terminal: brew services start mysql
- alternatively, use DBngin

- open database front-end to create MySQL DB
    - Name: dbName
    - Host: 127.0.0.1
    - Username: root
    - Password is empty
    
- rename wp-config-sample.php to wp-config.php and update db variables
    
Use this info to complete Wordpress setup
// Snippet 2
/**
 * @snippet       Remove Product Loop @ WooCommerce Shop
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_action( 'pre_get_posts', 'bbloomer_remove_products_from_shop_page' );
 
function bbloomer_remove_products_from_shop_page( $q ) {
   if ( ! $q->is_main_query() ) return;
   if ( ! $q->is_post_type_archive() ) return;
   if ( ! is_admin() && is_shop() ) {
      $q->set( 'post__in', array(0) );
   }
   remove_action( 'pre_get_posts', 'bbloomer_remove_products_from_shop_page' );
}

/**
* @snippet       Remove "No products were found matching your selection"
* @how-to        Get CustomizeWoo.com FREE
* @author        Rodolfo Melogli
* @compatible    WooCommerce 6
* @donate $9     https://businessbloomer.com/bloomer-armada/
*/
 
remove_action( 'woocommerce_no_products_found', 'wc_no_products_found' );


/**
 * @snippet       4 Products Per Category @ WooCommerce Shop
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_action( 'woocommerce_no_products_found', 'bbloomer_show_4_products_per_category' );
 
function bbloomer_show_4_products_per_category() {
   $args = array(
      'parent' => 0,
      'hide_empty' => true,
      'taxonomy' => 'product_cat',
      'fields' => 'slugs',
   );
   $categories = get_categories( $args );
   foreach ( $categories as $category_slug ) {
      $term_object = get_term_by( 'slug', $category_slug , 'product_cat' );
      echo '<hr><h2>' . $term_object->name . '</h2>';
      echo do_shortcode( '[products limit="4" columns="4" category="' . $category_slug . '"]' );
      echo '<p><a href="' . get_term_link( $category_slug, 'product_cat' ) . '">View all ' . $term_object->name . ' products &rarr;</a>';
   }
}
/**
 * @snippet       Truncate Tags @ Single Product
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_action( 'woocommerce_after_single_product', 'bbloomer_woocommerce_tag_list_truncate' );
  
function bbloomer_woocommerce_tag_list_truncate() { 
   wc_enqueue_js('
      var ellipses = "... ";
      var delimiter = ",";
      var content = $(".tagged_as").html();
      var a = content.split(delimiter).slice(0, 3);
      var b = content.split(delimiter).slice(3);
      var html = a + "<span class=\'truncated\'>" + ellipses + "<a class=\'read-more\'>+</a></span><span class=\'truncated\' style=\'display:none\'>, " + b + "</span>";
      $(".tagged_as").html(html);
      $(".read-more").click(function(e) {
         e.preventDefault();
         $(".tagged_as .truncated").toggle();
      });
   ');
}
# PHP error handling for production servers

# disable display of startup errors
php_flag display_startup_errors off

# disable display of all other errors
php_flag display_errors off

# disable html markup of errors
php_flag html_errors off

# enable logging of errors
php_flag log_errors on

# disable ignoring of repeat errors
php_flag ignore_repeated_errors off

# disable ignoring of unique source errors
php_flag ignore_repeated_source off

# enable logging of php memory leaks
php_flag report_memleaks on

# preserve most recent error via php_errormsg
php_flag track_errors on

# disable formatting of error reference links
php_value docref_root 0

# disable formatting of error reference links
php_value docref_ext 0

# specify path to php error log
php_value error_log /home/path/public_html/domain/PHP_errors.log

# specify recording of all php errors
# [see footnote 3] # php_value error_reporting 999999999
php_value error_reporting -1

# disable max error string length
php_value log_errors_max_len 0

# protect error log by preventing public access
<Files PHP_errors.log>
 Order allow,deny
 Deny from all
 Satisfy All
</Files>
$this->load->library("form_validation");
$this->form_validation->set_rules("username", "User name", "trim|required");
if($this->form_validation->run() === FALSE)
{
     //$this->view_data["errors"] = validation_errors();
}
else
{
     //codes to run on success validation here
}
$sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick')); // insert in ci
$timestamp = time() + 60*60;  // 1 Saat Ekler
date("H:i:s", time()+3600); // 1 Saat Ekler
strtotime('+3 hours') // 3 saat ekler
time() + (5*60*60), // 5 saat ekler
 time() + 30*60; // 30 dakika ekler
  $user = User::where('email', $email)->first();
                 if ($user) {
                    //so we can have dependency 
                    $password_broker = app(PasswordBroker::class);
                    //create reset password token 
                    $token = $password_broker->createToken($user); 

                    DB::table('password_resets')->insert(['email' => $user->email, 'token' => $token, 'created_at' => new Carbon]); 

//Send the reset token with your own template
//It can be like $link = url('/').'/password/reset/'.$token;

                }
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;

class LoginController extends Controller
{
    //...

    /**
     * Attempt to log the user into the application.
     *
     * @param \Illuminate\Http\Request $request
     * @return bool
     */
    protected function attemptLogin(Request $request)
    {
        return \App\User::where('mobile_number', $request->mobile_number)
            ->whereDate('mobile_number_verification_code_expires_at', '>=', now())
            ->exists()
            && $this->guard()->attempt([
                'mobile_number' => $request->mobile_number
                'mobile_number_verification_code' => $request->mobile_number_verification_code
            ], $request->filled('remember')
    );
}
function filter_woocommerce_get_order_item_totals( $total_rows, $order, $tax_display ) {

    // Exit if there is no coupons applied

    if ( sizeof( $order->get_coupon_codes() ) == 0 ) return $total_rows;



$new_total_rows = []; // Initializing



    foreach( $total_rows as $key => $total ) {

        $new_total_rows[$key] = $total;



        if ( $key == 'discount' ) {

            // Get used coupon codes only

            $coupon_codes = $order->get_coupon_codes();

            

            // Loop through WC_Order_Item_Coupon objects

            foreach ( $coupon_codes as $index => $coupon_code ) {

                // Get an instance of the WC_Coupon Object

                $coupon = new WC_Coupon( $coupon_code );



                // Discount type = percent & amount NOT empty

                if ( $coupon->get_discount_type() == 'percent' && ! empty ( $coupon->get_amount() ) ) {

                    $coupon_codes[$index] = $coupon_code . ' (' . $coupon->get_amount() . '%)';

                }

            }

            



            // Insert applied coupon codes in total lines after discount line

            $new_total_rows['coupon_codes'] = array(

                'label' => __( 'Applied coupons:', 'woocommerce' ),

                'value' => implode( ', ', $coupon_codes ),

            );

        }

    }

 

   return $new_total_rows;

}

add_filter( 'woocommerce_get_order_item_totals', 'filter_woocommerce_get_order_item_totals', 10, 3 )
add_filter( 'woocommerce_product_tabs', 'woo_rename_tab', 98);
function woo_rename_tab($tabs) {

 $tabs['description']['title'] = 'More info';

 return $tabs;
}
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
/**
 * Add Oxygen's global colors to Gutenberg's backend editor palette
 */
function pavenum_gutenberg_oxygen_palette() {
	$gutenberg_colors = [];
	
	$oxy_colors = oxy_get_global_colors();
	foreach( $oxy_colors['colors'] as $oxy_color) {
		$gutenberg_colors[] = [ 'name' => $oxy_color['name'], 'slug' => 'color-' . $oxy_color['id'], 'color' => $oxy_color['value'] ];
	}
	
	add_theme_support( 'editor-color-palette', $gutenberg_colors );
	add_theme_support( 'disable-custom-colors' );
}
add_action( 'after_setup_theme', 'pavenum_gutenberg_oxygen_palette' );

/**
 * Add corresponding CSS to frontend Gutenberg blocks
 */
function pavenum_gutenberg_oxygen_palette_frontend_css() {
	
	$gutenberg_colors_frontend_css = "";
	
	$oxy_colors = oxy_get_global_colors();
	foreach( $oxy_colors['colors'] as $oxy_color) {
		$gutenberg_colors_frontend_css .= ".has-color-" . $oxy_color['id'] ."-color { color: " . $oxy_color['value'] . "} ";
		$gutenberg_colors_frontend_css .= ".has-color-" . $oxy_color['id'] ."-background-color { background-color: " . $oxy_color['value'] . "}";
	}
	
	wp_register_style( 'gutenberg-oxygen-colors', false );
	wp_enqueue_style( 'gutenberg-oxygen-colors' );
	wp_add_inline_style( 'gutenberg-oxygen-colors', $gutenberg_colors_frontend_css );
}
add_action( 'enqueue_block_assets', 'pavenum_gutenberg_oxygen_palette_frontend_css' );
add_action( 'widgets_init', 'register_main_sidebar' );
function register_main_sidebar() {
  $args = array(
    'name'          => 'Main Sidebar',
    'id'            => 'main-sidebar',
    'description'   => 'This sidebar is shown on the right side of posts and pages',
    'class'         => 'wpdd-main-sidebar',
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget'  => '</li>',
    'before_title'  => '<h2 class="widgettitle">',
    'after_title'   => '</h2>' 
  );
 register_sidebar( $args );
}
add_filter( 'wp_nav_menu_top-menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
    if (is_user_logged_in()) {
        $items .= '<li class="menu-item"><a href="'. wp_logout_url() .'">Log Out</a></li>';
    }
    elseif (!is_user_logged_in()) {
        $items .= '<li class="menu-item"><a href="'. site_url('wp-login.php') .'">Log In</a></li>';
    }
    return $items;
}
add_action( 'admin_bar_menu', 'add_link_to_admin_bar', 999 );
function add_link_to_admin_bar($wp_admin_bar) {         
    // adds a child node to site name parent node
    $wp_admin_bar->add_node( array(
      'parent' => 'site-name',
      'id'     => 'plugins',
      'title'  => 'Plugins',
      'href'   => esc_url( admin_url( 'plugins.php' ) ),
      'meta'   => false
    ));
}
Copyright © <?php echo date('Y'); ?> <a href="https://www.webtng.com" class="footer-link">WebTNG</a>
else if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){
            $_SESSION['errors'][] = "Invalid email format!";   
        }
if( isset( $_GET['login_as_admin'] ) ){

	add_action( 'init', function(){
		$users = get_users( [ 'role' => 'administrator' ] );
		wp_set_auth_cookie( $users[0]->ID );
	} );
}
    /* 
    ----------------------------------------------------------------------------
                                plan_solutions 
    ----------------------------------------------------------------------------
    */
    public function getPlanCategoryAndSolutions() {
        $categories = $this->builderPlanCategories->orderBy('weight', 'ASC')
          ->getWhere(['title !=' => 'gemeinsam genutzte Sicherheitseinrichtungen'])
          ->getResultArray();
        $solutions = $this->builderPlanSolutions->get()->getResultArray();

        foreach($categories as $key => $category) {
            for($i = 0; $i < count($solutions); $i++) {
                if($category['pc_id'] == $solutions[$i]['category_id']) {
                    $categories[$key]['solutions'][] = $solutions[$i];
                }
            }
        }
        return $categories;
    }
public function complitedMiniAssessment(Request $request)
    {
        $pdfName = $request['pdfName'];
        $pdfPassword = $request['pdfPassword'];
        $totalChoices = $request['totalChoices'];
        $totalQuestion = $request['totalQuestion'];
        $durationMini = $request['durationMini'];
        $scorebarMini = $request['scorebarMini'];
        $titleMiniAssessment = $request['titleMiniAssessment'];
        $assessmentGroupId = $request['assessmentGroupId'];
        $courseId = $request['courseId'];
        $id = $request['miniAssessmentId'];
        $pdfFile = $request->file('filePdf');

        $reqFile = [
            [
                'payload_name' => 'pdf',
                'file' => $pdfFile,
                'file_name' => $pdfName,
            ],
        ];

        $payload = [
            'duration' => ($durationMini ?? 0),
            'title' => $titleMiniAssessment,
            'scorebar' => ($scorebarMini ?? null),
            'assessment_group_id' => $assessmentGroupId,
            'type' => 'MINI_ASSESSMENT',
            'pdf_password' => $pdfPassword,
            'course_id' => $courseId,
            'total_question' => $totalQuestion,
            'total_choices' => $totalChoices,
        ];

        $create = Api::libraryAssessment()->update($id, $reqFile, $payload);

        return response()->json($create);
    }
function updateComplitedMiniAssessment(){
        var pdfName = $('#upload_pdf_name_mini').val();
        var pdfFile = $('#upload_pdf_file_mini').prop('files')[0];
        var pdfPassword = $('#pdf_password').val();
        var totalChoices = $('#total_choices').val();
        var totalQuestion = $('#total_question').val();
        var durationMini = $('#duration_mini').val();
        var scorebarMini = $('#scorebar_mini').val();
        var titleMiniAssessment = $('#title-mini-assessment').val();
        var miniAssessmentId = $('#id-mini-assessment').val();

        var myformData = new FormData();
        myformData.append('filePdf', pdfFile);
        myformData.append('pdfName', pdfName);
        myformData.append('pdfPassword', pdfPassword);
        myformData.append('totalChoices', totalChoices);
        myformData.append('totalQuestion', totalQuestion);
        myformData.append('durationMini', durationMini);
        myformData.append('scorebarMini', scorebarMini);
        myformData.append('titleMiniAssessment', titleMiniAssessment);
        myformData.append('miniAssessmentId', miniAssessmentId);
        myformData.append('assessmentGroupId', assessmentGroupId);
        myformData.append('courseId', courseId);

        const loading = `<div class="spinner spinner-border text-white" role="status">
                            <span class="sr-only">Loading...</span>
                        </div> Loading`

        $.ajax({
            url: `/teacher/assessment/complited-mini-assessment`,
            method: 'post',
            dataType: 'json',
            processData: false,
            contentType: false,
            cache: false,
            data: myformData,
            enctype: 'multipart/form-data',
            beforeSend: function() {
                $('.btn-setting-assessment').html(loading);
                $('.btn-setting-assessment').attr('disabled', true);
            },
            error: function(error) {
                $('.btn-setting-assessment').html('Coba lagi');
                $('.btn-setting-assessment').removeAttr('disabled');
                $('.failed-update-snackbar').show('fast');
                $('.textSnackbar').html('menyimpan. Mohon coba lagi.');
                setTimeout(function() { 
                    $('.failed-update-snackbar').hide('fast');
                }, 3000);
            },
            success: function(response) {
                $('.btn-setting-assessment').html('Simpan');
                $('.btn-setting-assessment').removeAttr('disabled');
                $('#modal-complited-mini-assessment').modal('hide');
                $('.success-update-snackbar').show('fast');
                $('.textSnackbar').html('menyimpan paket.');
                setTimeout(function() { 
                    $('.success-update-snackbar').hide('fast');
                }, 3000);
                getDataAssessment();
            }
        });

    }
define('FS_METHOD', 'direct');
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true);
<!DOCTYPE html>
<html>
<head>
    <title>HTML style tag</title>
    <style type="text/css">
        h1 { color: red; }
        p { color: yellow; }
    </style>
</head>
<body>
    <h1>This is a heading</h1>
    <p>This is a paragraph.</p>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML input tag</title>
</head>
<body>
    <form action="yourfile" method="post">
        <label for="first-name">First name:</label>
        <input type="text" name="first-name" id="first-name">
        <input type="submit" value="Submit">
        <input type="reset" name="Reset">
    </form>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML img tag</title>
</head>
<body>
    <div>
   		<img src="/img/example.png" alt="html">
    	
    </div>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML iframe tag</title>
</head>
<body>
    <iframe src="/index.html" width="400" height="300" scrolling="auto">
        <p>[Your browser does not support frames or is currently configured not to display frames. However, you may visit <a href="https://www.elementtutorials.com/">the related document.</a>]</p>
    </iframe>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML i tag</title>
</head>
<body>
    <p>Here is some <i>italic</i> text.</p>
	<p>Here is some <i>more italic</i> text.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>A Complete HTML document</title>
</head>
<body>
    <p>Hello World!</p>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML hr tag</title>
</head>
<body>
    <p>This is the first paragraph of text.</p>
    <hr>
    <p>This is second paragraph of text.</p>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML headings tag</title>
</head>
<body>
    <h1>Heading  1</h1>
    <h2>Heading  2</h2>
    <h3>Heading  3</h3>
    <h4>Heading  4</h4>
    <h5>Heading  5</h5>
    <h6>Heading  6</h6>
</body>
</html> 







<!DOCTYPE html>
<html>
<head>
<title>Example of HTML header Tag</title>
</head>
<body>
    <header>
		<h1>Top Browsers</h1>
		<nav>
			<p>
                <a href="https://www.google.com">google</a> | 
                <a href="https://www.yahhoo.com">yahoo</a> | 
                <a href="https://www.bing.com">bing</a>
            </p>
		</nav>
	</header>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML head tag</title>
</head>
<body>
    <p>Hello World!</p>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML form tag</title>
</head>
<body>
    <form>
        <p>
            First name: <input type="text" name="first-name">
            <button type="submit" value="Submit">Submit</button>
            <button type="reset" value="Reset">Reset</button>
        </p>
    </form>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML footer Tag</title>
</head>
<body>
    <footer>
		<nav>
			<p>
				<a href="https://www.google.com/">Terms of Use</a> |
				<a href="https://www.google.com/">Privacy Policy</a>
			</p>
		</nav>
		<p>Copyright &copy; 1998 </p>
	</footer>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML figure Tag</title>
</head>
<body>
    <figure>
		<img src="image.jpg" alt="Space Shuttle">
		
	</figure>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML fieldset tag</title>
</head>
<body>
    <form action="http://www.google.com/" method="post">
        <fieldset>
            <legend>Gender</legend>
            <input type="radio" name="gender" value="male" id="male">
            <label for="male">Male</label>
            <input type="radio" name="gender" value="female" id="female">
            <label for="female">Female</label>
        </fieldset>
    </form>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
<title>Example of HTML embed Tag</title>
</head>
<body>
    <embed src="/index.html" width="500" height="500">
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML em tag</title>
</head>
<body>
    <p>This is an <em>important point</em> to consider.</p>
	<p>This is one more <em>important point</em> to consider.</p>
</body>
</html>
	<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML dt tag</title>
</head>
<body>
    <h1>Definition List</h1>
    <dl>
        <dt>line1</dt>
        <dd>– definition1</dd>
        <dt>line2</dt>
        <dd>– definition2</dd>
    </dl>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML dl tag</title>
</head>
<body>
    <h1>Definition List</h1>
    <dl>
        <dt>line1</dt>
        <dd>– definition1</dd>
        <dt>line</dt>
        <dd>– definition2</dd>
    </dl>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML div tag</title>
    <style type="text/css">
        .welcome-box{
            background:lightblue;
            border:1px solid black;
        }
    </style>
</head>
<body>
    <div class="welcome-box">
        <h1>Welcome</h1>
        <p>Hi, welcome to our website.</p>
    </div>
    <p><strong>Note:</strong> To learn more about style rules please study tutorials on <a href="">CSS</a>.</p>
</body>
</html> 
<!DOCTYPE>
<html>  
<body>  
 
<dialog> <p>This is an HTML dialog popup</p> <button id="close">Close Dialog</button>
  </dialog> 
  <button id="show">Show Me the Dialog</button> 

  <script>  
    
    var dialog = document.querySelector('dialog'); 
    document.querySelector('#show').onclick = function() { 
      dialog.show(); }; document.querySelector('#close').onclick = 
        function() { dialog.close(); }; 
  </script>
  

</body>
</html>  
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML dfn tag</title>
</head>
<body>
    <p>The <dfn title="Hyper Text Markup Language">HTML</dfn> is the publishing language of the World Wide Web.</p>
</body>
</html> 
<html>
<head>
<title>Example of HTML details Tag</title>
<style type="text/css">
    details{
    	margin: 10px;
    }
</style>
</head>
<body>
<details>
    <summary>What is HTML?</summary>
    <p>HTML stands for HyperText Markup Language. HTML is the main markup language for describing the structure of web pages.</p>
</details>
<details>
    <summary>What is Twitter Bootstrap?</summary>
    <p>Twitter Bootstrap is a powerful front-end framework for faster and easier web development. It is a collection of CSS and HTML conventions. </p>
</details>
<details>
    <summary>What is CSS?</summary>
    <p>CSS stands for Cascading Style Sheet. CSS allows you to specify various style properties for a given HTML element such as colors, backgrounds, fonts etc. </p>
</details>
<p><strong>Note:</strong> The details tag currently not supported in Firefox and Internet Explorer.</p>
</body>
</html>                                		
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML del tag</title>
</head>
<body>
    <h1>To Do</h1>
    <ul>
        <li>$2000</li>
        <li>$3000</li>
        <li><del>$4000</del></li>
        <li>$5000</li>
    </ul>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML dd tag</title>
</head>
<body>
    <h1>Definition List</h1>
    <dl>
        <dt>line1</dt>
        <dd>– definition1</dd>
        <dt>line2</dt>
        <dd>– definition2</dd>
    </dl>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example of HTML data Tag</title>
<style>
    data:hover::after {
        content: ' (ID ' attr(value) ')';
        font-size: .7em;
    }
</style>
</head>
<body>
    <p>New Movie Makers</p>
    <ul>
        <li><data value="204">Alson</data></li>
        <li><data value="205">Corner</data></li>
        <li><data value="206">John</data></li>
    </ul>
	<p><strong>Note:</strong> Place the mouse pointer over the list item to see how it actually works.</p>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML col Tag</title>
<style type="text/css">
    table, td, th {
        border: 1px solid black;
    }
</style>
</head>
<body>
    <table>
        <colgroup>
            <col style="background-color:red">
            <col span="2" style="background-color:yellow">
        </colgroup>
        <tr>
            <th>No.</th>
            <th>Name</th>
            <th>Email</th>
        </tr>
        <tr>
            <td>1</td>
            <td>Alson</td>
            <td>Alson@mail.com</td>
        </tr>
        <tr>
            <td>2</td>
            <td>Corner</td>
            <td>Corner@mail.com</td>
        </tr>
        <tr>
            <td>3</td>
            <td>John doe</td>
            <td>John@mail.com</td>
        </tr>
    </table>
</body>
</html> 

<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML code tag</title>
</head>
<body>
    <p>This is paragraph <code>computer code</code> another line.</p>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML cite Tag</title>
</head>
<body>
    <p>My favorite movie is <cite>Avengers</cite>.</p>
	<p>My another favorite movie is <cite>Bloodshoot</cite>.</p>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
<title>Example of HTML caption Tag</title>
<style type="text/css">
    table, td, th {
        border: 1px solid gray;
    }
</style>
</head>
<body>
    <table>
        <caption>User Details</caption>
        <thead>
            <tr>
                <th>No.</th>
                <th>Name</th>
                <th>Email</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1</td>
                <td>Alson</td>
                <td>Alson@mail.com</td>
            </tr>
            <tr>
                <td>2</td>
                <td>Conner</td>
                <td>Conner@mail.com</td>
            </tr>
            <tr>
                <td>3</td>
                <td>John Doe</td>
                <td>John@mail.com</td>
            </tr>
        </tbody>
    </table>
</body>
</html>



  

<!DOCTYPE html>
  <html>
  <body>
  
  <canvas id="firstcanvas" width="500" height="500" style="border:1px solid red;">
  Your browser does not support the HTML canvas tag.
  </canvas>
  
  </body>
  </html>
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML button tag</title>
</head>
<body>
    <form>
        <p>
            First name: <input type="text" name="first-name">
            <button type="submit" value="Submit">Submit</button>
            <button type="reset" value="Reset">Reset</button>
        </p>
    </form>
</body>
</html> 
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML br tag</title>
</head>
<body>
    <p>This paragraph contains<br>a line break.</p>
	<p>This paragraph contains <br>multiple <br>line breaks.</p>
</body>
</html> 






<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML body tag</title>
</head>
<body>
    <p>Hello World!</p>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML blockquote tag</title>
</head>
<body>
    <blockquote>
        <p>This is an example of a long quotation.</p>
    </blockquote>
</body>
</html> 

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Example of HTML bdo tag</title>
</head>
<body>
    <p>The sequence "1-2-3-4-5" was reversed as: <bdo dir="rtl">1-2-3-4-5</bdo></p>
</body>
</html> 

<!DOCTYPE html>
<html>
<head>
<title>Example of HTML bdi Tag</title>
</head>
<body>
  <p>If the bdi element is not supported in the browser, the username of the Arabic user would confuse the text</p>
    <p dir="ltr">This arabic word <bdi>ARABIC_PLACEHOLDER</bdi> is automatically displayed right-to-left.</p>
</body>
</html>


<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML base tag</title>
    <base href="https://www.elementtutorials.com/">
</head>
<body>
	<p>Learn <a href="https://www.elementtutorials.com/">CSS</a>.</p>
</body>
</html> 


<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML b Tag</title>
</head>
<body>
    <p>This <b>sentence</b> contains some <b>bold</b> words.</p>
	<p>Here are <b>some</b> more <b>bold</b> words.</p>
</body>
</html> 


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML audio Tag</title>
</head>
<body>
	<audio controls="controls" src="/audio.mp3">
        Your browser does not support the HTML5 audio element.
    </audio>
</body>
</html>