Snippets Collections
<?php
function remove_title_tag_on_blog_posts($title_parts)
{
    global $template;
    $templateName =  basename($template);
    if ($templateName === 'single-post.php') {
        $title_tag_blog_post = get_field('title_tag_blog_post');
        if ($title_tag_blog_post) {
            $title_parts['title'] = $title_tag_blog_post;
        }
    }
    return $title_parts;
}

add_filter('document_title_parts', 'remove_title_tag_on_blog_posts', 10);
// Enfold Increase Excerpt Length
add_filter('avf_postgrid_excerpt_length','avia_change_postgrid_excerpt_length', 10, 1);
function avia_change_postgrid_excerpt_length($length)
{
   $length = 120;
   return $length;
}
<?php
// Konfigurasi koneksi ke database
$servername = "localhost"; // Ganti dengan nama server Anda
$username = "adminmaster"; // Ganti dengan username database Anda
$password = "DTCMtolong313"; // Ganti dengan password database Anda
$dbname = "master"; // Ganti dengan nama database Anda

// Membuat koneksi
$conn = new mysqli($servername, $username, $password, $dbname);

// Memeriksa koneksi
if ($conn->connect_error) {
    die("Koneksi gagal: " . $conn->connect_error);
}

// Ambil term dari input pengguna
//$term = $_POST["term"];
$term = mysqli_real_escape_string($conn, $_POST['term']);

// Query untuk mengambil data nama lengkap dari master_data_staff dengan jantina = 0
$sql = "SELECT DISTINCT nama_lengkap FROM master_data_staff WHERE jantina = 0 AND nama_lengkap LIKE '%$term%' LIMIT 10";
$result = $conn->query($sql);

// Menyimpan hasil query dalam bentuk array
$data = array();
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $data[] = $row["nama_lengkap"];
    }
}

// Mengirimkan data dalam format JSON
echo json_encode($data);

// Menutup koneksi database
$conn->close();
?>
function product_dropdown_shortcode() {
    ob_start();

    // Query to get all products
    $products = get_posts(array(
        'post_type' => 'product',
        'posts_per_page' => -1,
    ));

    // Output the dropdown HTML
    ?>
    <select id="product_dropdown">
        <option value="">Select a product</option>
        <?php foreach ($products as $product) : ?>
            <option value="<?php echo esc_attr($product->ID); ?>"><?php echo esc_html($product->post_title); ?></option>
        <?php endforeach; ?>
    </select>
    <script>
        jQuery(function($) {
            // Initialize select2 for searchable dropdown
            $('#product_dropdown').select2();
        });
    </script>
    <?php

    return ob_get_clean();
}
add_shortcode('product_dropdown', 'product_dropdown_shortcode');
function enqueue_select2() {
    // Enqueue Select2 library
    wp_enqueue_script('select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-beta.1/js/select2.min.js', array('jquery'), '4.1.0-beta.1', true);
    wp_enqueue_style('select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-beta.1/css/select2.min.css', array(), '4.1.0-beta.1');
}
add_action('wp_enqueue_scripts', 'enqueue_select2');
<!--HTML Code-->
  
  <form id="contact_form" method="post">
    <div class="row">
        <div class="col-md-12 form-group g-mb-20">
            <input type="text" class="form-control" id="txtContactName" name="txtContactName" placeholder="Full Name" tabindex="201" required>
            <div class="error-message" id="txtContactName-error"></div>
        </div>

        <div class="col-md-12 form-group g-mb-20">
            <input type="email" class="form-control" id="txtContactEmail" name="txtContactEmail" placeholder="Email Address" tabindex="202" required>
            <div class="error-message" id="txtContactEmail-error"></div>
        </div>

        <div class="col-md-12 form-group g-mb-20">
            <input type="text" class="form-control" id="txtContactPhone" name="txtContactPhone" placeholder="Contact Number" maxlength="10" tabindex="203" required>
            <div class="error-message" id="txtContactPhone-error"></div>
        </div> 

        <div class="col-md-12 form-group g-mb-40">
            <textarea class="form-control" id="txtContactMessage" name="txtContactMessage" rows="7" placeholder="Message" maxlength="160" tabindex="204" required></textarea>
            <div class="error-message" id="txtContactMessage-error"></div>
        </div>
    </div>
    <input type="submit" class="btn btn-lg u-btn-primary g-font-weight-600 g-font-size-default rounded-0 text-uppercase g-py-15 g-px-30" id="btnContactSubmit" name="btnContactSubmit" value="SUBMIT">
</form>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.3/jquery.validate.min.js"></script>
<script>
	
</script>
<script>
    $(document).ready(function() {
        $('#contact_form').validate({
            rules: {
                txtContactName: "required",
                txtContactEmail: {
                    required: true,
                    email: true
                },
                txtContactPhone: {
                    required: true,
                    digits: true,
                    maxlength: 10
                },
                txtContactMessage: "required"
            },
            messages: {
                txtContactName: "Please enter your full name",
                txtContactEmail: {
                    required: "Please enter your email address",
                    email: "Please enter a valid email address"
                },
                txtContactPhone: {
                    required: "Please enter your contact number",
                    digits: "Please enter only digits",
                    maxlength: "Please enter a valid 10-digit phone number"
                },
                txtContactMessage: "Please enter your message"
            },
            errorPlacement: function(error, element) {
                error.appendTo(element.closest('.form-group').find('.error-message'));
            },
            submitHandler: function(form) {
                var formData = $(form).serialize();
                $.ajax({
                    type: 'POST',
                    url: 'mail.php',
                    data: formData,
                    success: function(response) {
                        $('#contact_form').append('<div class="success-message" style="color: green;">Message sent successfully!</div>');
                        setTimeout(function() {
                            $('#contact_form')[0].reset();
                        }, 4000);
                    },
                    error: function(xhr, status, error) {
                        console.error(xhr.responseText);
                        alert('Error: ' + xhr.responseText);
                    }
                });
            }
        });
    });
</script>

PHP Miler folder should be there
Create folder name with mail.php and add below code there 
<?php
// Include PHPMailer autoload file

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

// Load Composer's autoloader
require 'phpmailer/vendor/autoload.php';

// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // Retrieve form data
    $name = $_POST['txtContactName'];
    $email = $_POST['txtContactEmail'];
    $phone = $_POST['txtContactPhone'];
    $message = $_POST['txtContactMessage'];

    // Initialize PHPMailer
    $mail = new PHPMailer(true);
    try {
        // SMTP settings
		$mail->IsSMTP();        // Sets Mailer to send message using SMTP
		$mail->SMTPAuth = true; // Authentication enabled
		$mail->SMTPSecure = 'tls'; // Secure transfer enabled REQUIRED for Gmail
		$mail->Host = 'smtp-relay.brevo.com';
		$mail->Port = 587;
		$mail->Username = 'advanceindiaprojectltd@gmail.com';
		$mail->Password = 'xsmtpsib-e66045ab99d2f28608d548ca33a5a3ac8cc14a6896d682cbdc5418c80154b5eb-6B5QJOyT18GvbzmZ';
		$mail->SMTPOptions = array(
			'ssl' => array(
				'verify_peer' => false,
				'verify_peer_name' => false,
				'allow_self_signed' => true
			)
		);

        // Recipients
        $mail->setFrom($email, $name);
        $mail->addAddress('roshan@teamvariance.com'); // Add recipient email address

        // Content
        $mail->isHTML(true);
        $mail->Subject = 'Contact Form Submission';
		// Construct HTML table for the email body
        $message = '
            <h3 align="center">Details</h3>
            <table border="1" width="100%" cellpadding="5" cellspacing="5">
                <tr>
                    <td width="30%">Name</td>
                    <td width="70%">' . $name . '</td>
                </tr> 
                <tr>
                    <td width="30%">Email</td>
                    <td width="70%">' . $email . '</td>
                </tr>
                <tr>
                    <td width="30%">Phone</td>
                    <td width="70%">' . $phone . '</td>
                </tr>
                <tr>
                    <td width="30%">Message</td>
                    <td width="70%">' . $message . '</td>
                </tr>
            </table>
        ';
        $mail->Body = $message;

        // Send email
        $mail->send();
        
        // Return success message
        echo "success";
    } catch (Exception $e) {
        // Return error message
        echo "error";
    }
}
?>



// Function to create the custom product dropdown shortcode
function custom_product_dropdown_shortcode() {
  ob_start(); // Start output buffering

  // Get the referring URL and selected product name
  $referring_url = wp_get_referer();
  $selected_product_name = '';
  $selected_product_id = ''; // Initialize for product ID selection

  if ($referring_url) {
    $url_parts = parse_url($referring_url);
    if (isset($url_parts['path'])) {
      $path_parts = explode('/', $url_parts['path']);
      $product_index = array_search('product', $path_parts);
      if ($product_index !== false && isset($path_parts[$product_index + 1])) {
        $selected_product_name = $path_parts[$product_index + 1];
        $selected_product_id = $path_parts[$product_index + 1]; // Assuming product ID in URL
      }
    }
  }

  // Create the dropdown with search functionality using Select2
  echo '<select id="product_name" name="product_name">';
  echo '<option value="">Select Product</option>';
  echo '<option data-tokens="Search Products" disabled hidden></option>'; // Search placeholder

  $products = array(); // Store product data for filtering

  $query = new WP_Query(array(
    'post_type' => 'product',
    'post_status' => 'publish',
    'posts_per_page' => '-1'
  ));

  if ($query->have_posts()) :
    while ($query->have_posts()) : $query->the_post();
      $product = wc_get_product(get_the_ID());
      $price = $product->get_price_html();
      $selected = '';
      // Use product name for comparison
      if (get_the_title() === $selected_product_name) {
        $selected = 'selected="selected"';
      }

      $products[] = array(
        'id' => get_the_title(), // Store product name instead of ID
        'text' => get_the_title() 
      );
    endwhile;
  else:
    echo '<option value="">No products found</option>';
  endif;

  wp_reset_postdata();

  foreach ($products as $product) {
    echo '<option value="' . $product['id'] . '" ' . $selected . '>' . $product['text'] . '</option>';
  }

  echo '</select>';

  // Enqueue JavaScript for search functionality
  wp_enqueue_script('select2'); // Assuming you've added the Select2 library
  ?>
  <script>
    jQuery(function($) {
      $('#product_name').select2({
        data: <?php echo json_encode(array_map(function($product) {
          return array('id' => $product['id'], 'text' => $product['text']);
        }, $products)); ?>,
        placeholder: 'Search Products'
      });
    });
  </script>
  <?php

  return ob_get_clean(); // Return the output and clean buffer
}

// Add the shortcode to WordPress
add_shortcode('custom_product_dropdown', 'custom_product_dropdown_shortcode');







//below code is same as above but instead of product name is saving in back the product ID is saving :






// Function to create the custom product dropdown shortcode
function custom_product_dropdown_shortcode() {
  ob_start(); // Start output buffering

  // Get the referring URL and selected product name
  $referring_url = wp_get_referer();
  $selected_product_name = '';
  $selected_product_id = ''; // Initialize for product ID selection

  if ($referring_url) {
    $url_parts = parse_url($referring_url);
    if (isset($url_parts['path'])) {
      $path_parts = explode('/', $url_parts['path']);
      $product_index = array_search('product', $path_parts);
      if ($product_index !== false && isset($path_parts[$product_index + 1])) {
        $selected_product_name = $path_parts[$product_index + 1];
        $selected_product_id = $path_parts[$product_index + 1]; // Assuming product ID in URL
      }
    }
  }

  // Create the dropdown with search functionality using Select2
  echo '<select id="product_name" name="product_name">';
  echo '<option value="">Select Product</option>';
  echo '<option data-tokens="Search Products" disabled hidden></option>'; // Search placeholder

  $products = array(); // Store product data for filtering

  $query = new WP_Query(array(
    'post_type' => 'product',
    'post_status' => 'publish',
    'posts_per_page' => '-1'
  ));

  if ($query->have_posts()) :
    while ($query->have_posts()) : $query->the_post();
      $product = wc_get_product(get_the_ID());
      $price = $product->get_price_html();
      $selected = '';
      // Use product ID for comparison
      if (get_the_ID() === $selected_product_id) {
        $selected = 'selected="selected"';
      }

      $products[] = array(
        'id' => get_the_ID(), // Add ID for selection
        'text' => get_the_title() 
      );
    endwhile;
  else:
    echo '<option value="">No products found</option>';
  endif;

  wp_reset_postdata();

  echo '</select>';

  // Enqueue JavaScript for search functionality
  wp_enqueue_script('select2'); // Assuming you've added the Select2 library
  ?>
  <script>
    jQuery(function($) {
      $('#product_name').select2({
        data: <?php echo json_encode(array_map(function($product) {
          return array('id' => $product['id'], 'text' => $product['text']);
        }, $products)); ?>,
        placeholder: 'Search Products'
      });
    });
  </script>
  <?php

  return ob_get_clean(); // Return the output and clean buffer
}

// Add the shortcode to WordPress
add_shortcode('custom_product_dropdown', 'custom_product_dropdown_shortcode');

ChatGPT








// by below code the search bar for page using shortcode not drodown a searchbar


function product_search_shortcode() {
    ob_start(); ?>

    <div class="product-search-container">
        <input type="text" id="product-search-input" placeholder="Search for a product...">
        <div id="product-search-results"></div>
    </div>

    <script>
    jQuery(document).ready(function($) {
        $('#product-search-input').keyup(function() {
            var searchQuery = $(this).val();

            $.ajax({
                url: '<?php echo admin_url('admin-ajax.php'); ?>',
                type: 'POST',
                data: {
                    'action': 'product_search',
                    'search_query': searchQuery
                },
                success: function(response) {
                    $('#product-search-results').html(response);
                }
            });
        });

        $(document).on('click', '.product-item', function() {
            var selectedProduct = $(this).text();
            $('#product-search-input').val(selectedProduct);
            $('#product-search-results').html('');
        });
    });
    </script>

    <?php
    return ob_get_clean();
}
add_shortcode('product_search', 'product_search_shortcode');

function product_search_callback() {
    $search_query = $_POST['search_query'];

    $products = wc_get_products(array(
        'status' => 'publish',
        'limit' => -1,
        's' => $search_query,
    ));

    if ($products) {
        foreach ($products as $product) {
            echo '<div class="product-item">' . $product->get_name() . '</div>';
        }
    } else {
        echo '<div class="product-item">No products found</div>';
    }

    wp_die();
}
add_action('wp_ajax_product_search', 'product_search_callback');
add_action('wp_ajax_nopriv_product_search', 'product_search_callback');

// ================================
// Extra Footer
// ================================

add_action('ava_before_footer','extra_footer');
    function extra_footer() { ?>
       
<?php }
<input                       
    type="text" 
    placeholder="Start date" 
    class="px-2 py-1 text-sm rounded text-gray-800" 
    x-init="new Pikaday({ field: $el })"
    x-on:change="$wire.startDate = formatDateToYYYYMMDD(new Date($el.value))"
/>
    // Exemple :
    $text = "<script>console.log('salut')</script>";
    echo $text; // Execute le script !
    echo filter_var($text, FILTER_SANITIZE_FULL_SPECIAL_CHARS); // Pas interprèter

    $email = "jean(du22)@toto.fr";
    echo $email; // output : jean(du22)@toto.fr
    echo filter_var($email, FILTER_SANITIZE_EMAIL); // output : jeandu22@toto.fr

    $number = "a10.5";
    echo filter_var($number, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND);

    $arr = [
        'email' => 'jean(a)@<gmail>.com',
        'text' => '<script>const a = 1</script>',
        'number' => 'aa12aaa'
    ];
    print_r(filter_var_array($arr, [
        'email' => FILTER_SANITIZE_EMAIL,
        'text' => [
            'filter' => FILTER_SANITIZE_FULL_SPECIAL_CHARS,
            'flags' =>  FILTER_FLAG_NO_ENCODE_QUOTES
        ],
        'number' => FILTER_SANITIZE_NUMBER_INT
    ]));


    $_POST = filter_input_array(INPUT_POST, [
        'firstname' => FILTER_SANITIZE_FULL_SPECIAL_CHARS,
        'email' => FILTER_SANITIZE_EMAIL,
        'date' => FILTER_SANITIZE_FULL_SPECIAL_CHARS
    ]);
/**
 * 	Show ID in Wordpress
 * 
	Add ID in the action row of list tables for pages, posts,
	custom post types, media, taxonomies, custom taxonomies,
	users amd comments
	
	Inspiration:
	https://wordpress.org/plugins/admin-site-enhancements/
	https://www.itsupportguides.com/knowledge-base/wordpress/using-wordpress-post_row_actions-php-filter/
*/

add_filter('post_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);
add_filter('page_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);
add_filter('cat_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);
add_filter('tag_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);
add_filter('media_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);
add_filter('comment_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);
add_filter('user_row_actions', 'add_custom_action_for_specific_post_type', 11, 2);

/* Output the ID in the action row */
function add_custom_action_for_specific_post_type( $actions, $object ) {
        
	if ( current_user_can( 'edit_posts' ) ) {
		// For pages, posts, custom post types, media/attachments, users
		if ( property_exists( $object, 'ID' ) ) {
			$id = $object->ID;
		}
		// For taxonomies
		if ( property_exists( $object, 'term_id' ) ) {
			$id = $object->term_id;
		}
		// For comments
		if ( property_exists( $object, 'comment_ID' ) ) {
			$id = $object->comment_ID;
		}
		$actions['show-id-now'] = '<span style="color: gray;">ID: ' . $id . '</span>';
	}
	return $actions;
}
if ( is_single() ) {
  $current_post_id = get_queried_object_id();
  $current_category_id = get_the_category( $current_post_id )[0]->cat_ID;

  $args = array(
    'category' => $current_category_id,
    'post__not_in' => array( $current_post_id ),
    'posts_per_page' => 3,
  );

  $related_posts = new WP_Query( $args );

  if ( $related_posts->have_posts() ) {
    echo '<h2>Related Posts:</h2>';
    while ( $related_posts->have_posts() ) {
      $related_posts->the_post();
      echo '<a href="' . get_the_permalink() . '">' . get_the_title() . '</a><br>';
    }
    wp_reset_postdata();
  }
}
wp.domReady(function () {
	wp.blocks.registerBlockStyle('core/button', {
		name: 'link-btn',
		label: 'Link Btn',
	});
});
/**
 * Filters the next, previous and submit buttons.
 * Replaces the form's <input> buttons with <button> while maintaining attributes from original <input>.
 *
 * @param string $button Contains the <input> tag to be filtered.
 * @param object $form Contains all the properties of the current form.
 *
 * @return string The filtered button.
 */
add_filter('gform_submit_button', 'input_to_button', 10, 2);
function input_to_button($button, $form)
{
  $dom = new DOMDocument();
  $dom->loadHTML('<?xml encoding="utf-8" ?>' . $button);
  $input = $dom->getElementsByTagName('input')->item(0);
  $new_button = $dom->createElement('button');
  $new_button->appendChild($dom->createTextNode($input->getAttribute('value')));
  $input->removeAttribute('value');
  foreach ($input->attributes as $attribute) {
    $new_button->setAttribute($attribute->name, $attribute->value);
  }

  $classes = $new_button->getAttribute('class');
  $classes .= " btn is-style-with-arrow";
  $new_button->setAttribute('class', $classes);
  $input->parentNode->replaceChild($new_button, $input);

  return $dom->saveHtml($new_button);
}
/**
 * Attach icon class to the menu title
 *
 * @param $sorted_menu_items
 * @param $args
 * @return mixed
 */
function wti_add_arrow_to_parent_menu_item($sorted_menu_items, $args)
{
	foreach ($sorted_menu_items as $menu_item) {
		if (array_search('menu-item-has-children', $menu_item->classes) != FALSE) {
			$menu_item->title = $menu_item->title . '<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
				<path d="M19.9201 9.44995L13.4001 15.97C12.6301 16.74 11.3701 16.74 10.6001 15.97L4.08008 9.44995" stroke="#fff" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
				</svg>';
		}
	}

	return $sorted_menu_items;
}
// Dropdown arrows to parent menu items
add_filter('wp_nav_menu_objects', 'wti_add_arrow_to_parent_menu_item', 10, 2);
/* Remove WooCommerce block styles */
function ya_remove_block_css() {
    wp_dequeue_style( 'wc-block-style' ); // WooCommerce
}
add_action('wp_enqueue_scripts','ya_remove_block_css', 100);
// Avia Layout Builder in custom post types

function avf_alb_supported_post_types_mod( array $supported_post_types )
{
  $supported_post_types[] = 'case_studies';
  return $supported_post_types;
}
add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);

function avf_metabox_layout_post_types_mod( array $supported_post_types )
{
 $supported_post_types[] = 'case_studies';
 return $supported_post_types;
}
add_filter('avf_metabox_layout_post_types', 'avf_metabox_layout_post_types_mod', 10, 1);
public function index(Travel $travel, ToursListRequest $request)
    {
        $tours = $travel->tours()
            ->when($request->priceFrom, function ($query) use ($request) {
                $query->where('price', '>=', $request->priceFrom * 100);
            })
            ->when($request->priceTo, function ($query) use ($request) {
                $query->where('price', '<=', $request->priceTo * 100);
            })
            ->when($request->dateFrom, function ($query) use ($request) {
                $query->where('starting_date', '>=', $request->dateFrom);
            })
            ->when($request->dateTo, function ($query) use ($request) {
                $query->where('starting_date', '<=', $request->dateTo);
            })
            ->when($request->sortBy, function ($query) use ($request) {
                if (! in_array($request->sortBy, ['price'])
                    || (! in_array($request->sortOrder, ['asc', 'desc']))) {
                    return;
                }

                $query->orderBy($request->sortBy, $request->sortOrder);
            })
            ->orderBy('starting_date')
            ->paginate();

        return TourResource::collection($tours);
    }
//in controller datatable
->addColumn('mass_delete', function ($row) {
  $selected = '';

  return  '<input type="checkbox" class="row-select test" value="'.$row->id.'">' ;
})


//in view table
 <th>_<input type="checkbox" value="1" id="select-all-row" data-table-id="incoming-messages-table"></th>

//in view datatable (to disable orderable on first column)
'columnDefs': [ {
  'targets': [0], /* column index */
  'orderable': false, /* true or false */
}]

//in view (action button and)
<button type="submit" class="btn btn-xs btn-primary" id="delete-selected">{{__('admin.delete selected')}}</button>
<form action="{{route('admin.incoming-messages.deleteArray')}}" method="post" id="delete_form">
  @csrf
<div class="inputs">

  </div>
</form>


//in view js
<script>
  $(document).on('click', '#select-all-row', function(e) {
    var table_id = $(this).data('table-id');
    if (this.checked) {
      $('#' + table_id)
        .find('tbody')
        .find('input.row-select')
        .each(function() {
        if (!this.checked) {
          $(this)
            .prop('checked', true)
            .change();
        }
      });
    } else {
      $('#' + table_id)
        .find('tbody')
        .find('input.row-select')
        .each(function() {
        if (this.checked) {
          $(this)
            .prop('checked', false)
            .change();
        }
      });
    }
  });


$(document).on('click', '#delete-selected', function(e){
  e.preventDefault();

  $ids = '';
  $html = '';
  $("input:checkbox:checked").each(function(){
    $ids += $(this).val() + ',';
    $html += '<input type="hidden" id="message_deleted" name="message[]" value="'+$(this).val()+'">';
  })
  $('.inputs').html($html);
  $('form#delete_form').submit() 
})
</script>

Here's a guide on how to start developing poker software, outlining key steps and code structure:

1. Define the Scope of Your Project:

    Game Variants: Choose which poker variants you'll include (e.g., Texas Hold'em, Omaha, 5-Card Draw).
    Features: Decide on essential features like player accounts, gameplay, betting, tournaments, chat, and multi-platform compatibility.
    Target Platforms: Determine if you're developing for web, desktop, mobile, or a combination.

2. Choose Your Programming Language and Development Environment:

    Common Languages: Python, Java, C++, C#, and JavaScript are popular choices for game development.
    Development Environments: Select an IDE (Integrated Development Environment) like Visual Studio Code, PyCharm, or Eclipse for efficient coding.

3. Structure Your Code:

    Classes: Create classes for representing cards, decks, hands, players, game tables, and the game logic itself.
    Functions: Write functions to handle shuffling, dealing, betting, evaluating hands, and managing game flow.

4. Implement Core Functionalities:

    Card Deck: Create a class to represent a deck of cards, with methods for shuffling and dealing cards.
    Player Hand: Implement a class to hold a player's hand, with methods for evaluating hand strength.
    Game Logic: Write the core game logic, including betting rounds, hand comparisons, and pot management.

5. Design the User Interface (UI):

    Visual Design: Create visually appealing UI elements using graphics libraries or frameworks.
    User Interaction: Implement intuitive controls for players to interact with the game.

6. Test Thoroughly:

    Unit Testing: Test individual code units to ensure they function as intended.
    Integration Testing: Verify that different parts of the code work together seamlessly.
    User Testing: Gather feedback from real users to identify bugs and areas for improvement.

7. Deploy and Maintain:

    Deployment: Make your poker software available to users on your chosen platforms.
    Maintenance: Address any bugs or issues, and update the software with new features or improvements over time.
//Les tableaux 
// Opérateurs + 
$a = [1, 2];
$b = [4, 5, 6];

print_r($a + $b); //Output = 1, 2, 6 
//Prends la valeur du tableaux de droite et si pas d'index prends la valeur de gauche

// Opérateurs == ne prends pas en compte l'ordre
// Opérateurs === prends en compte l'ordre

// Spread operator :
print_r([...$a, ...$b]); // [1, 2, 4, 5, 6]
// Le tableaux n'existe plus et on étend les valeurs 

//&$variable Récupère l'adresse mémoire d'une variable

// Assigner une valeur à un tableaux :
// Ajouter une valeur à l'index suivant
$arr = [1];
$arr[] = 2; //Output = [1, 2]
// Equivalence avec le spread :
$arr = [...$arr, 3]; // Assigne un nouveau tableau et spread l'ancien en assignant une nouvelle valeur
$arr = [-1, ...$arr]; //Ajoute une valeur au début
array_push($arr, 4);


// Return a random value
$arr = ['orrange', 'blue', 'yellow'];
$value = array_rand($arr);
echo $arr[$value];

// Remove duplicates
$arr2 = ['test', 'test', 1, 2, 3];
$res = array_unique($arr2);
return [
  ...
  'providers' => [
    ...
    \Intervention\Image\ImageServiceProvider::class,
  ],
  'aliases' => Facade::defaultAliases()->merge([
        ...
        'Image' => \Intervention\Image\Facades\Image::class,
    ])->toArray(),
]
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ImageController extends Controller 
{
    public function compressImage(Request $request) 
    {
        $this->validate($request, [
            'image' => 'required|image|mimes:jpg,jpeg,png,gif,svg|max:2048'
        ]);

        $image = $request->file['image'];
        /* 
            Note: Use $image = base64_decode($request['image'])
            if the image is sent as a base64 encoded image.
        */
        $image_name = time().'_'.$image->getClientOriginalName();
        $path = public_path('uploads/') . "/" . $image_name;

        Image::make($image->getRealPath())->resize(150, 150)->save($path);
      
        return response()->json(
            [
                'data' => 'Image compressed and added'
            ], 
            201
        );
    }
}
add_filter( 'woocommerce_product_export_column_names', 'add_slug_export_column' );
add_filter( 'woocommerce_product_export_product_default_columns', 'add_slug_export_column' );

function add_slug_export_column( $columns ) {
	$columns['slug'] = 'Slug';
 
	return $columns;
}

add_filter( 'woocommerce_product_export_product_column_slug'  , 'add_export_data_slug', 10, 2 );
function add_export_data_slug( $value, $product ) {
    $value = $product->get_slug();
	
    return $value;
}

add_filter( 'woocommerce_csv_product_import_mapping_options', 'add_slug_import_option' );
function add_slug_import_option( $options ) {
  $options['slug'] = 'Slug';
 
  return $options;
}

add_filter( 'woocommerce_csv_product_import_mapping_default_columns', 'add_default_slug_column_mapping' );
function add_default_slug_column_mapping( $columns ) {
  $columns['Slug'] = 'slug';
 
  return $columns;
} 

add_filter( 'woocommerce_product_import_pre_insert_product_object', 'process_import_product_slug_column', 10, 2 );
function process_import_product_slug_column( $object, $data ) {
  if ( !empty( $data['slug'] ) ) {
    $object->set_slug( $data['slug'] );
  }
 
  return $object;
}
function woodmart_post_date( $args ) {
	$has_title = get_the_title() != '';
	$attr      = '';
	if ( ! $has_title && ! is_single() ) {
		$url  = get_the_permalink();
		$attr = 'window.location=\'' . $url . '\';';
	}
	$classes  = '';
	$classes .= ' ' . $args['style'];
	$classes .= woodmart_get_old_classes( ' woodmart-post-date' );
	?>
		<div class="post-date wd-post-date<?php echo esc_attr( $classes ); ?>" onclick="<?php echo esc_attr( $attr ); ?>">
			<span class="post-date-day">
				<?php echo get_the_time( 'd' ); ?>
			</span>
			<span class="post-date-month">
				<?php echo get_the_time( 'M' ); ?>
			</span>
			<span class="post-date-year">
				<?php echo get_the_time( 'Y' ); ?>
			</span>
		</div>
	<?php
}
function mergePdf($pdfArr){
    $pdf = new Mpdf();
    foreach($pdfArr as $currentPdf){
      $pagecount = $pdf->SetSourceFile($currentPdf);
      for($i = 1; $i <= $pagecount; $i++){
        $pdf->AddPage();
        $tplId = $pdf->importPage($i);
        $pdf->useTemplate($tplId);
      }
    }
    //direct show on browser
    $pdf->Output();
    
    //spacefic location save file
    $outputpath = 'location/output.pdf';
    $pdf->Output($outputpath, 'F');
}
function find_order_with_product_for_user($user_id, $product_id) {
	global $wpdb;

	// Get the order IDs for the user
	$order_ids = $wpdb->get_col("
        SELECT DISTINCT order_items.order_id
        FROM wp_woocommerce_order_items as order_items
        LEFT JOIN wp_woocommerce_order_itemmeta as order_itemmeta ON order_items.order_item_id = order_itemmeta.order_item_id
        LEFT JOIN wp_posts as posts ON order_items.order_id = posts.ID
        LEFT JOIN wp_postmeta as postmeta ON postmeta.post_id = posts.ID
        WHERE posts.post_type = 'shop_order'
        AND posts.post_status IN ('wc-processing', 'wc-completed')
        AND order_itemmeta.meta_key = '_product_id'
        AND order_itemmeta.meta_value = '$product_id'
        AND postmeta.meta_key = '_customer_user'
        AND postmeta.meta_value = '$user_id'
    ");

	// If orders are found, return the order IDs
	if ($order_ids) {
		return $order_ids;
	}

	return false;
}
function course_woocommerce_product_downloads_shortcode($atts) {
	// Extract shortcode attributes
	$atts = shortcode_atts(
		array(
			'product_id' => get_the_ID(), // Specify the product ID
		),
		$atts,
		'custom_woocommerce_product_downloads'
	);

	// Check if the product ID is provided
	if (empty($atts['product_id'])) {
		return '';
	}

	// Get the product object
	$product = wc_get_product($atts['product_id']);
	$order_ids = find_order_with_product_for_user(get_current_user_id(), $atts['product_id']);

	// Check if the product is downloadable
	if ($product && $product->is_downloadable() &&  wc_customer_bought_product(get_current_user_id(), get_current_user_id(), get_the_ID())) {
		$order = wc_get_order(current($order_ids));
		$downloads = $order->get_downloadable_items();
		// Check if there are downloads
		if ($downloads) {
			// Output a list of download files
			$output = '<h2>دانلود دوره خریداری شده ' . esc_html($product->get_name()) . '</h2>';
			$output .= '<ul>';
			foreach ($downloads as $download) {
				if($download['product_id'] != $atts['product_id']){
					continue;
				}
				$output .= '<li><a href="' . esc_url($download['download_url']) . '">' . esc_html($download['download_name']) . "</a></li>";
			}
			$output .= '</ul>';
		} else {
			$output = '<p>هیچ فایل دانلودی برای این دوره موجود نیست.</p>';
		}
	} else {
		$output = '<p>برای مشاهده فایل ها لطفا ابتدا دوره را خریداری کنید</p>';
	}

	return $output;
}
add_shortcode('course_woocommerce_product_downloads', 'course_woocommerce_product_downloads_shortcode');
function find_order_with_product_for_user($user_id, $product_id) {
	global $wpdb;

	// Get the order IDs for the user
	$order_ids = $wpdb->get_col("
        SELECT DISTINCT order_items.order_id
        FROM wp_woocommerce_order_items as order_items
        LEFT JOIN wp_woocommerce_order_itemmeta as order_itemmeta ON order_items.order_item_id = order_itemmeta.order_item_id
        LEFT JOIN wp_posts as posts ON order_items.order_id = posts.ID
        LEFT JOIN wp_postmeta as postmeta ON postmeta.post_id = posts.ID
        WHERE posts.post_type = 'shop_order'
        AND posts.post_status IN ('wc-processing', 'wc-completed')
        AND order_itemmeta.meta_key = '_product_id'
        AND order_itemmeta.meta_value = '$product_id'
        AND postmeta.meta_key = '_customer_user'
        AND postmeta.meta_value = '$user_id'
    ");

	// If orders are found, return the order IDs
	if ($order_ids) {
		return $order_ids;
	}

	return false;
}
function course_woocommerce_product_downloads_shortcode($atts) {
	// Extract shortcode attributes
	$atts = shortcode_atts(
		array(
			'product_id' => get_the_ID(), // Specify the product ID
		),
		$atts,
		'custom_woocommerce_product_downloads'
	);

	// Check if the product ID is provided
	if (empty($atts['product_id'])) {
		return '';
	}

	// Get the product object
	$product = wc_get_product($atts['product_id']);
	$order_ids = find_order_with_product_for_user(get_current_user_id(), $atts['product_id']);

	// Check if the product is downloadable
	if ($product && $product->is_downloadable() &&  wc_customer_bought_product(get_current_user_id(), get_current_user_id(), get_the_ID())) {
		$order = wc_get_order(current($order_ids));
		$downloads = $order->get_downloadable_items();
		// Check if there are downloads
		if ($downloads) {
			// Output a list of download files
			$output = '<h2>دانلود دوره خریداری شده ' . esc_html($product->get_name()) . '</h2>';
			$output .= '<ul>';
			foreach ($downloads as $download) {
				if($download['product_id'] != $atts['product_id']){
					continue;
				}
				$output .= '<li><a href="' . esc_url($download['download_url']) . '">' . esc_html($download['download_name']) . "</a></li>";
			}
			$output .= '</ul>';
		} else {
			$output = '<p>هیچ فایل دانلودی برای این دوره موجود نیست.</p>';
		}
	} else {
		$output = '<p>برای مشاهده فایل ها لطفا ابتدا دوره را خریداری کنید</p>';
	}

	return $output;
}
add_shortcode('course_woocommerce_product_downloads', 'course_woocommerce_product_downloads_shortcode');
brasero
sqlite3
postgres
firefox
chrome
chromium
emacs terminal
wezterm nigthly terminal
alacrity
tilix
dolphin
archivos
thunderbird
telegram
postman
discover
visual studio code 
la batalla por wesnoth
muon ssh clien
anydesk

una imagen es el empaquetador que contiene las dependencias el codigo y es lo que se comparte

un container son capas tras capas de imagenes

existen tres tipos de virtualizaciones en las VM virtualmachine
1.- para virtualizacion
en la paravirtualizacion intenta entregar la mayor cantidad de acceso del sistema anfitrion de su hardware a los cientes en el contenedor

2.- virtualizacion parcial
donde algunos componentes del hardware se virtualizan para en sistema operativo cliente

3.- virtualizacion completa:
donde absolutamente todos los componentes o hardware que esta utilizando el sistema operativo cliente son virtualizados de esta manera los sistemas operativos cliente no acceden en los absoluto al hardware

para todos los casos anteriores docker va a ser absolutamente superior y va a utilizar el kernel del sistema opetativo anfitrion y esto se traduce en rendimiento, los contenedores de docker parten casi que instantaneamente, obteniendo un rendimiento muy superior a todas las alternativas mencionadas anteriormente fin de la teoria


docker desktop es una maquina virtual se encuentra optimizada
corre linux
ejecuta containers
permite acceder al sistema de archivos y tambien a la red(interna y externa)

docker desktop no es una unica herramienta viene con otras herramientas que nos sirven para trabajar con nuestras imagenes y tambien con nuestros containers dentro de estas herramientes tenemos 

docker compose, docker cli ademas de otras herramientas

puede correr de manera nativa en windows con la herramienta WSL2(windows subsystem for linux)


existe una alternativa de instalacion para windows,linux y mac

para windows una sola opcion solamente es descargarlo y presionar siguiente siguiente siguente y listo

para mac existen dos alternatinas pulsar la de la derecha en la pagina web de docker

para linux docker ya tiene paquetes de instalacion pre compilados dependiendo de la version de linux que estes utilizando utiliza la alternativa que mas te funcione

que es dockerHUB: es un repositorio de imagenes o contenedores disponibles para comenzar a trabajar oficiales para utilizar

proceso para instalarlo
* docker images : devuelve un listado completo de todas las imagenes que hallamos descargado en nuestra maquina
donde repositorio te muestra el nombre de la imagen que se halla descargado, cada repositorio puede tener una o mas etiquetas con la version de la imagen

para descargar una imagen tenemos dos alternativas con el siguiente comando
1.-descargar la version que nosotros queremos
2.- no especificar nada esto va a descargar la ultima version de la imagen que queramos descargar
ejemplo:
* docker pull node

este comando te descargara cada una de las capas que componen la imagen de manera que si tenemos que descargar otra imagen y sus capas ya han sido descargadas por otro imagen las capas ya descargadas anteriormente ya no se volveran a descargar de esta manera de aprovecha espacio y tambien las distintas imagenes para optimizar un poco mas el espacio que estas van a utilizar en el disco duro

para descargar una version especifica de una imagen
* docker pull node:18

la imagen id es la misma que las otras versiones relativamente similares lo que cambia es la etiqueta de la version

para descargar la imagende mysql 
en mac se debe colocar 
* docker pull --platform linux/x86_64 mysql

normal es 

* docker pull mysql

tambien podemos indicar una version

* docker pull mysql:numeroversion

para eliminar una imagen en ejecucion el comando es

* docker image rm nombredelaimagen

la imagen de docker pull no necesita tantas configuraciones

Despues de descargar una imagen se procede a crear un contenedor

* docker create mongo (forma corta)

* docker container create mongo (forma larga) 

nos devuelve un id del contenedor (este id nos sirve para crear un contenedor)
el comando para ejecutar un contenedor es:

* docker start idContenedor (donde idcontenedor es el codigo id largo del contenedor) esto nos devuelve el id del contenedor nuevamente

* docker ps : este comando es como docker iamges pero se usa para ver los contenedores creados, cuando se crea un contenedor se le agrega un nombre de manera arbitraria al contenedor y ese nombre se puede usar en lugar del idcortocontenedor para eliminar el contenedor

* docker ps -a para ver todos los contenedores incluso los que no se estan ejecutando

para detener el contenedor se debe usar el comando

* docker stop idcortocontenedor

para asignar un nombre a un contenedor:

* docker create --name nombreContenedor esto nos devuelve el idlargo del contenedor indicando que ya se ha creado el contenedor

y como ya le hemos asignado un nombre al contenedor podemos iniciarlo con:

* Docker start nombreContenedorAsignado

para poder guardar datos dentro de un contenedor se debe mapear el puerto local al puerto del contenedor:

* docker create -p27017:27017 --name nombreContenedor nombreImagenBase donde lo que esta antes del : es el puerto de la maquina nuestra la maquina local y lo que esta despues del : es el puerto interno del contenedor, siempre asignale un puerto a cada contenedor creado por que si dejas que docker asigne un puerto los va a asignar por encima del puerto 50mil

con el comando 
docker logs nombreContenedor  puedes ver todos los logs que este nos muestra y tambien puedes verlo con

* docker logs --follow nombreContenedor la diferencia es que este se queda escuchando y mostrando los logs en tiempo real

el comando docker run hace tres cosas 
1.-descarga la imagen
2.-crea el contenedor
3.-inicia el contenedor

* ejemplo docker run mongo
docker run mongo

los siguientes dos comandos devulven el id del contenedor creado
docker run -d mongo este nos asigna un nombre arbitrariamente por docker
docker run --name nombreContenedor -p27017:27017 -d imagenbase este comando nos permite crear un contenedor mas personalizado

luego para ver el contenedor usa el comando 
* docker ps

configuracion del archivo dockerfile
tomar una aplicacion de docker un meterla dentro de un container
el archivo dockerfile no puede tener otro nombre se tiene que llamar dockerfile, este archivo se utiliza para que nosotros podamos construir nuestros containers, aqui nosotros vamos a escribir las instrucciones que necesita nuestro contenedor para poder crearse,m todas las imagenes que nosotros creemos siempre se tienen que basar en alguna otra imagen

ejemplo
* FROM node:etiquetaversion

RUN mkdir -p /home/app --esto es donde vamos a meter el codigo fuente de nuestra aplicacion, esta ruta no es una ruta fisita en nuestra maquina sino que es una ruta en el contenedor 

COPY . /home/app

EXPOSE 3000 ruta donde se va a ejecutar la aplicacion

CMD ["node","/home/app/index.js"]

ahora vamos a aprender a crear redes en docker

* docker ls : lista todas las redes existentes

* docker network create mired : este comando creara una nueva red dentro de docker este nos devolvera el id de la red creada

* docker network rm mired este comando elimina la red creada anteriormente

el siguiente comando recibe dos argumentos (nombreDadoPorMI,rutanodenosencontramos ) y se utiliza para construir contenedores en base a un archivo dockerfile

* docker build -t miapp:etiquetaversiondadapormi .

*docker create -P27017:27017 --name monguito --network mired -e MONGO_INITDB_ROOT_USERNAME=nico -e MONGO_INIT_DB_ROOT_PASSWORD=password mongo

ahora para colocar el contenedor de la aplicacion que nosotros acabamos de colocar dentro de una imagen

*docker create -p3000 --name chanchito --network mired miapp:1

*luego escribir docker ps -a

luego de hacer esto debemos arrancar los dos contenedores que creamos y que estan dentro de una misma red
sudo docker start monguito
sudo docker start chanchito

resumen de pasos para poder crear contenedores y tambien conectarlos
descargar la imagen
crear una red
crear el contenedor
	asignar puertos 
    asignar un nombre
    variables de entorno
    especificar la red
    indicar la imagen:consuetiqueta
todo esto por cada contenedor

para automatizar todo los pasos anteriores existe la herramienta docker compose
para esto debemos crear y editar un archivo con extension.yml

la estructura de este archivo es la siguiente
version:"3.9"
services:
	chanchito:
		build: .
        ports:
			-"3000:3000"
		links:
			-monguito
	monguito:
		imagen:mongo
        	ports:"27017:27017"
		environment:
			- MONGO_INITDB_ROOT_USERNAME=nico
			- MONGO_INITDB_ROOT_PASSWORD=password

ahora para ejecutar un archivo docker yml o docker compose se utiliza el siguiente comando:
docker compose up

luego verificas las imagenes creadadas con 

*docker images

con el comando 
docker compose down que es lo contrario de docker compose up, para eliminartodo lo que se creo anteriormente con docker compose up

para trabajar con volumenes vamos al final del archivo compose 
version:"3.9"
services:
	chanchito:
		build: .
        ports:
			-"3000:3000"
		links:
			-monguito
	monguito:
		imagen:mongo
        	ports:"27017:27017"
		environment:
			- MONGO_INITDB_ROOT_USERNAME=nico
			- MONGO_INITDB_ROOT_PASSWORD=password
		volumes:
			-mongo-data:/data/db
            # mysql -> var/lib/mysql
            # postgres -> var/lib/postgresql/data
volumes:
	mongo_data:

para crear multiples ambientes de desarrollo mientras estamos trabajando con docker
primero debemos crear un archivo con extension.dev ejemplo dockerfile.yml ya que el archivo que teniamos anterior mente quizas queramos usarlo para produccion ejemplo dockerfile.dev la estructura este este archivo es parecida al archivo dockerfile anterior con algunas diferencias

FROM node:18

RUN npm i -g nodemon
RUN mkdir -p /home/app

WORKDIR /home/app

EXPOSE 3000

CMD ["nodemon","index.js"]

ademas de este archivo demos crear un archivo compose para desarrollo tambien al cual llamaremos docker-compose-dev.yml con la siguiente estructura
version:"3.9"
services:
	chanchito:
		build: 
        context: .
        dockerfile:dockerfile.dev
        ports:
			-"3000:3000"
		links:
			-monguito
		volumes: 
			- .:/home/app
	monguito:
		imagen:mongo
        	ports:"27017:27017"
		environment:
			- MONGO_INITDB_ROOT_USERNAME=nico
			- MONGO_INITDB_ROOT_PASSWORD=password
		volumes:
			-mongo-data:/data/db
            # mysql -> var/lib/mysql
            # postgres -> var/lib/postgresql/data
volumes:
	mongo_data:

para provar el archivo que acabamos de construir utilizamos el siguiente comando, un archivo docker compose completamente customisado que no sea docker-compose.yml

docker compose -f docker-compose-dev.yml up
$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});
sudo apt-get install alacritty
      //				tilix
		//				wezterm-nightly  --esto se consigue como un archivo app
// Loop through each item in the order
                        // This loop processes each individual item within the order to extract its specific info
                        foreach ($order->get_items() as $item_id => $item) {

                            // Retrieve the ID of the product associated with the current item in the order
                            $product_id = $item->get_product_id();
                            // Check if the current item's product ID matches the product ID we're processing in this loop iteration
                            if ($product_id == $pid) {
                                // Get the total price and subtotal price specific to this order item
                                // These values are specific to each item in the order, rather than the order as a whole
                                $line_total = wc_get_order_item_meta($item_id, '_line_total', true);
                                $line_subtotal = wc_get_order_item_meta($item_id, '_line_subtotal', true);
                                // ... extract other relevant data ... for now the amounts are ok
            
                                // Build the report entry for this product
                                array_push($order_data,[
                                    'order_id'         => $order_id,
                                    'customer_first'   => $order->get_billing_first_name(),
                                    'customer_last'    => $order->get_billing_last_name(),
                                    'order_created'    => date("d/m/Y",strtotime($order->get_date_created())),
                                    'email'            => $order->get_billing_email(),
                                    'phone'            => $order->get_billing_phone(),
                                    'orders_status'    => $order_status,
                                    'invoice_no'       => $formatted_invoice_number,
                                    'credit_note'      => $credit_note,
                                    'invoice_date'     => $invoice_date,
                                    'credit_note_date' => $credit_note_date,//date("d/m/Y",strtotime($credit_note_date)),
                                    'wooco_currency'   => $currency_symbol,
                                    'gross'            => round($line_subtotal,2),
                                    'discount'         => round($order->get_total_discount(),2),
                                    'net_total'        => round($line_total,2),
                                    'course_id'        => self::get_product_sku($pid),
                                    'course_start'     => $course_start,
                                    'course_ends'      => $course_end,
                                    'student_id'       => $assign_student_id_value
                                ]);
                            }  
                        }
// func that is going to set our title of our customer magically
function w2w_customers_set_title( $data , $postarr ) {

    // We only care if it's our customer
    if( $data[ 'post_type' ] === 'w2w-customers' ) {

        // get the customer name from _POST or from post_meta
        $customer_name = ( ! empty( $_POST[ 'customer_name' ] ) ) ? $_POST[ 'customer_name' ] : get_post_meta( $postarr[ 'ID' ], 'customer_name', true );

        // if the name is not empty, we want to set the title
        if( $customer_name !== '' ) {

            // sanitize name for title
            $data[ 'post_title' ] = $customer_name;
            // sanitize the name for the slug
            $data[ 'post_name' ]  = sanitize_title( sanitize_title_with_dashes( $customer_name, '', 'save' ) );
        }
    }
    return $data;
}
add_filter( 'wp_insert_post_data' , 'w2w_customers_set_title' , '99', 2 );
function update_post( $post_id ) {
   $post = array(
     'ID'         => $post_id,
     'post_title' => '#'.$post_id,
     'post_name'  => $post_id,
   );
   wp_update_post( $post );
   update_post_meta($post_id, 'order', $post_id);
}
add_action('save_post_booking', 'update_post', 20);
/*
* Plugin Name: Course Taxonomy
* Description: A short example showing how to add a taxonomy called Course.
* Version: 1.0
* Author: developer.wordpress.org
* Author URI: https://codex.wordpress.org/User:Aternus
*/

function wporg_register_taxonomy_course() {
	 $labels = array(
		 'name'              => _x( 'Courses', 'taxonomy general name' ),
		 'singular_name'     => _x( 'Course', 'taxonomy singular name' ),
		 'search_items'      => __( 'Search Courses' ),
		 'all_items'         => __( 'All Courses' ),
		 'parent_item'       => __( 'Parent Course' ),
		 'parent_item_colon' => __( 'Parent Course:' ),
		 'edit_item'         => __( 'Edit Course' ),
		 'update_item'       => __( 'Update Course' ),
		 'add_new_item'      => __( 'Add New Course' ),
		 'new_item_name'     => __( 'New Course Name' ),
		 'menu_name'         => __( 'Course' ),
	 );
	 $args   = array(
		 'hierarchical'      => true, // make it hierarchical (like categories)
		 'labels'            => $labels,
		 'show_ui'           => true,
		 'show_admin_column' => true,
		 'query_var'         => true,
		 'rewrite'           => [ 'slug' => 'course' ],
	 );
	 register_taxonomy( 'course', [ 'post' ], $args );
}
add_action( 'init', 'wporg_register_taxonomy_course' );
<?php
$args = array(
	'post_type'      => 'product',
	'posts_per_page' => 10,
);
$loop = new WP_Query($args);
while ( $loop->have_posts() ) {
	$loop->the_post();
	?>
	<div class="entry-content">
		<?php the_title(); ?>
		<?php the_content(); ?>
	</div>
	<?php
}
mv mover y tambien sirve para cambiar el nombre
mv nombrearchivoacambiar nuevomobre.ext && mv nuevonombre.ext /rutadondeguardarlo
principio de la tabla:
[
  'class' => 'yii\grid\ActionColumn',
            'contentOptions' => ['style' => 'text-align:center; width:2%; vertical-align:middle;'],
 ]
Final de la tabla:
'class' => 'yii\grid\ActionColumn',
            'contentOptions' => ['style' => 'text-align:center; width:2%; vertical-align:middle;'],
  
listas:
'id_reporte' => [
            'attribute' => 'id_reporte',
            'headerOptions' => ['style' => 'text-align:center; width:5%;text-color:white;'],
            'contentOptions' => ['style' => 'text-align:center; vertical-align:middle; white-space: pre-line;'],
            'label' => 'Tipo de Reporte',
            'filter' => app\models\Reportes::lista(),
            'format' => 'html',
            'value' => function ($data) {
                $s = app\models\Reportes::find()->where(['id_reporte' => $data->id_reporte])->one();
                $desc_reporte = ($s) ? $s->desc_reporte : '';
                $desc_reporte = nl2br($desc_reporte);
                $desc_reporte = wordwrap($desc_reporte, 20, "<br>\n");
                return $desc_reporte;
            }
        ],

campos:
'attribute' => 'fecha_hora',
            'value' => 'fecha_hora',
            'headerOptions' => ['style' => 'text-align:center; width:10%;text-color:white;'],
            'contentOptions' => ['style' => 'text-align:center; vertical-align:middle;'],
add_action('wp_ajax_add_product_to_cart', 'add_product_to_cart_ajax');
add_action('wp_ajax_nopriv_add_product_to_cart', 'add_product_to_cart_ajax');

function add_product_to_cart_ajax() {
    $product_id = isset($_POST['product_id']) ? intval($_POST['product_id']) : 0;
    $quantity = isset($_POST['quantity']) ? intval($_POST['quantity']) : 1;

    if ($product_id > 0) {
        WC()->cart->add_to_cart($product_id, $quantity);
        wp_send_json('Product added to cart');
    } else {
        wp_send_json('Invalid product');
    }
}

//second custom code to direct checkout.

add_filter('woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect');

function custom_add_to_cart_redirect($url) {
    global $woocommerce;
    $checkout_url = wc_get_checkout_url();

    return $checkout_url;
}
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="style.css">

  </head>

  <body>
      <button onclick="changeColor()">Repaint!</button>
  </body>
  
      <script>
        function getRandomColor(){
          let letters = '0123456789ABCDEF';
          let color = '#';
          for (let i = 0; i < 6; i++) {
            color += letters[Math.floor(Math.random() * 16)];
          }
          return color;
        }
        function changeColor(){
          let newColor = getRandomColor();
          document.body.style.backgroundColor = newColor;
        }
    </script>
  
</html>
function custom_product_price($price, $product) {
    // Change the price for product with ID 46
    if ($product && $product->get_id() === 46) {
        $price = '500.00'; // Set the desired price
    }

    return $price;
}

add_filter('woocommerce_get_price_html', 'custom_product_price', 10, 2);
add_filter('woocommerce_cart_item_price', 'custom_product_price', 10, 2);
add_filter('woocommerce_cart_item_subtotal', 'custom_product_price', 10, 3);
    
// Form to add a record   to display products dropdown v1.2 starts
echo '<form id="add-record-form" style="display: flex; flex-direction: row;">
<div class="main_container" style="margin-right: 20px;">
    <label for="product_name">Product Name:</label>
    <select id="product_name" name="product_name">';
    
// Retrieve product names from the database
$query = new WP_Query(array(
    'post_type' => 'product',
    'post_status' => 'publish',
    'posts_per_page' => '-1'
));

if ($query->have_posts()) :
    while ($query->have_posts()) : $query->the_post();
        echo '<option value="' . get_the_title() . '">' . get_the_title() . '</option>';
    endwhile;
    wp_reset_postdata();
else:
    echo '<option value="">No products found</option>';
endif;

echo '</select>
</div>';

// v1.2 stops
// Modify quantity input and add remove icon
add_filter('woocommerce_checkout_cart_item_quantity', 'bbloomer_checkout_item_quantity_input', 9999, 3);

function bbloomer_checkout_item_quantity_input($product_quantity, $cart_item, $cart_item_key) {
    $product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key);
    $product_id = apply_filters('woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key);

    if (!$product->is_sold_individually()) {
        $product_quantity = woocommerce_quantity_input(array(
            'input_name'  => 'shipping_method_qty_' . $product_id,
            'input_value' => $cart_item['quantity'],
            'max_value'   => $product->get_max_purchase_quantity(),
            'min_value'   => '0',
        ), $product, false);

        // Add remove icon
        $product_quantity .= '<a href="#" class="remove-product" data-product-key="' . $cart_item_key . '">x</a>';

        $product_quantity .= '<input type="hidden" name="product_key_' . $product_id . '" value="' . $cart_item_key . '">';
    }

    return $product_quantity;
}

// Add JavaScript to handle product removal
add_action('wp_footer', 'add_product_removal_script');

function add_product_removal_script() {
    ?>
    <script>
        document.addEventListener('click', function (event) {
            if (event.target.classList.contains('remove-product')) {
                event.preventDefault();
                const productKey = event.target.getAttribute('data-product-key');
                const form = event.target.closest('form');

                if (form && productKey) {
                    // Remove the product from the cart via AJAX
                    jQuery.ajax({
                        type: 'POST',
                        url: wc_checkout_params.ajax_url,
                        data: {
                            action: 'remove_product_from_cart',
                            product_key: productKey
                        },
                        success: function (response) {
                            // Reload the checkout page to reflect the updated cart
                            window.location.reload();
                        }
                    });
                }
            }
        });
    </script>
    <?php
}
add_action('wp_ajax_remove_product_from_cart', 'remove_product_from_cart');

function remove_product_from_cart() {
    if (isset($_POST['product_key'])) {
        $product_key = sanitize_text_field($_POST['product_key']);
        WC()->cart->remove_cart_item($product_key);
        echo 'success';
    }

    wp_die();
}


// Detect Quantity Change and Recalculate Totals
add_action('woocommerce_checkout_update_order_review', 'bbloomer_update_item_quantity_checkout');

function bbloomer_update_item_quantity_checkout($post_data) {
    parse_str($post_data, $post_data_array);
    $updated_qty = false;
    $updated_remove = false;

    foreach ($post_data_array as $key => $value) {
        if (substr($key, 0, 20) === 'shipping_method_qty_') {
            $id = substr($key, 20);
            WC()->cart->set_quantity($post_data_array['product_key_' . $id], $post_data_array[$key], false);
            $updated_qty = true;
        } elseif (substr($key, 0, 15) === 'remove_product_') {
            $cart_item_key = substr($key, 15);
            WC()->cart->remove_cart_item($cart_item_key);
            $updated_remove = true;
        }
    }

    if ($updated_qty || $updated_remove) {
        WC()->cart->calculate_totals();
    }
}
<?php

require 'vendor/autoload.php';

// Create a client with a base URI

$client = new \GuzzleHttp\Client(['base_uri' => 'https://rbt5.namnguyen68.repl.co']);

// Send a request

$response = $client->request('GET', 'html/begin');

$body = $response->getBody();

echo $body;

// Send a request

$response = $client->request('GET', 'title/a');

$body = $response->getBody();

echo $body;

// Send a request

$response = $client->request('GET', 'body/begin');

$body = $response->getBody();

echo $body;

?>

<?php

// Create a client with a base URI

$client = new \GuzzleHttp\Client(['base_uri' => 'https://rbt5.namnguyen68.repl.co']);

// Send a request

$response = $client->request('GET', 'html/end');

$body = $response->getBody();

echo $body;

?>

alt + z = ajuta la lineas de codigo para que se vea la linea completa en la pantalla
ctrl + shift + a= comenta varias lineas de cdigo
ctrl + f = buscar en el codigo o buscar en archivos debo seleccionar el lugar en donde voy a buscar
ctrl + shift + p = abre la paleta de comandos
DOCTYPE: html
  html lang="en"
    head
    #text: ⏎␣␣
      title
      #text: Sample page
      #text: ⏎␣
    #text: ⏎␣
    body
    #text: ⏎␣␣
      h1
      #text: Sample page
      #text: ⏎␣␣
      p
        #text: This is a
        a href="demo.html"
      	 #text: simple
      #text: sample.
      #text: ⏎␣␣
      #comment: this is a comment
     #text: ⏎␣⏎
$my_repeater = get_field('cosa_facciamo_home');

            // Verifica se il campo ripetitore esiste
            if ($my_repeater) :
                
                // Loop attraverso le istanze del campo ripetitore
                foreach ($my_repeater as $item) :
                    // Recupera il campo di gruppo all'interno del ripetitore
                    $my_group = $item['cosa_facciamo_items'];

                    // Recupera i valori all'interno del campo di gruppo
                    $field_value_1 = $my_group['titolo_cosa-facciamo'];
                    $field_value_2 = $my_group['testo_cosa_facciamo'];

                    // Puoi ora utilizzare questi valori come desideri
                    echo 'Valore del campo personalizzato 1: ' . $field_value_1 . '<br>';
                    echo 'Valore del campo personalizzato 2: ' . $field_value_2 . '<br>';
                endforeach;
            endif;
function edit_button_shortcode() {
    // Check if the user is logged in
    if (is_user_logged_in()) {
        global $wpdb;
        $user_id = get_current_user_id();

        // Check if the user's ID exists in the wp_fluentform_submissions table
        $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}fluentform_submissions WHERE user_id = %d", $user_id));

        // If the user's ID exists in the table, display the "Edit" button
        if ($results) {
            return '<a href="YOUR_EDIT_URL_HERE" class="edit-button">Edit</a>';
        }
    }
    return '';  // If the user is not logged in or their ID doesn't exist in the table, return an empty string
}
add_shortcode('edit_button', 'edit_button_shortcode');
brew install shivammathur/php/php@8.2

brew unlink php@7.4 && brew link --force --overwrite php@8.2

add_filter( 'woocommerce_checkout_cart_item_quantity', 'bbloomer_checkout_item_quantity_input', 9999, 3 );
  
function bbloomer_checkout_item_quantity_input( $product_quantity, $cart_item, $cart_item_key ) {
   $product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
   $product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
   if ( ! $product->is_sold_individually() ) {
      $product_quantity = woocommerce_quantity_input( array(
         'input_name'  => 'shipping_method_qty_' . $product_id,
         'input_value' => $cart_item['quantity'],
         'max_value'   => $product->get_max_purchase_quantity(),
         'min_value'   => '0',
      ), $product, false );
      $product_quantity .= '<input type="hidden" name="product_key_' . $product_id . '" value="' . $cart_item_key . '">';
   }
   return $product_quantity;
}
 
// ----------------------------
// Detect Quantity Change and Recalculate Totals
 
add_action( 'woocommerce_checkout_update_order_review', 'bbloomer_update_item_quantity_checkout' );
 
function bbloomer_update_item_quantity_checkout( $post_data ) {
   parse_str( $post_data, $post_data_array );
   $updated_qty = false;
   foreach ( $post_data_array as $key => $value ) {   
      if ( substr( $key, 0, 20 ) === 'shipping_method_qty_' ) {         
         $id = substr( $key, 20 );   
         WC()->cart->set_quantity( $post_data_array['product_key_' . $id], $post_data_array[$key], false );
         $updated_qty = true;
      }     
   }  
   if ( $updated_qty ) WC()->cart->calculate_totals();
}
define( 'RECOVERY_MODE_EMAIL', 'myemail@example.com' );
add_filter('woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect');

function custom_add_to_cart_redirect($url) {
    global $woocommerce;
    $checkout_url = wc_get_checkout_url();

    return $checkout_url;
}
function custom_checkout_text_change( $translated_text, $text, $domain ) {
    if ( $domain === 'woocommerce' && $text === 'Billing details' ) {
        $translated_text = 'Billing Details';
    }
    return $translated_text;
}
add_filter( 'gettext', 'custom_checkout_text_change', 20, 3 );
for "laravel-mix": "^6.0.49",

"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},




"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},
require_once __DIR__ . '/vendor/autoload.php';

$klein = new \Klein\Klein();

$klein->respond('GET', 'name/[:name]', function ($request) {
    return 'Hello ' . $request->name;
});

$klein->dispatch();
function bulk_modifier_page() {
    global $wpdb;

    if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
        // Check if a CSV file is uploaded successfully
        if ($_FILES['csv_file']['error'] == UPLOAD_ERR_OK) {
            $file = $_FILES['csv_file']['tmp_name'];

            // Read the CSV file
            $csv_data = array_map('str_getcsv', file($file));
            $csv_headers = array_shift($csv_data); // Get headers

            // Define the mapping of CSV columns to database columns for wp_za_groups table
            $group_column_mapping = array(
                'group_name' => 'title',
                'priority' => 'priority',
                'apply_to' => 'apply_to',
                'author_id' => 'admin_id',
                'created_at' => 'created_at',
                'created_at_gmt' => 'created_at_gmt',
                'updated_at' => 'updated_at',
                'updated_at_gmt' => 'updated_at_gmt'
            );

            // Define the mapping of CSV columns to database columns for wp_za_types table
            $type_column_mapping = array(
                'title_name' => 'title',
                'type' => 'type',
                'status' => 'status',
                'description' => 'description',
                'required' => 'required',
                'display_description_on_expansion' => 'display_description_on_expansion',
                'hide_description' => 'hide_description',
                'tooltip_description' => 'tooltip_description',
                'created_at' => 'created_at',
                'created_at_gmt' => 'created_at_gmt',
                'updated_at' => 'updated_at',
                'updated_at_gmt' => 'updated_at_gmt'
            );

            // Define the mapping of CSV columns to database columns for wp_za_values table
            $value_column_mapping = array(
                'addons_title' => 'title',
                'price' => 'price',
                'description_value' => 'description',
                'sku' => 'sku',
            );

            // Insert data into the wp_za_groups, wp_za_types, wp_za_values, wp_za_products_to_groups, and wp_za_categories_to_groups tables
            foreach ($csv_data as $row) {
                // Prepare data for wp_za_groups table
                $group_data = array();
                foreach ($csv_headers as $key => $header) {
                    if (isset($group_column_mapping[$header])) {
                        $group_data[$group_column_mapping[$header]] = $row[$key];
                    }
                }

                // Set default values for created_at, created_at_gmt, updated_at, updated_at_gmt
                $group_data['created_at'] = current_time('mysql');
                $group_data['created_at_gmt'] = current_time('mysql', true);
                $group_data['updated_at'] = current_time('mysql');
                $group_data['updated_at_gmt'] = current_time('mysql', true);

                // Insert data into the wp_za_groups table
                $wpdb->insert($wpdb->prefix . 'za_groups', $group_data);
                $group_id = $wpdb->insert_id; // Get the group ID

                // Prepare data for wp_za_types table
                $type_data = array(
                    'group_id' => $group_id,
                    'step' => 0, // Default value
                    'accordion' => 'open', // Default value
                );

                // Map CSV columns to database columns for wp_za_types table and set default values
                foreach ($csv_headers as $key => $header) {
                    if (isset($type_column_mapping[$header])) {
                        if ($header === 'status' && !isset($type_data['status'])) {
                            // Set default status if not present in CSV
                            $type_data['status'] = 'enable';
                        } elseif ($header === 'description' && !isset($type_data['description'])) {
                            // Set default description if not present in CSV
                            $type_data['description'] = 'none';
                        } elseif ($header === 'required' && !isset($type_data['required'])) {
                            // Set default required value if not present in CSV
                            $type_data['required'] = 0;
                        } elseif ($header === 'display_description_on_expansion' && !isset($type_data['display_description_on_expansion'])) {
                            // Set default display_description_on_expansion value if not present in CSV
                            $type_data['display_description_on_expansion'] = 0;
                        } elseif ($header === 'hide_description' && !isset($type_data['hide_description'])) {
                            // Set default hide_description value if not present in CSV
                            $type_data['hide_description'] = 0;
                        } elseif ($header === 'tooltip_description' && !isset($type_data['tooltip_description'])) {
                            // Set default tooltip_description value if not present in CSV
                            $type_data['tooltip_description'] = 0;
                        } else {
                            $type_data[$type_column_mapping[$header]] = $row[$key];
                        }
                    }
                }

                // Set default values for created_at, created_at_gmt, updated_at, updated_at_gmt
                $type_data['created_at'] = current_time('mysql');
                $type_data['created_at_gmt'] = current_time('mysql', true);
                $type_data['updated_at'] = current_time('mysql');
                $type_data['updated_at_gmt'] = current_time('mysql', true);

                // Insert data into the wp_za_types table
                $wpdb->insert($wpdb->prefix . 'za_types', $type_data);
                $type_id = $wpdb->insert_id; // Get the type ID

                // Prepare data for wp_za_values table
                $value_data = array(
                    'type_id' => $type_id,
                    'step' => $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "za_values WHERE type_id = $type_id") + 1, // Increment step
                );

                // Map CSV columns to database columns for wp_za_values table and set default values
                foreach ($csv_headers as $key => $header) {
                    if (isset($value_column_mapping[$header])) {
                        if ($header === 'description_value' && !isset($value_data['description'])) {
                            // Set default description if not present in CSV
                            $value_data['description'] = 'no value';
                        } elseif ($header === 'checked' && !isset($value_data['checked'])) {
                            // Set default checked value if not present in CSV
                            $value_data['checked'] = 0;
                        } elseif ($header === 'hide_description' && !isset($value_data['hide_description'])) {
                            // Set default hide_description value if not present in CSV
                            $value_data['hide_description'] = 0;
                        } else {
                            $value_data[$value_column_mapping[$header]] = $row[$key];
                        }
                    }
                }

                // Set default values for created_at, created_at_gmt, updated_at, updated_at_gmt
                $value_data['created_at'] = current_time('mysql');
                $value_data['created_at_gmt'] = current_time('mysql', true);
                $value_data['updated_at'] = current_time('mysql');
                $value_data['updated_at_gmt'] = current_time('mysql', true);

                // Insert data into the wp_za_values table
                $wpdb->insert($wpdb->prefix . 'za_values', $value_data);
                $value_id = $wpdb->insert_id; // Get the value ID

                // Prepare data for wp_za_products_to_groups table
                $product_names = explode(',', $row[array_search('products_name', $csv_headers)]);
                foreach ($product_names as $product_name) {
                    $product_id = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_title = '$product_name' AND post_type = 'product'");

                    if ($product_id) {
                        $product_to_group_data = array(
                            'product_id' => $product_id,
                            'group_id' => $group_id,
                        );

                        // Insert data into the wp_za_products_to_groups table
                        $wpdb->insert($wpdb->prefix . 'za_products_to_groups', $product_to_group_data);
                    }
                }

                // Prepare data for wp_za_categories_to_groups table
                $category_names = explode(',', $row[array_search('category_names', $csv_headers)]);
                foreach ($category_names as $category_name) {
                    // Get the category ID based on the category name
                    $category_id = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms WHERE name = %s", $category_name));

                    if ($category_id) {
                        $category_to_group_data = array(
                            'category_id' => $category_id,
                            'group_id' => $group_id,
                        );

                        // Insert data into the wp_za_categories_to_groups table
                        $wpdb->insert($wpdb->prefix . 'za_categories_to_groups', $category_to_group_data);
                    }
                }
            }

            echo '<div class="updated"><p>Data imported successfully!</p></div>';
        } else {
            echo '<div class="error"><p>Error uploading CSV file.</p></div>';
        }
    }

    // Display the upload form
    ?>
   
    <div class="wrap">
        <h2>Bulk Modifier Upload</h2>
        <form method="post" action="" enctype="multipart/form-data">
            <input type="file" name="csv_file">
            <input type="submit" class="button button-primary" value="Upload CSV & Apply">
        </form>
    </div>
    
    <?php
}
aptitude search bash-completion
           //   bash sh-sequence-bash-completion
Ejecutamos este comando -basta con copy&paste- en la consola "sudo gedit /etc/bash.bashrc".
Descomentamos las tres últimas líneas de ese fichero que se ha abierto, quedando así:
if [ -f /etc/bashcompletion ]; then
. /etc/bashcompletion
fi

Una vez esté todo como el código que os mostramos podremos guardar de nuevo el fichero. Un apunte: antes de la primera línea hay un comentario que podéis dejar o eliminar. Yo personalmente os diría que no lo eliminéis para que sepáis para que sirve ese fichero en un futuro. Probad a comenzar a escribir un comando y pulsad TAB, veréis como se completa el comando automáticamente.

Un ejemplo muy básico para probar esta función es escribir "cd /h" y pulsar el tabulador, automáticamente debería aparecer "cd /home" en pantalla. Le dais a enter y ya tendréis el comando ejecutado.
https://code.visualstudio.com/docs/editor/tasks#vscode
<script type="application/ld+json">
    "@context" : "https://schema.org/",
    {{ $slot }}
</script>
function remove_core_updates(){
global $wp_version;
return (object) array(
'last_checked' => time(),
'version_checked' => $wp_version,
'updates' => array()
);
}
add_filter('pre_site_transient_update_core', 'remove_core_updates');
add_filter('pre_site_transient_update_plugins', 'remove_core_updates');
add_filter('pre_site_transient_update_themes', 'remove_core_updates');
{
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "window.zoomLevel": 1,
    "git.openRepositoryInParentFolders": "never",
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.iconTheme": "material-icon-theme",
    "prettier.bracketSameLine": true,
    "editor.wordWrap": "on",
    "screencastMode.fontSize":20,
    "editor.tabSize": 2,
    "screencastMode.verticalOffset": 3,
    "settingsSync.ignoredExtensions": [
        "ms-ceintl.vscode-language-pack-es"
    ],
    "application.shellEnvironmentResolutionTimeout": 25,
    "workbench.colorTheme": "Night Owl",
    "launch": {
        "configurations": [
            
 
        ]
    }
}
Html:
Nota;para colocar el codigo Html solamente tipea !.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <div id="app">
    {{mensaje}}
    <hr>
    <input type="button" @click="mostrar=!mostrar" value="Click">
    <input v-if="mostrar" v-model="mensaje2">
  </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
</body>
</html>

JavaScript:
const app = new Vue ({
el:"#app",
  data: {
    mensaje:"Aja",
    mensaje2:"Hola Bomboncito",
    mostrar:false
  }
})
Salida:
add_action( 'woocommerce_product_options_pricing', 'genius_set_percentage_discount' );
 
function genius_set_percentage_discount() {
   global $product_object;
   woocommerce_wp_select(
      array(
         'id' => '_pc_discount',
         'value' => get_post_meta( $product_object->get_id(), '_pc_discount', true ),
         'label' => 'Discount %',
         'options' => array(
            '0' => '0',
            '10' => '10',
            '25' => '25',
            '50' => '50',
         ),
      )
   );
}
 
add_action( 'save_post_product', 'genius_save_percentage_discount' );
   
function genius_save_percentage_discount( $product_id ) {
    global $typenow;
    if ( 'product' === $typenow ) {
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
      if ( isset( $_POST['_pc_discount'] ) ) {
            update_post_meta( $product_id, '_pc_discount', $_POST['_pc_discount'] );
        }
    }
}
  
add_filter( 'woocommerce_get_price_html', 'genius_alter_price_display', 9999, 2 );
  
function genius_alter_price_display( $price_html, $product ) {
    if ( is_admin() ) return $price_html;
    if ( '' === $product->get_price() ) return $price_html;
    if ( get_post_meta( $product->get_id(), '_pc_discount', true ) && get_post_meta( $product->get_id(), '_pc_discount', true ) > 0 ) {
        $orig_price = wc_get_price_to_display( $product );
        $price_html = wc_format_sale_price( $orig_price, $orig_price * ( 100 - get_post_meta( $product->get_id(), '_pc_discount', true ) ) / 100 );
    }
    return $price_html;
}
  
add_action( 'woocommerce_before_calculate_totals', 'genius_alter_price_cart', 9999 );
  
function genius_alter_price_cart( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
    if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return;
    foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) {
        $product = $cart_item['data'];
      if ( get_post_meta( $product->get_id(), '_pc_discount', true ) && get_post_meta( $product->get_id(), '_pc_discount', true ) > 0 ) {
           $price = $product->get_price();
           $cart_item['data']->set_price( $price * ( 100 - get_post_meta( $product->get_id(), '_pc_discount', true ) ) / 100 );
      }
    }
}
<?php include 'FILENAME';?>
<?php Pjax::begin(); 
    $gridColumns = [
[
                'attribute' => 'avance',
                'headerOptions' => ['style' => 'text-align:center; '],
                'contentOptions' => ['style' => 'text-align:center; vertical-align:middle;'],
                'format' => 'raw',
                'value' => function($model) {
                    $string = $model->observacion;
                    $wrappedString = wordwrap($string, 40, "\n");
                    return '<div style="max-height: 80px; overflow: auto; max-width: 200px;">' . nl2br($wrappedString) . '</div>';
                },
                
            ],
            [
                'attribute' => 'observacion',
                'headerOptions' => ['style' => 'text-align:center; '],
                'contentOptions' => ['style' => 'text-align:center; vertical-align:middle;'],
                'format' => 'raw',
                'value' => function($model) {
                    $string = $model->observacion;
                    $wrappedString = wordwrap($string, 40, "\n");
                    return '<div style="max-height: 80px; overflow: auto; max-width: 200px;">' . nl2br($wrappedString) . '</div>';
                },
            ],
]; ?>
    Route::get('/notification', function () {
        $documentManagerFiles = DocumentManagerFile::where('ocr_project_id', 1)->where('revision', '>', 0 )->take(5)->get();
        // dd($documentManagerFiles);
        return (new DocumentManagerFileCreatedNotification($documentManagerFiles))
                    ->toMail(Auth::user());
    });
response = zoho.people.getRecords("P_Department");
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email sent using PHP's mail() function.";
$headers = "From: sender@example.com";

if (mail($to, $subject, $message, $headers)) {
    echo "Email sent successfully.";
} else {
    echo "Email sending failed.";
}
    <?php
    $file_data = "Stuff you want to add\n";
    $file_data .= file_get_contents('database.txt');
    file_put_contents('database.txt', $file_data);
    ?>
$fp_source = fopen('database.txt', 'r');
$fp_dest = fopen('database_temp.txt', 'w'); // better to generate a real temp filename
fwrite($fp_dest, 'new content');
while (!feof($fp_source)) {
    $contents .= fread($fp_source, 8192);
    fwrite($fp_dest, $contents);
}
fclose($fp_source);
fclose($fp_dest);
unlink('database.txt');
rename('database_temp.txt','database.txt');
<?php
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
function get($url)
{
  // Initialize a CURL session.
  $ch = curl_init();

  // Return Page contents.
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

  //grab URL and pass it to the variable.
  curl_setopt($ch, CURLOPT_URL, $url);

  $result = curl_exec($ch);

  return $result;
}

$user = $_POST['user'];
$offer = $_POST['offer'];
$cname = $_POST['cname'];
$event = $_POST['event'];

$rp = get('https://nextpower.cashinmedia.in/api/v1/checkRefer/0a51d09c-f329-4436-89d5-bdbb52bea07c/' . $offer . '?number=' . $user . '');

// JSON response from the URL
$response = $rp;

// Decode the JSON response
$response_data = json_decode($response, true);

$totalClicks = $response_data['clicks'];

$count = $response_data['count'];

// Extract the 'data' section from the response
$data = $response_data['data'];

// Check if there's any data to display
if (count($data) > 0) {
  // Echo the table header
//     echo '<table border="1">
//         <tr>
//             <th>Click</th>
//             <th>User Amount</th>
//             <th>Refer Amount</th>
//             <th>User</th>
//             <th>Refer</th>
//             <th>Event</th>
//             <th>Status</th>
//             <th>Payment Status</th>
//             <th>Payment Message</th>
//             <th>Created At</th>
//         </tr>';

  //     // Loop through each data entry and display in table rows
//     foreach ($data as $entry) {
//     $userEncoded = preg_replace('/\d{5}(?=\d{4}$)/', 'xxxxx', $entry['user']);

  //     echo '<tr>';
//     echo '<td>' . $entry['click'] . '</td>';
//     echo '<td>' . $entry['userAmount'] . '</td>';
//     echo '<td>' . $entry['referAmount'] . '</td>';
//     echo '<td>' . $userEncoded . '</td>'; // Display encoded user
//     echo '<td>' . $entry['refer'] . '</td>';
//     echo '<td>' . $entry['event'] . '</td>';
//     echo '<td>' . $entry['status'] . '</td>';
//     echo '<td>' . $entry['referPaymentStatus'] . '</td>';
//     echo '<td>' . $entry['payMessage'] . '</td>';
//     echo '<td>' . $entry['createdAt'] . '</td>';
//     echo '</tr>';
// }

  //     // Close the table
//     echo '</table>';
// } else {
//     // If there's no data, show a JavaScript alert
//     echo '<script>alert("No data found.");</script>';
// }
  ?>
  <html lang="en" dir="ltr">


  <head>
    <meta charset="utf-8">
    <title>FokatCash</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap">
    <link rel="stylesheet" href="report.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" charset="utf-8"></script>
    <meta name="viewport" content="width=device-width">
  </head>
  <style>
    .data-table td,
    .data-table th {
      font-size: 17px;
      /* Adjust the value as needed */
    }

    .credited {
      color: #FFA500;
      /* Orange color */
    }
  </style>

  <body>
    <center>
      <div class="login-form">
        <h1>
          <font color='#0f0f0f'>REPORT
        </h1>
        <center>

  </body>

  </html>

  <div class="statics">
    <center><br>
      <fieldset>Refferer:
        <?php echo $user; ?>
        <hr>Camp:
        <?php echo $cname; ?>
        <hr>Total Clicks:
        <?php echo $totalClicks; ?>
        <hr>Total Conversions: <span id="totalLeads">Calculating...</span> <!-- Placeholder for total leads -->
        <hr>
        <font color="#008000"> Cashback Sent: Rs. <span id="totalAcceptedReferAmount">Calculating...</span> </font>
        <!-- Placeholder for total refer amount -->
        <hr>
        <font color="#FFA500">Pending Cashback : Rs.<span id="totalPendingReferAmount">Calculating...</span></font>
        <hr>
      </fieldset><br><br>
      <table class="data-table">
        <tr>

          <th>Camp Name</th>
          <th>Refer Amount</th>
          <!--<th>Refer Status</th>-->
          <th>Cashback Status</th>
          <th>Time</th>
        </tr>
        <?php
        foreach ($data as $entry) {
          $userEncoded = preg_replace('/\d{5}(?=\d{4}$)/', 'xxxxx', $entry['user']);
          $dateTime = new DateTime($entry['createdAt']);

          // Convert to IST timezone
          $dateTime->setTimezone(new DateTimeZone('Asia/Kolkata'));

          // Format the time in desired format
          $istTimeFormatted = $dateTime->format('Y-m-d H:i:s');

          if ($entry['referPaymentStatus'] === 'REJECTED' || $entry['referPaymentStatus'] === 'BLOCKED') {
            continue;
          }

          if ($entry['referPaymentStatus'] == 'ACCEPTED' || $entry['referPaymentStatus'] == 'UNKNOWN' || $entry['referPaymentStatus'] == 'FAILURE') {
            $cashbackStatus = '<b><span style="color: #198754;">Credited</span></b>';
          } elseif ($entry['referPaymentStatus'] == 'PENDING') {
            $cashbackStatus = '<b><span style="color: #FFA500;">Processing</span></b>';
          } else {
            // Handle other cases or set a default value for $cashbackStatus
            // For example: $cashbackStatus = 'Unknown Status';
            $cashbackStatus = $entry['referPaymentStatus'];
          }


          if ($entry['referAmount'] > 0) {
            echo '<tr>';
            // echo '<td>' . $entry['click'] . '</td>';
            // echo '<td>' . $entry['userAmount'] . '</td>';
            echo '<td>' . $cname . '</td>';
            echo '<td>' . $entry['referAmount'] . '</td>';
            // echo '<td>' . $userEncoded . '</td>'; // Display encoded user
            // echo '<td>' . $entry['refer'] . '</td>';
            // echo '<td>' . $entry['event'] . '</td>';
            // echo '<td>' . $entry['status'] . '</td>';
            echo '<td>' . $cashbackStatus . '</td>';
            // echo '<td>' . $entry['payMessage'] . '</td>';
            echo '<td>' . $istTimeFormatted . '</td>';
            echo '</tr>';
          }
        }
        // Close the table
        echo '</table>';
} else {
  // If there's no data, show a JavaScript alert
  ?>
        <html lang="en" dir="ltr">


        <head>
          <meta charset="utf-8">
          <title>FokatCash</title>
          <link rel="stylesheet"
            href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap">
          <link rel="stylesheet" href="report.css">
          <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" charset="utf-8"></script>
          <meta name="viewport" content="width=device-width">
        </head>
        <style>
          .data-table td,
          .data-table th {
            font-size: 17px;
            /* Adjust the value as needed */
          }

          .credited {
            color: #FFA500;
            /* Orange color */
          }
        </style>

        <body>
          <center>
            <div class="login-form">
              <h1>
                <font color='#0f0f0f'>REPORT
              </h1>
              <center>

        </body>

        </html>

        <div class="statics">
          <center><br>
            <fieldset>Refferer:
              <?php echo $user; ?>
              <hr>Camp:
              <?php echo $cname; ?>
              <hr>Total Clicks:
              <?php echo $totalClicks; ?>
              <hr>Total Conversions: <span id="totalLeads">Calculating...</span> <!-- Placeholder for total leads -->
              <hr>
              <font color="#008000"> Cashback Sent: Rs. <span id="totalAcceptedReferAmount">Calculating...</span> </font>
              <!-- Placeholder for total refer amount -->
              <hr>
              <font color="#FFA500">Pending Cashback : Rs.<span id="totalPendingReferAmount">Calculating...</span></font>
              <hr>
            </fieldset><br><br>

            <h5>No data Found</h5>
            <?php


}
?>
    </table>
    <!-- ... Your existing code ... -->
    <script>
  // JavaScript to calculate and display the total leads count and total refer amounts
  document.addEventListener("DOMContentLoaded", function () {
    // Calculate the total leads count and total refer amounts based on the payment statuses and refer amount conditions
    var totalLeads = 0;
    var totalAcceptedReferAmount = 0;
    var totalPendingReferAmount = 0;
    var totalFailedReferAmount = 0;
    var totalUnknownReferAmount = 0;
    var event = "<?php echo $event; ?>";

    <?php foreach ($data as $entry): ?>
      <?php if ($entry['referPaymentStatus'] !== 'REJECTED' && $entry['referPaymentStatus'] !== 'BLOCKED' && $entry['referAmount'] > 0): ?>
        totalLeads++;
        <?php if ($entry['referPaymentStatus'] === 'ACCEPTED'): ?>
          totalAcceptedReferAmount += parseFloat(<?php echo $entry['referAmount']; ?>);
        <?php elseif ($entry['referPaymentStatus'] === 'PENDING'): ?>
          totalPendingReferAmount += parseFloat(<?php echo $entry['referAmount']; ?>);
        <?php elseif ($entry['referPaymentStatus'] === 'FAILURE'): ?>
          totalFailedReferAmount += parseFloat(<?php echo $entry['referAmount']; ?>);
        <?php elseif ($entry['referPaymentStatus'] === 'UNKNOWN'): ?>
          totalUnknownReferAmount += parseFloat(<?php echo $entry['referAmount']; ?>);
        <?php endif; ?>
      <?php endif; ?>
    <?php endforeach; ?>

    // Update the HTML content to display the calculated totals
    var totalLeadsElement = document.getElementById("totalLeads");
    totalLeadsElement.textContent = totalLeads;

    var totalAcceptedReferAmountElement = document.getElementById("totalAcceptedReferAmount");
    totalAcceptedReferAmountElement.textContent = totalAcceptedReferAmount.toFixed(2);

    var totalPendingReferAmountElement = document.getElementById("totalPendingReferAmount");
    totalPendingReferAmountElement.textContent = totalPendingReferAmount.toFixed(2);

    var totalFailedReferAmountElement = document.getElementById("totalFailedReferAmount");
    totalFailedReferAmountElement.textContent = totalFailedReferAmount.toFixed(2);

    var totalUnknownReferAmountElement = document.getElementById("totalUnknownReferAmount");
    totalUnknownReferAmountElement.textContent = totalUnknownReferAmount.toFixed(2);
  });
</script>



    <br><br><br>
    <footer id="footer">
      <div class="copyright">
        &copy; Copyright <strong><span>FokatCash</span></strong>
      </div>
    </footer><!-- End Footer -->
</div><!-- End statics div -->
</center><!-- End center div -->
</body><!-- End body tag -->

</html><!-- End HTML document -->
/**
 * Add activity ratio.
 */
function add_activity_ratio() {
  /** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $schema_repository */
  $schema_repository = \Drupal::service('entity.last_installed_schema.repository');
  /** @var Drupal\Core\Entity\EntityTypeBundleInfo $entity_bundle_info */
  $entity_bundle_info = \Drupal::service('entity_type.bundle.info');
  /** @var Drupal\Core\Entity\EntityFieldManager $entity_field_manager */
  $entity_field_manager = \Drupal::service('entity_field.manager');
  $definitions = \Drupal::entityTypeManager()->getDefinitions();
  $entities = [];
  foreach ($definitions as $entity_type_id => $definition) {
    if (!$definition instanceof ConfigEntityType) {
      $entities[] = $entity_type_id;
    }
  }
  $spec = [
    'type' => 'numeric',
    'unsigned' => TRUE,
    'precision' => 5,
    'scale' => 2,
  ];
  $database = \Drupal::database();
  $schema = $database->schema();
  foreach ($entities as $entity_type_id) {
    $bundles = $entity_bundle_info->getBundleInfo($entity_type_id);
    foreach ($bundles as $bundle_id => $bundle) {
      $field_definitions = $entity_field_manager->getFieldDefinitions($entity_type_id, $bundle_id);
      foreach ($field_definitions as $field_definition) {
        if ($field_definition->getType() === 'pos_nace_field_type') {
          /** @var Drupal\field\Entity\FieldStorageConfig $storage */
          $storage = $field_definition->getFieldStorageDefinition();
          $storage->setSetting('activity_ratio', FALSE);
          $key_value = \Drupal::keyValue('entity.storage_schema.sql');
          $key_name = $entity_type_id . '.field_schema_data.' . $field_definition->getName();
          $storage_schema = $key_value->get($key_name);
          if ($storage instanceof FieldStorageConfig || $storage->isMultiple()) {
            foreach ([
              $entity_type_id . '__' . $field_definition->getName(),
              $entity_type_id . '_revision' . '__' . $field_definition->getName(),
            ] as $table) {
              $field_name = $field_definition->getName();
              if ($schema->tableExists($table) && !$schema->fieldExists($table, $field_name . '_activity_ratio')) {
                $schema->addField($table, $field_name . '_activity_ratio', $spec);
              }
            }
          }
          else {
            $table = $entity_type_id . '_field_data';
            $field_name = $field_definition->getName();
            if ($schema->tableExists($table) && !$schema->fieldExists($table, $field_name . '__activity_ratio')) {
              $schema->changeField($table, $field_name, $field_name . '__value', [
                'type' => 'varchar',
                'length' => 255,
                'binary' => FALSE,
              ]);
              $schema->addField($table, $field_name . '__activity_ratio', $spec);
              $storage_schema[$table]['fields'][$field_name . '__value'] = [
                'type' => 'varchar',
                'length' => 255,
                'binary' => FALSE,
              ];
              if (isset($storage_schema[$table]['fields'][$field_name])) {
                unset($storage_schema[$table]['fields'][$field_name]);
              }
              $storage_schema[$table]['fields'][$field_name . '__activity_ratio'] = $spec;
            }
          }
          $schema_repository->setLastInstalledFieldStorageDefinition($storage);
          $key_value->set($key_name, $storage_schema);
        }
      }
    }
  }
}
<?php
$month = date('m');
$year = date('Y');

// Get the first day of the month
$firstDayOfMonth = mktime(0, 0, 0, $month, 1, $year);

// Number of days in the month
$numberDays = date('t', $firstDayOfMonth);

// Get the name of the month
$monthName = date('F', $firstDayOfMonth);

// Get the day of the week for the first day of the month
$dayOfWeek = date('D', $firstDayOfMonth);

// Create a table to organize the calendar
echo "<h1>$monthName $year</h1>";
echo "<table>";
echo "<tr><th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th></tr><tr>";

// Pad the calendar with empty cells if the month doesn't start on a Sunday
if($dayOfWeek != 'Sun') {
  $blankDaysBefore = date('w', $firstDayOfMonth);
  for($i = 0; $i < $blankDaysBefore; $i++) {
    echo "<td></td>";
  }
}

// Fill in the rest of the calendar with the days of the month
for($dayCounter = 1; $dayCounter <= $numberDays; $dayCounter++) {
  $currentDay = mktime(0, 0, 0, $month, $dayCounter, $year);
  if(date('w', $currentDay) == 0) {
    echo "</tr><tr>";
  }
  echo "<td>$dayCounter</td>";
}

echo "</tr></table>";
?>
 $j==10<?php
for($i=1;$i<=10;$i++) {
    for($j=1;$j<=10;$j++) {
        if(($i==1 && $j>5) || ($i==10 && $j<=5) || ($j==1 && $i<=5) || ( $j==10 &&  $i>5) || ($j==5) || ($i==5) ) {
            echo "*  ";
        } else {
            echo "   ";
        }
    }
    echo "\n";
}
?>
********************************front-page.php********************************
<div class="popular-products">
    <?php echo do_shortcode('[products limit="4" orderby="popularity"]'); ?>
</div>

********************************function.php********************************
// Customize the classes inside the <ul> element for the products list.
function custom_woocommerce_product_loop_start($loop_output) {
    // Add custom classes to the <ul> element.
    $loop_output = str_replace('products', 'products custom-ul-class', $loop_output);
    return $loop_output;
}
add_filter('woocommerce_product_loop_start', 'custom_woocommerce_product_loop_start', 10, 1);
********************************style.css********************************

/* Custom styles for the popular products list */
ul.products.custom-ul-class {
    /* Add your custom styles here */
}

/**
 * Custom Fonts
 */

 function enqueue_custom_fonts() {
if(!is_admin()) {
wp_register_style('source_sans_pro','https://fonts.googleapis.com/css2?family=Indie+Flower&family=Montserrat:wght@900&family=Roboto:ital,wght@0,400;0,700;1,300;1,400&display=swap' );
wp_register_style('nunito','https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,700;1,400;1,700&display=swap' );
wp_enqueue_style('source_sans_pro' );
wp_enqueue_style('nunito' );
};
};

add_action('wp_enqueue_scripts','enqueue_custom_fonts');
// [current_user_display_name]
function display_current_user_display_name () {
    $user = wp_get_current_user();
    $display_name = $user->display_name;
    return $user->display_name;
}
add_shortcode('current_user_display_name', 'display_current_user_display_name');
#!/bin/bash

# Crea la base de datos
createdb 'nombre_de_tu_base_de_datos'

# Conecta a la base de datos
psql 'nombre_de_tu_base_de_datos' << EOF

# Crea la tabla
CREATE TABLE 'nombre_de_tu_tabla' (
  'nombre_de_tu_columna_1' tipo_de_dato_1,
  'nombre_de_tu_columna_2' tipo_de_dato_2,
  'nombre_de_tu_columna_3' tipo_de_dato_3,
  ...
);

# Sal del cliente de PostgreSQL
\q

EOF
#!/bin/bash

# Crea la base de datos
createdb 'nombre_de_tu_base_de_datos'

# Conecta a la base de datos
psql 'nombre_de_tu_base_de_datos' << EOF

# Crea la tabla
CREATE TABLE 'nombre_de_tu_tabla' (
  'nombre_de_tu_columna_1' tipo_de_dato_1,
  'nombre_de_tu_columna_2' tipo_de_dato_2,
  'nombre_de_tu_columna_3' tipo_de_dato_3,
  ...
);

# Sal del cliente de PostgreSQL
\q

EOF
//INDEX.PHP
<?php session_start();
//when login button pushed
if (isset($_POST['login'])){
//    if username and password not empty
    if (!empty($_POST['username']) && !empty($_POST['password'])){
//        store
        $_SESSION['username']  = $_POST["username"];
        $_SESSION['password']  = $_POST["password"];
//    take you to home.php
        header("Location: home.php");
    }else{
        echo "Missing username or password";
    }
}

?>
  
  
  
  
  //HOME.PHP
  <?php
session_start();
//if logout pressed
if (isset($_POST['logout'])){
//    destroys session
    session_destroy();
//    rerouts you to index
    header("Location: index.php");
}
echo $_SESSION['username'] . "<br>";
echo $_SESSION['password'] . "<br>";;



?>
<?php

setcookie("fav_food","pizza", time() + (86400 * 2), "/");
setcookie("fav_drink","water", time() + (86400 * 3), "/");
setcookie("fav_dessert","cookies", time() + (86400 * 4), "/");

foreach ($_COOKIE as $key => $value){
    echo "{$key} = {$value} <br>";
}


if (isset($_COOKIE['fav_food'])){
    echo "BUY SOME {$_COOKIE['fav_food']}";
}else{
    echo "I dont know ypu fav food";
}
<?php
    if (isset($_POST['submit'])){
        $username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_SPECIAL_CHARS);
        echo "Hello {$username}";
    }
?>

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <form action="index.php" method="post">
        <input type="text" name="username" id="username">
        <input type="submit" name="submit">
    </form>

</body>

</html>
<?php
$result = null;
if(isset($_POST['submit'])) {

   $foods = $_POST['foods'];

   foreach ($foods as $food){
       echo "You like {$food} <br>";
   }
}

?>



<form action="index.php" method="post">
    <input type="checkbox" name="foods[]" value="pizza"> pizza <br>
    <input type="checkbox" name="foods[]" value="hamburger">Hamburger <br>
    <input type="checkbox" name="foods[]" value="hotdog"> hotdog <br>
    <input type="checkbox" name="foods[]" value="taco"> taco <br>

    <input type="submit" value="Submit" name="submit">
</form>
sudo apt-get clean all
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update --fix-missing
sudo apt-get upgrade

instalar dependencias faltantes 
sudo apt -f install
 $taxonomy = 'product_cat'; 
   $primary_cat_id=get_post_meta($product->id,'_yoast_wpseo_primary_' . $taxonomy, true);
    if($primary_cat_id){
       $primary_cat = get_term($primary_cat_id, $taxonomy);
       if(isset($primary_cat->name)) 
           echo $primary_cat->name;
    }
/wp-admin/admin-ajax.php?action=function_name
<?php
// Enter your code here, enjoy!
// function calculateDistance($lat1, $lon1, $lat2, $lon2) {
//     // approximate radius of Earth in km
//     $R = 6371.0;

//     // convert degrees to radians
//     $lat1 = deg2rad($lat1);
//     $lon1 = deg2rad($lon1);
//     $lat2 = deg2rad($lat2);
//     $lon2 = deg2rad($lon2);

//     // calculate the differences in latitude and longitude
//     $dlat = $lat2 - $lat1;
//     $dlon = $lon2 - $lon1;

//     // apply the Haversine formula
//     $a = sin($dlat / 2) ** 2 + cos($lat1) * cos($lat2) * sin($dlon / 2) ** 2;
//     $c = 2 * atan2(sqrt($a), sqrt(1 - $a));

//     // calculate the distance
//     $distance = $R * $c;

//     return $distance;
// }

// // Array of coordinates
// $coordinates = array(
//     array(-14.537804, 40.672439, "NA1"),  // NA1
//     array(-14.532698, 40.674953, "NA2"),  // NA2
//     array(-14.529319, 40.675874, "NA3"),  // NA3
//     array(-14.523059, 40.675931, "NA4"),  // NA4
//     array(-14.459071, 40.674796, "NB5"),  // NB5
//     array(-14.460408, 40.678548, "NB6"),  // NB6
//     array(-14.461540, 40.680757, "NB7")   // NB7
// );

// // Calculate distances between points
// $pointCount = count($coordinates);
// for ($i = 0; $i < $pointCount - 1; $i++) {
//     $coord1 = $coordinates[$i];
//     $coord2 = $coordinates[$i + 1];
    
//     $j = $i + 1;

//     $lat1 = $coord1[0];
//     $lon1 = $coord1[1];
//     $lat2 = $coord2[0];
//     $lon2 = $coord2[1];

//     $distance = calculateDistance($lat1, $lon1, $lat2, $lon2);
//     echo "Distance between point {$coord1[2]} and point {$coord2[2]}: {$distance} km\n";
// }


function calculateDistance($lat1, $lon1, $lat2, $lon2) {
    // approximate radius of Earth in km
    $R = 6371.0;

    // convert degrees to radians
    $lat1 = deg2rad($lat1);
    $lon1 = deg2rad($lon1);
    $lat2 = deg2rad($lat2);
    $lon2 = deg2rad($lon2);

    // calculate the differences in latitude and longitude
    $dlat = $lat2 - $lat1;
    $dlon = $lon2 - $lon1;

    // apply the Haversine formula
    $a = sin($dlat / 2) ** 2 + cos($lat1) * cos($lat2) * sin($dlon / 2) ** 2;
    $c = 2 * atan2(sqrt($a), sqrt(1 - $a));

    // calculate the distance
    $distance = $R * $c;

    return $distance;
}

// Array of coordinates
$coordinates = array(
    array(-14.537804, 40.672439, 'NA1'),
    array(-14.532698, 40.674953, 'NA2'),
    array(-14.529319, 40.675874, 'NA3'),
    array(-14.523059, 40.675931, 'NA4'),
    array(-14.459071, 40.674796, 'NB5'),
    array(-14.460408, 40.678548, 'NB6'),
    array(-14.461540, 40.680757, 'NB7')
);

// Calculate distances between each point
$pointCount = count($coordinates);
for ($i = 0; $i < $pointCount - 1; $i++) {
    $coord1 = $coordinates[$i];
    $lat1 = $coord1[0];
    $lon1 = $coord1[1];

    for ($j = $i + 1; $j < $pointCount; $j++) {
        $coord2 = $coordinates[$j];
        $lat2 = $coord2[0];
        $lon2 = $coord2[1];

        $distance = calculateDistance($lat1, $lon1, $lat2, $lon2);
        echo "Distance between point {$coord1[2]} and point {$coord2[2]}: {$distance} km\n";
    }
}

$digits = 3;
echo rand(pow(10, $digits-1), pow(10, $digits)-1);
 if (!defined('ABSPATH')) exit;

    new My_Cron();

    class My_Cron {

        public function __construct() {
            add_filter('cron_schedules', array($this, 'cron_time_intervals'));
            add_action( 'wp',  array($this, 'cron_scheduler'));
            add_action( 'cast_my_spell', array( $this, 'auto_spell_cast' ) );
        }

        public function cron_time_intervals($schedules)
        {
            $schedules['minutes_10'] = array(
                'interval' => 10 * 60,
                'display' => 'Once 10 minutes'
            );
            return $schedules;
        }

        function cron_scheduler() {
            if ( ! wp_next_scheduled( 'cast_my_spell' ) ) {
                wp_schedule_event( time(), 'minutes_10', 'cast_my_spell');
            }
        }

        function auto_spell_cast(){
            My_Plugin_Class::instance()->launch_spell();
        }
    }
cntrl + shift + t: abrir una ventana del navegador que ya habias cerrado con anterioridad
windows + l: bloquea el ordenador y guarda todo el trabajo
;MainWP Requriement - cURL timeout
default_socket_timeout = 300
;END MainWP Requriement
  // Only from inside the same class
  $this->processSomething([__CLASS__, 'myStaticCallback']);
  // From either inside or outside the same class
  $myObject->processSomething(['\Namespace\MyClass', 'myStaticCallback']);
  $myObject->processSomething(['\Namespace\MyClass::myStaticCallback']); // PHP 5.2.3+
  $myObject->processSomething([MyClass::class, 'myStaticCallback']); // PHP 5.5.0+
get_intermediate_image_sizes(); // get all the image size names.
wp_get_additional_image_sizes(); // get all the additional image size data.
wp_get_registered_image_subsizes(); // get all the image size data.
$post_id = wp_insert_post(array (
   'post_type' => 'your_post_type',
   'post_title' => $your_title,
   'post_content' => $your_content,
   'post_status' => 'publish',
   'comment_status' => 'closed',
   'ping_status' => 'closed',
   'meta_input' => array(
      '_your_custom_1' => $custom_1,
      '_your_custom_2' => $custom_2,
      '_your_custom_3' => $custom_3,
    ),
));
$post_id = wp_insert_post(array (
   'post_type' => 'your_post_type',
   'post_title' => $your_title,
   'post_content' => $your_content,
   'post_status' => 'publish',
   'comment_status' => 'closed',
   'ping_status' => 'closed',
   'meta_input' => array(
      '_your_custom_1' => $custom_1,
      '_your_custom_2' => $custom_2,
      '_your_custom_3' => $custom_3,
    ),
));
$files = scandir('/some/random/folder') ?: [];
$user = $_POST['user'] ?? $_SESSION['user'] ?? $_COOKIE['user'] ?? '';
<?php
    var_dump(5 ?: 0); // 5
    var_dump(false ?: 0); // 0
    var_dump(null ?: 'foo'); // 'foo'
    var_dump(true ?: 123); // true
    var_dump('rock' ?: 'roll'); // 'rock'
?>
   function save_function()
{

    $subject_term = 'subject';
    $my_subject_term = term_exists($subject_term, 'my_custom_taxonomy');   // check if term in website or no
    // Create Term if it doesn't exist
    if (!$my_subject_term) {
        $my_subject_term = wp_insert_term($subject_term, 'my_custom_taxonomy');
    }
    $custom_tax = array(
        'my_custom_taxonomy' => array(
            $my_subject_term['term_taxonomy_id'],
        )
    );

    // MESSAGE FIELDS
    $public_post = array(
        'post_title' => filter_input(INPUT_POST, 'title'),
        'post_author' => 1,
        'post_type' => 'message',
        'post_status' => 'pending',
        'tax_input' => $custom_tax
    );

    $post_id = wp_insert_post($public_post);

    
}
Supongamos que estamos desarrollando una aplicación de gestión de proyectos. Cada proyecto tiene un solo gerente, pero un gerente puede estar a cargo de varios proyectos. Además, cada proyecto puede tener varios miembros del equipo, y cada miembro del equipo puede estar asignado a varios proyectos.

1.-modelo(app/models/Proyecto.php)

<?php

namespace app\models;

use yii\db\ActiveRecord;

class Proyecto extends ActiveRecord
{
    public static function tableName()
    {
        return 'proyectos';
    }

    public function getGerente()
    {
        return $this->hasOne(Gerente::className(), ['id' => 'id_gerente']);
    }

    public function getMiembrosEquipo()
    {
        return $this->hasMany(MiembroEquipo::className(), ['id_proyecto' => 'id']);
    }
}

En este ejemplo, estamos creando un modelo llamado Proyecto que extiende de la clase ActiveRecord de Yii2. Este modelo representa la tabla proyectos de la base de datos PostgreSQL y tiene una relación de uno a uno con la tabla gerentes y una relación de uno a muchos con la tabla miembros_equipo.

2.-Modelo(app/models/Gerente.php)

<?php

namespace app\models;

use yii\db\ActiveRecord;

class Gerente extends ActiveRecord
{
    public static function tableName()
    {
        return 'gerentes';
    }

    public function getProyectos()
    {
        return $this->hasMany(Proyecto::className(), ['id_gerente' => 'id']);
    }
}

En este ejemplo, estamos creando un modelo llamado Gerente que extiende de la clase ActiveRecord de Yii2. Este modelo representa la tabla gerentes de la base de datos PostgreSQL y tiene una relación de uno a muchos con la tabla proyectos.


3.-Modelo(app/models/MiembroEquipo.php)

<?php

namespace app\models;

use yii\db\ActiveRecord;

class MiembroEquipo extends ActiveRecord
{
    public static function tableName()
    {
        return 'miembros_equipo';
    }

    public function getProyecto()
    {
        return $this->hasOne(Proyecto::className(), ['id' => 'id_proyecto']);
    }

    public function getEmpleado()
    {
        return $this->hasOne(Empleado::className(), ['id' => 'id_empleado']);
    }
}

En este ejemplo, estamos creando un modelo llamado MiembroEquipo que extiende de la clase ActiveRecord de Yii2. Este modelo representa la tabla miembros_equipo de la base de datos PostgreSQL y tiene una relación de uno a uno con la tabla proyectos y una relación de uno a uno con la tabla empleados.


4.-Modelo(app/models/Empleado.php)

<?php

namespace app\models;

use yii\db\ActiveRecord;

class Empleado extends ActiveRecord
{
    public static function tableName()
    {
        return 'empleados';
    }

    public function getMiembrosEquipo()
    {
        return $this->hasMany(MiembroEquipo::className(), ['id_empleado' => 'id']);
    }
}

En este ejemplo, estamos creando un modelo llamado Empleado que extiende de la clase ActiveRecord de Yii2. Este modelo representa la tabla empleados de la base de datos PostgreSQL y tiene una relación de uno a muchos con la tabla miembros_equipo.

5.-Controlador(app/controllers/ProyectoController.php)

<?php

namespace app\controllers;

use yii\web\Controller;
use app\models\Proyecto;

class ProyectoController extends Controller
{
    public function actionIndex()
    {
        $proyectos = Proyecto::find()->with('gerente', 'miembrosEquipo.empleado')->all();
        return $this->render('index', ['proyectos' => $proyectos]);
 }
}

En este ejemplo, estamos creando un controlador llamado ProyectoController que tiene un método llamado actionIndex que se encarga de obtener todos los proyectos de la base de datos y sus relaciones con gerentes y miembros del equipo utilizando los modelos Proyecto, Gerente, MiembroEquipo y Empleado. Luego, se renderiza la vista index y se le pasa como parámetro los proyectos obtenidos.

6.-Vista(app/views/proyecto/index.php)

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Nombre</th>
            <th>Gerente</th>
            <th>Miembros del equipo</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($proyectos as $proyecto): ?>
            <tr>
                <td><?= $proyecto->id ?></td>
                <td><?= $proyecto->nombre ?></td>
                <td><?= $proyecto->gerente->nombre ?></td>
                <td>
                    <ul>
                        <?php foreach ($proyecto->miembrosEquipo as $miembroEquipo): ?>
                            <li><?= $miembroEquipo->empleado->nombre ?></li>
                        <?php endforeach ?>
                    </ul>
                </td>
            </tr>
        <?php endforeach ?>
    </tbody>
</table>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
    $(document).ready(function() {
        // Código de jQuery aquí
    });
</script>

En este ejemplo, estamos creando una vista llamada index que muestra una tabla con los proyectos, sus gerentes y sus miembros del equipo. También estamos incluyendo la librería de jQuery y un bloque de código jQuery vacío que se ejecutará cuando el DOM esté listo.

7.-Codigo Jquery (app/web/js/mi-script.js)

En este ejemplo, estamos utilizando jQuery para hacer una petición AJAX al servidor cuando el usuario hace clic en una fila de la tabla de proyectos. La petición se realiza al controlador ProyectoController y al método actionGet, que se encarga de obtener los detalles del proyecto con el ID especificado y devolverlos en formato JSON.
Recuerda que debes ajustar los nombres de los archivos y las rutas según la estructura de tu aplicación Yii2 y PostgreSQL.
Espero que esto te ayude a entender cómo podrías implementar relaciones de 1 a 1, 0 a 1 y muchos a muchos utilizando Yii2, PostgreSQL, MVC, OOP y jQuery.

8.- código SQL para crear las tablas utilizadas en el ejemplo de la aplicación web que utiliza Yii2, PostgreSQL, MVC, OOP y jQuery para implementar relaciones de 1 a 1, 0 a 1 y muchos a muchos:

Tabla proyectos ()
CREATE TABLE proyectos (
    id SERIAL PRIMARY KEY,
    nombre VARCHAR(255) NOT NULL,
    id_gerente INTEGER REFERENCES gerentes(id)
);

En esta tabla, estamos creando un campo id que es una clave primaria autoincremental, un campo nombre que almacena el nombre del proyecto y un campo id_gerente que es una clave foránea que hace referencia al campo id de la tabla gerentes.

9.-tabla gerentes

CREATE TABLE gerentes (
    id SERIAL PRIMARY KEY,
    nombre VARCHAR(255) NOT NULL
);

En esta tabla, estamos creando un campo id que es una clave primaria autoincremental y un campo nombre que almacena el nombre del gerente.

10.- tabla miembros_equipo

CREATE TABLE miembros_equipo (
    id_proyecto INTEGER REFERENCES proyectos(id),
    id_empleado INTEGER REFERENCES empleados(id),
    PRIMARY KEY (id_proyecto, id_empleado)
);

En esta tabla, estamos creando dos campos id_proyecto e id_empleado que son claves foráneas que hacen referencia a los campos id de las tablas proyectos y empleados, respectivamente. Además, estamos creando una clave primaria compuesta por ambos campos para asegurarnos de que no haya duplicados.

11.-tabla empleados

CREATE TABLE empleados (
    id SERIAL PRIMARY KEY,
    nombre VARCHAR(255) NOT NULL
);

En esta tabla, estamos creando un campo id que es una clave primaria autoincremental y un campo nombre que almacena el nombre del empleado.

Recuerda que debes ajustar los nombres de las tablas y los campos según la estructura de tu aplicación. Además, debes asegurarte de que las claves foráneas estén correctamente definidas y que las relaciones entre las tablas sean coherentes.

posibles consultas que podrías hacer utilizando el código SQL de la aplicación web que utiliza Yii2, PostgreSQL, MVC, OOP y jQuery para implementar relaciones de 1 a1, 0 a 1 y muchos a muchos:

1.-Obtener todos los proyectos con sus gerentes y miembros del equipo:

SELECT p.nombre AS proyecto, g.nombre AS gerente, e.nombre AS empleado
FROM proyectos p
LEFT JOIN gerentes g ON p.id_gerente = g.id
LEFT JOIN miembros_equipo me ON p.id = me.id_proyecto
LEFT JOIN empleados e ON me.id_empleado = e.id;

En esta consulta, estamos obteniendo todos los proyectos con sus gerentes y miembros del equipo utilizando las tablas proyectos, gerentes, miembros_equipo y empleados. Estamos utilizando un LEFT JOIN para asegurarnos de que se incluyan todos los proyectos, incluso aquellos que no tienen gerente o miembros del equipo.


2.-Obtener todos los proyectos que tienen un gerente asignado:

SELECT p.nombre AS proyecto, g.nombre AS gerente
FROM proyectos p
INNER JOIN gerentes g ON p.id_gerente = g.id;

En esta consulta, estamos obteniendo todos los proyectos que tienen un gerente asignado utilizando las tablas proyectos y gerentes. Estamos utilizando un INNER JOIN para asegurarnos de que solo se incluyan los proyectos que tienen un gerente asignado.

3.-Obtener todos los proyectos en los que trabaja un empleado específico:

SELECT p.nombre AS proyecto, e.nombre AS empleado
FROM proyectos p
INNER JOIN miembros_equipo me ON p.id = me.id_proyecto
INNER JOIN empleados e ON me.id_empleado = e.id
WHERE e.nombre = 'Juan';

En esta consulta, estamos obteniendo todos los proyectos en los que trabaja un empleado específico utilizando las tablas proyectos, miembros_equipo y empleados. Estamos utilizando un INNER JOIN para asegurarnos de que solo se incluyan los proyectos en los que trabaja el empleado específico y estamos utilizando una cláusula WHERE para filtrar por el nombre del empleado.

4.-Obtener todos los empleados que trabajan en un proyecto específico:

SELECT e.nombre AS empleado
FROM empleados e
INNER JOIN miembros_equipo me ON e.id = me.id_empleado
INNER JOIN proyectos p ON me.id_proyecto = p.id
WHERE p.nombre = 'Proyecto A';

En esta consulta, estamos obteniendo todos los empleados que trabajan en un proyecto específico utilizando las tablas empleados, miembros_equipo y proyectos. Estamos utilizando un INNER JOIN para asegurarnos de que solo se incluyan los empleados que trabajan en el proyecto específico y estamos utilizando una cláusula WHERE para filtrar por el nombre del proyecto.
Recuerda que debes ajustar las consultas según la estructura de tu aplicación y las relaciones entre las tablas.

{
   error: {
     message: "Unauthorized"
   }
}


If you removed Auth middleware but still getting unauthorized means there may be route cache. Try using php artisan route:clear and check.


<?php

function isSubstring($string, $substring) 
{
    return strpos($string, $substring) !== false;
}

// Usage example:
$mainString = "Hello, World!";
$substring = "World";
if (isSubstring($mainString, $substring)) {
    echo "The substring '$substring' is found in the main string.";
} else {
    echo "The substring '$substring' is not found in the main string.";
}
function custom_add_attribute_thumbnail_field( $term ) {
    $thumbnail_id = get_term_meta( $term->term_id, '_thumbnail_id', true );
    $image_url = wp_get_attachment_image_url( $thumbnail_id, 'thumbnail' ); // Imposta la dimensione dell'immagine desiderata (esempio: 'thumbnail', 'medium', 'large')
    ?>
    <tr class="form-field">
        <th scope="row" valign="top"><label for="attribute_thumbnail"><?php esc_html_e( 'Attribute Thumbnail', 'text-domain' ); ?></label></th>
        <td>
            <div id="attribute_thumbnail_preview">
                <?php if ( $image_url ) : ?>
                    <img src="<?php echo esc_url( $image_url ); ?>" alt="<?php echo esc_attr( $term->name ); ?>" style="max-width:100px; max-height:100px;">
                <?php endif; ?>
            </div>
            <input type="hidden" id="attribute_thumbnail" name="attribute_thumbnail" value="<?php echo esc_attr( $thumbnail_id ); ?>">
            <button type="button" id="upload_attribute_thumbnail_button" class="button"><?php esc_html_e( 'Upload/Add image', 'text-domain' ); ?></button>
            <button type="button" id="remove_attribute_thumbnail_button" class="button"><?php esc_html_e( 'Remove image', 'text-domain' ); ?></button>
            <script>
                jQuery(document).ready(function($) {
                    // Carica l'immagine
                    $('#upload_attribute_thumbnail_button').click(function() {
                        var custom_uploader = wp.media({
                            title: '<?php esc_html_e( "Choose or Upload Image", "text-domain" ); ?>',
                            button: {
                                text: '<?php esc_html_e( "Use Image", "text-domain" ); ?>'
                            },
                            multiple: false
                        }).on('select', function() {
                            var attachment = custom_uploader.state().get('selection').first().toJSON();
                            $('#attribute_thumbnail').val(attachment.id);
                            $('#attribute_thumbnail_preview').html('<img src="' + attachment.url + '" alt="<?php echo esc_attr( $term->name ); ?>" style="max-width:100px; max-height:100px;">');
                        }).open();
                    });

                    // Rimuovi l'immagine
                    $('#remove_attribute_thumbnail_button').click(function() {
                        $('#attribute_thumbnail').val('');
                        $('#attribute_thumbnail_preview').html('');
                    });
                });
            </script>
            <p class="description"><?php esc_html_e( 'Upload or select an image to set as the attribute thumbnail.', 'text-domain' ); ?></p>
        </td>
    </tr>
    <?php
}
add_action( 'pa_attributo_add_form_fields', 'custom_add_attribute_thumbnail_field', 10, 2 );
add_action( 'pa_attributo_edit_form_fields', 'custom_add_attribute_thumbnail_field', 10, 2 );

function custom_save_attribute_thumbnail( $term_id ) {
    if ( isset( $_POST['attribute_thumbnail'] ) ) {
        $thumbnail_id = absint( $_POST['attribute_thumbnail'] );
        update_term_meta( $term_id, '_thumbnail_id', $thumbnail_id );
    }
}
add_action( 'edited_pa_attributo', 'custom_save_attribute_thumbnail', 10, 2 );
  <?php
  $taxonomy     = 'product_cat';
  $orderby      = 'menu_order';  
  $show_count   = 0;      // 1 for yes, 0 for no
  $pad_counts   = 0;      // 1 for yes, 0 for no
  $hierarchical = 1;      // 1 for yes, 0 for no  
  $title        = '';  
  $empty        = 0;

  $args = array(
         'taxonomy'     => $taxonomy,
         'orderby'      => $orderby,
         'show_count'   => $show_count,
         'pad_counts'   => $pad_counts,
         'hierarchical' => $hierarchical,
         'title_li'     => $title,
         'hide_empty'   => $empty
  );
 $all_categories = get_categories( $args );
 foreach ($all_categories as $cat) {
    if($cat->category_parent == 0) {
        $category_id = $cat->term_id;       
        //echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';

        $args2 = array(
                'taxonomy'     => $taxonomy,
                'child_of'     => 0,
                'parent'       => $category_id,
                'orderby'      => $orderby,
                'show_count'   => $show_count,
                'pad_counts'   => $pad_counts,
                'hierarchical' => $hierarchical,
                'title_li'     => $title,
                'hide_empty'   => $empty
        );
        $sub_cats = get_categories( $args2 );
        if($sub_cats) {
            foreach($sub_cats as $sub_category) {
                // echo  $sub_category->name ;
                 echo '<br /><a href="'. get_term_link($sub_category->slug, 'product_cat') .'">'. $sub_category->name .'</a>';
                echo '<br /><a href="'. get_term_link($sub_category->slug, 'product_cat') .'">'. $sub_category->name .'</a>';
            }   
        }
    }       
}
?>
//Disable Comments

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);
    }
});
<a href="#" class="facebook"> </a>
<a href="#" class="instagram"> </a>
<a href="#" class="pinterest"> </a>
<a href="#" class="email"> </a>
<a href="#" class="youtube"> </a>
<a href="#" class="linkedin"> </a>
// Parse the initial value using Carbon
$dateTime = Carbon::parse($dateTimeString);

// Format the date and time as desired
$formattedDateTime = $dateTime->format('d-m-Y h:i:sA');
// Parse the initial value using Carbon
$dateTime = Carbon::parse($dateTimeString);

// Format the date and time as desired
$formattedDateTime = $dateTime->isoFormat('Do MMMM YYYY h:mm:ssa');
<?php
$usernames = ['username1', 'username2', ...]; // An array of the usernames of the users you want to change the role for
$new_role = 'new_role'; // The new role you want to assign to the users

foreach ($usernames as $username) {
    $user = get_user_by('login', $username);
    if (!empty($user)) {
        $user->set_role($new_role);
    }
}
?>
$oOrder = OrderAPI::getByID( $lLabID );
if( $oOrder ) {
	//$sFeld = $oOrder->getValueByMethod( "KURZ" );
	$oOrderRoot = $oOrder->getWorkflowRootOrderV2(  );
	if( $oOrderRoot ) {
}
VariablesClass::alertMsg(
	// Zeigt eine Meldung an
	$objResponse, // XAJAX Antwort, nicht aendern!
	$lModuleID, // ID des aufrufenden Moduls, nicht aendern!
	"Bitte Auftrag speichern!", // Nachricht
	"TITLE", // Titel der Meldung
	ALERT_ERROR, // Typ der  Meldung  (ALERT_DEFAULT, ALERT_OK, ALERT_WARNING, ALERT_ERROR)
	"" // (optional) Beschriftung des Buttons
);
<?php
$user = get_userdatabylogin('YOUR_USERNAME');
grant_super_admin($user->ID);
?>
implode(', ', array_column($array, 'colName'));
$coordinator = [];
$coordinatorFirstPage = Api::schoolTeacher()->index($schoolId, $filter);
$coordinator[] = $coordinatorFirstPage->data();
$lastPage = $coordinatorFirstPage->meta('last_page') ?? 1;

$promCordinators = Http::pool(function (Pool $pool) use ($lastPage, $schoolId, $filter) {
    for ($c = 2; $c <= $lastPage; $c++) {
        $filter['page'] = $c;
        $pool->withToken(Auth::user()->token())
            ->get(Api::schoolTeacher()->index($schoolId, $filter, true), $filter);
    }
});

foreach ($promCordinators as $wraped) {
    $coordinator[] = json_decode($wraped->getBody(), true)['data'] ?? [];
}

$coordinator = collect($coordinator)->flatten(1)->toArray();
dd($coordinator);
\DB::enableQueryLog(); // Enable query log

// Your Eloquent query executed by using get()

dd(\DB::getQueryLog()); // Show results of log
<?php

namespace App\Http\Middleware;

use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;

class Authenticate extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     */
    protected function redirectTo(Request $request): ?string
    {
        return $request->expectsJson() ? null : route('login');
    }

    protected function unauthenticated($request, array $guards)
    {
        abort(response()->json(
            [
                'status' => 'false',
                'message' => 'Unauthenticated',
            ], 401));
    }
}
$tournament = app('App\Http\Controllers\TournamentController')->read_tournament_details($request, $tournament_id)->getData(true);
        
echo gmdate("H:i:s", $time_in_seconds);
$name = implode('.', [
    md5_file($file->getPathname()),
    $file->getClientOriginalExtension()
]);
MyTable::whereDate( 'created_at', '<=', now()->subDays(30))->delete();

<?php

    // Get absolute path
    $path = getcwd(); // /home/user/public_html/test/test.php.   

    $path = substr($path, 0, strpos($path, "public_html"));

    $root = $path . "public_html/";

    echo $root; // This will output /home/user/public_html/
// Get array of all source files
$files = scandir("source");
// Identify directories
$source = "source/";
$destination = "destination/";
// Cycle through all source files
foreach ($files as $file) {
  if (in_array($file, array(".",".."))) continue;
  // If we copied this successfully, mark it for deletion
  if (copy($source.$file, $destination.$file))
  {
      $delete[] = $source.$file;
  }
}
// Delete all successfully-copied files
foreach ($delete as $file)
{
    unlink($file);
}
// Adds a new sortable "last updated" column to posts and pages backend.
function custom_columns($defaults) {
    $defaults['last_updated'] = __('Last Updated', 'your-textdomain');
    return $defaults;
}
add_filter('manage_posts_columns', 'custom_columns');
add_filter('manage_pages_columns', 'custom_columns');

function custom_columns_content($column_name, $post_id) {
    if ($column_name == 'last_updated') {
        $last_updated = get_the_modified_date();
        echo $last_updated;
    }
}
add_action('manage_posts_custom_column', 'custom_columns_content', 10, 2);
add_action('manage_pages_custom_column', 'custom_columns_content', 10, 2);

function custom_columns_sortable($columns) {
    $columns['last_updated'] = 'last_updated';
    return $columns;
}
add_filter('manage_edit-post_sortable_columns', 'custom_columns_sortable');
add_filter('manage_edit-page_sortable_columns', 'custom_columns_sortable');

function custom_columns_orderby($query) {
    if (!is_admin()) {
        return;
    }

    $orderby = $query->get('orderby');

    if ('last_updated' == $orderby) {
        $query->set('orderby', 'modified');
    }
}
add_action('pre_get_posts', 'custom_columns_orderby');
Go to public folder Just delete/remove the storage link inside public/

Then Run the command


 php artisan storage:link

 
the above command will link storage again
/**
 * @snippet       Variable Product Price Range: "From: min_price"
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format_min', 9999, 2 );
 
function bbloomer_variation_price_format_min( $price, $product ) {
   $prices = $product->get_variation_prices( true );
   $min_price = current( $prices['price'] );
   $max_price = end( $prices['price'] );
   $min_reg_price = current( $prices['regular_price'] );
   $max_reg_price = end( $prices['regular_price'] );
   if ( $min_price !== $max_price || ( $product->is_on_sale() && $min_reg_price === $max_reg_price ) ) {
      $price = 'From: ' . wc_price( $min_price ) . $product->get_price_suffix();
   }
   return $price;
}
     $table->id();
            $table->string('model');
            $table->unsignedBigInteger('manufacturer_id');
            $table->foreign('manufacturer_id')->references('id')->on('manufacturers');
            $table->timestamps();
add_action( 'elementor/theme/register_conditions', function( $conditions_manager ) {
class Subcategory_Archive extends \ElementorPro\Modules\ThemeBuilder\Conditions\Taxonomy {
	private $taxonomy;

	public function get_name() {
		return 'child_of_' . $this->taxonomy->name;
	}

	public function get_label() {
		return sprintf( __( 'Direct Child %s Of', 'elementor-pro' ), $this->taxonomy->labels->singular_name );
	}

	public function __construct( $data ) {
		parent::__construct( $data );

		$this->taxonomy = $data['object'];
	}

	public function is_term() {
		$taxonomy = $this->taxonomy->name;
		$current = get_queried_object();
		return ( $current && isset( $current->taxonomy ) && $taxonomy === $current->taxonomy );
	}

	public function check( $args ) {
		$id = (int) $args['id'];
		/**
		 * @var \WP_Term $current
		 */
		$current = get_queried_object();
		if ( ! $this->is_term() || 0 === $current->parent ) {
			return false;
		}

		while ( $current->parent > 0 ) {
			if ( $id === $current->parent ) {
				return true;
			}
			$current = get_term_by( 'id', $current->parent, $current->taxonomy );
		}

		return $id === $current->parent;
	}
}
$taxonomy = get_taxonomy('product_cat');
$conditions_manager->get_condition( 'product_archive' )->register_sub_condition( new Subcategory_Archive([ 'object' => $taxonomy ]) );
}, 100);
$mysqli = mysqli_connect('localhost', 'DATABASE_USERNAME', 'DATABASE_PASSWORD', 'DATABASE_NAME');
<!DOCTYPE html>
<html>
​
<body>
The content of the body element is displayed in your browser.
</body>
​
</html>
​
exec("java -jar WaveAppender.jar " . implode (' ', $theFiles));
//encrypt user password

//    hash produces a fixed length string
    $hashFormat = "$2y$10$";

//    Random characters
    $salt = "HZTym3F5Ade6tvnVf5rXve";

//    combine the hash and salt
    $hashFormat_salt = $hashFormat . $salt;
    
//    password encrypted
    $password = crypt($password,$hashFormat_salt);
function deleteRow(){
    global $connection;
    $id = $_POST['id'];

    $query = "DELETE FROM users ";
    $query .= "WHERE id = $id ";

    $result = mysqli_query($connection, $query);

    if (!$result) {
        die("Query Failed" . mysqli_error($connection));
    }
}
function updateTable() {
    global $connection;

    $username = $_POST['username'];
    $password = $_POST['password'];
    $id = $_POST['id'];

    $query = "UPDATE users SET ";
    $query .= "username = '$username', ";
    $query .= "password = '$password' ";
    $query .= "WHERE id = $id ";

    $result = mysqli_query($connection, $query);

    if (!$result) {
        die("Query Failed" . mysqli_error($connection));
    }

}

// HTML FILE
<?php
if(isset($_POST['submit'])){
    updateTable();
}

?>
  
  <form action="update.php" method="post">
    <select name="id" id="">

        <?php
        showAllData();

        ?>

    </select>

    <input type="text" name="username">
    <input type="password" name="password">
    <button type="submit" name="submit">Update</button>
</form>
function readAll(){
  // Connect to db
    global $connection;
  // make result global so you can use it in the other file
    global $result;

    $query = "SELECT * FROM USERS";

    $result = mysqli_query($connection, $query);
}


// HTML FILE
<?php
readAll();
while ($row = mysqli_fetch_assoc($result)){
?>

<pre>
    <?php
    print_r($row);
    }
    ?>
</pre>
function create(){
	//If linking to database from external file
    global $connection;

	//Grab form data
    $username = $_POST['username'];
    $password = $_POST['password'];
	
    //Sanatize user input
    $username = mysqli_real_escape_string($connection,$username);
    $password = mysqli_real_escape_string($connection,$password);

	//Query that inserts value into database
    $query = "INSERT INTO users(username,password) ";
    $query .= "VALUES ('$username', '$password')";

    $result = mysqli_query($connection,$query);

    if(!$result){
        die('Query failed' . mysqli_error());
    }
}


//HTML FILE
if (isset($_POST['submit'])) {
    create();

}
<?php

$username = $_POST['username'];
$password = $_POST['password'];

$username = mysqli_real_escape_string($connection,$username);
$password = mysqli_real_escape_string($connection,$password);
<?php
//If file is in the same directory
include "db.php";

//If file is in another directory
include"../includes/navbar.php";
<?php
//hostname,username,password,database
$connection = mysqli_connect('localhost', 'root', '', 'loginapp');

if(!$connection){
die('connection failed')
}
$areasexperiencia = $areasexperiencia;
function unique_key($array,$keyname){
$new_array = array();
foreach($array as $key=>$value){

if(!isset($new_array[$value[$keyname]])){
$new_array[$value[$keyname]] = $value;
}

}
$new_array = array_values($new_array);
return $new_array;
}
$unique_arr = unique_key($areasexperiencia,'nombre');
function download(pdfUrl, fileName) {
        fetch(pdfUrl).then(resp => resp.arrayBuffer()).then(resp => {
            const file = new Blob([resp], {type: 'application/pdf'});
            const fileURL = URL.createObjectURL(file);
            jQuery("#download-button-prev").attr('href', fileURL).attr('download', fileName);
        });
    }

    download(linkUrl, docName);
<?php

// Load assets on the "about" page (https://yoursite.com/about/)
// Add the following to your (child) theme's functions.php

add_filter( 'facetwp_load_assets', function( $bool ) {
    if ( 'about' == FWP()->helper->get_uri() ) {
        $bool = true;
    }
    return $bool;
});
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
FROM php:8.1-fpm

RUN apt-get update

COPY . /app
RUN ls -l
RUN php -v
CMD php /app/index.php





















function kh_plugin_settings_page() {

    // Check user capabilities

    if ( ! current_user_can( 'manage_options' ) ) {

        return;

    }

    // Add error/update messages

    settings_errors( 'kh_plugin_messages' );

    ?>

    <div class="wrap">

        <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>

        <form action="options.php" method="post">

            <?php

            // Output security fields for the registered setting "kh_plugin_options"

            settings_fields( 'kh_plugin_options' );

            // Output setting sections and their fields

            do_settings_sections( 'kh_plugin' );

            // Output save settings button

            submit_button( __( 'Save Settings', 'kh_plugin' ) );

            ?>

        </form>

    </div>

    <?php

}

function kh_plugin_settings_init() {

    // Register a new setting for the plugin

    register_setting( 'kh_plugin_options', 'kh_plugin_settings' );

    // Add a new section to the settings page

    add_settings_section(

        'kh_plugin_section',

        __( 'KH Plugin Settings', 'kh_plugin' ),

        'kh_plugin_section_callback',

        'kh_plugin'

    );

    // Add a text field to the settings section

    add_settings_field(

        'kh_plugin_text_field',

        __( 'Text Field', 'kh_plugin' ),

        'kh_plugin_text_field_callback',

        'kh_plugin',

        'kh_plugin_section'

    );

    // Add a checkbox field to the settings section

    add_settings_field(

        'kh_plugin_checkbox_field',

        __( 'Checkbox Field', 'kh_plugin' ),

        'kh_plugin_checkbox_field_callback',

        'kh_plugin',

        'kh_plugin_section'

    );

}

add_action( 'admin_init', 'kh_plugin_settings_init' );

// Callback function for the section

function kh_plugin_section_callback() {

    echo '<p>' . __( 'Configure your KH Plugin settings.', 'kh_plugin' ) . '</p>';

}

// Callback function for the text field

function kh_plugin_text_field_callback() {

    $options = get_option( 'kh_plugin_settings' );

    echo '<input type="text" name="kh_plugin_settings[text_field]" value="' . esc_attr( $options['text_field'] ) . '" />';

function my_plugin_shortcode( $atts ) {

    ob_start();

    

    $defaults = array(

        'form_id' => 0,

        'button_text' => 'Add field',

    );

    $args = shortcode_atts( $defaults, $atts );

    

    $form_fields = get_post_meta( $args['form_id'], 'form_fields', true );

    ?>

    <form id="my-form">

        <?php foreach ( $form_fields as $field ) : ?>

            <div class="form-group">

                <label for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo esc_html( $field['label'] ); ?></label>

                <?php if ( $field['type'] === 'text' ) : ?>

                    <input type="text" name="<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $field['value'] ); ?>">

                <?php elseif ( $field['type'] === 'textarea' ) : ?>

                    <textarea name="<?php echo esc_attr( $field['name'] ); ?>"><?php echo esc_html( $field['value'] ); ?></textarea>

                <?php elseif ( $field['type'] === 'select' ) : ?>

                    <select name="<?php echo esc_attr( $field['name'] ); ?>">

                        <?php foreach ( $field['options'] as $option ) : ?>

                            <option value="<?php echo esc_attr( $option['value'] ); ?>"<?php selected( $option['value'], $field['value'] ); ?>><?php echo esc_html( $option['label'] ); ?></option>

                        <?php endforeach; ?>

                    </select>

                <?php endif; ?>

            </div>

        <?php endforeach; ?>

        <button type="button" id="add-field"><?php echo esc_html( $args['button_text'] ); ?></button>

    </form>

    <?php

    $output = ob_get_clean();

    return $output;

}

add_shortcode( 'my-plugin-form', 'my_plugin_shortcode' );

the_post_thumbnail( '', array( 'loading' => '' ) );
// A JavaScript module for submitting forms via AJAX

// This module depends on jQuery and the jQuery Form Plugin

var FormSubmission = {

  // Class to add to elements with form errors

  formErrorClass: 'form-error',

  // Adds form errors to the DOM

  appendFormErrors: function(data, form) {

    // Loop through the error data object

    for (var key in data) {

      // Create a new span element for the error message

      var error = $(document.createElement('span')).attr('class', FormSubmission.formErrorClass).text(data[key]);

      // Insert the error message before the input field with the corresponding name

      form.find("input[name='" + key + "']").before(error);

    }

  },

  // Hides the closest modal element to the given form

  closeModal: function(form) {

    form.closest('.modal').modal('hide');

  },

  // Handles the response from the form submission

  postFormSubmission: function(form, isModal, data) {

    // Remove any existing form errors

    FormSubmission.removeFormErrors(form);

    // If the form was submitted successfully

    if (data['success'] == true) {

      // Reset the form and close the modal if it's a modal form

      FormSubmission.resetForm(form, isModal);

    } else {

      // Append the form errors to the DOM

      FormSubmission.appendFormErrors(data['errors'], form);

    }

  },

  // Removes form errors from the DOM

  removeFormErrors: function(form) {

    form.find('.' + FormSubmission.formErrorClass).remove();

  },

  // Calls resetForm with isModal set to false

  resetForm: function(form) {

    FormSubmission.resetForm(form, false);

  },

  // Resets the form and closes the modal if it's a modal form

  resetForm: function(form, isModal) {

    // Remove any existing form errors

    FormSubmission.removeFormErrors(form);

    // Reset the form

    form[0].reset();

    // If it's a modal form, close the modal

    if (isModal == true) {

      FormSubmission.closeModal(form);

    }

  },

  // Calls submitForm with isModal set to false

  submitForm: function(form) {

    FormSubmission.submitForm(form, false);

  },

  // Submits the form via AJAX

  submitForm: function(form, isModal) {

    var url = form.attr('action');

    // Make an AJAX request to the form's action URL

    $.ajax({

      method: "POST",

      url: url,

      data: form.serialize(),

      myForm: form,

      isModal: isModal,

      // Handle the response from the server

      success: function(data) {

        FormSubmission.postFormSubmission($(this).myForm, $(this).isModal, data);

      },

      // Handle any errors

      error: function(jqXHR, textStatus, errorThrown) {

        console.log(textStatus, errorThrown);

      }

    });

  },

  // Submits the form via AJAX with support for file uploads

  submitFormWithFiles: function(form, isModal) {

    var url = form.attr('action');

    // Make an AJAX request to the form's action URL with support for file uploads

    form.ajaxSubmit({

      method: 'POST',

      url: url,

      myForm: form,

      isModal: isModal,

      // Handle the response from the server

      success: function(data) {

        FormSubmission.postFormSubmission($(this).myForm, $(this).isModal, data);

      },

      //

auth()->user()->name;
auth()->id();

be sure that you are logged in. and use that


composer create-project --prefer-dist laravel/laravel:8.6.11 blog


composer create-project laravel/laravel:^8.0 example --ignore-platform-reqs
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$referer = $_SERVER['HTTP_REFERER'];
$language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];

echo "IP address: $ip<br>";
echo "User agent: $user_agent<br>";
echo "Referrer: $referer<br>";
echo "Preferred language(s): $language<br>";
?>
public function stkpush(Request $request)
{
    $url='https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest';

    $curl_post_data=[
        'BusinessShortCode'=>174379,
        'Password'=>$this->lipanampesapassword(),
        'Timestamp'=>Carbon::rawParse('now')->format('YmdHms'),

        'TransactionType'=> "CustomerPayBillOnline",
        'Amount'=>1,
        'PartyA'=>254712345678,
        'PartyB'=>174379,
        'PhoneNumber'=>254712345678,
        'CallBackURL'=>'https://89af-196-202-210-53.eu.ngrok.io/api/mpesa/callbackurl',
        'AccountReference'=>'Waweru Enterprises',
        'TransactionDesc'=>'Paying for Products Bought'
    ];

    $data_string=json_encode($curl_post_data);

    $curl=curl_init();
    curl_setopt($curl,CURLOPT_URL,$url);
    curl_setopt($curl,CURLOPT_HTTPHEADER,array('Content-Type:application/json','Authorization:Bearer '.$this->newaccesstoken()));
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl,CURLOPT_POST,true);
    curl_setopt($curl,CURLOPT_POSTFIELDS,$data_string);

    $curl_response=curl_exec($curl);
    return $curl_response;
}
<?php

namespace App\Http\Controllers\User;

use App\Http\Controllers\Controller;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Http\Request;

class MempelaiController extends Controller
{
    public function getDataMempelaiPria(Request $request)
    {
        $dataMempelaiPria = $request->user()->mempelai_pria;
        return response()->json([
            'message' => 'success',
            'data' => $dataMempelaiPria
        ]);
    }

    public function getDataMempelaiWanita(Request $request)
    {
        $dataMempelaiWanita = $request->user()->mempelaiWanitaApi;
        return response()->json([
            'message' => 'success',
            'data' => $dataMempelaiWanita
        ]);
    }

    public function storeDataMempelai(Request $request)
    {
        $user = User::find($request->user()->id);
        $dataMempelaiPria = $request->dataMempelaiPria;
        $dataMempelaiWanita = $request->dataMempelaiWanita;
        $dataNull = $request->dataNull;

        if ($dataNull['dataMempelaiPria'] === 'true') {
            $user->MempelaiPriaApi()->create([
                'user_id' => $user->id,
                'nama_lengkap' => ucfirst($dataMempelaiPria['nama_lengkap']),
                'nama_panggilan' => ucfirst($dataMempelaiPria['nama_panggilan']),
                'tempat_lahir' => $dataMempelaiPria['tempat_lahir'],
                'tanggal_lahir' => $dataMempelaiPria['tanggal_lahir'],
                'nama_ayah' => $dataMempelaiPria['nama_ayah'],
                'nama_ibu' => $dataMempelaiPria['nama_ibu'],
                'foto' => 'default',
                'tampilkan_foto' => 'false',
                'instagram' =>  'null',
                'facebook' => 'null',
                'twitter' => 'null',
            ]);
        } else {
            $user->MempelaiPriaApi()->update([
                'user_id' => $user->id,
                'nama_lengkap' => ucfirst($dataMempelaiPria['nama_lengkap']),
                'nama_panggilan' => ucfirst($dataMempelaiPria['nama_panggilan']),
                'tempat_lahir' => $dataMempelaiPria['tempat_lahir'],
                'tanggal_lahir' => $dataMempelaiPria['tanggal_lahir'],
                'nama_ayah' => $dataMempelaiPria['nama_ayah'],
                'nama_ibu' => $dataMempelaiPria['nama_ibu'],
                'foto' => 'default',
                'tampilkan_foto' => 'false',
                'instagram' =>  'null',
                'facebook' => 'null',
                'twitter' => 'null',
            ]);
        }

        if ($dataNull['dataMempelaiWanita'] === 'true') {
            $user->mempelaiWanitaApi()->create([
                'user_id' => $user->id,
                'nama_lengkap' => ucfirst($dataMempelaiWanita['nama_lengkap']),
                'nama_panggilan' => ucfirst($dataMempelaiWanita['nama_panggilan']),
                'tempat_lahir' => $dataMempelaiWanita['tempat_lahir'],
                'tanggal_lahir' => $dataMempelaiWanita['tanggal_lahir'],
                'nama_ayah' => $dataMempelaiWanita['nama_ayah'],
                'nama_ibu' => $dataMempelaiWanita['nama_ibu'],
                'foto' => 'default',
                'tampilkan_foto' => 'false',
                'instagram' =>  'null',
                'facebook' => 'null',
                'twitter' => 'null',
            ]);
        } else {
            $user->mempelaiWanitaApi()->update([
                'user_id' => $user->id,
                'nama_lengkap' => ucfirst($dataMempelaiWanita['nama_lengkap']),
                'nama_panggilan' => ucfirst($dataMempelaiWanita['nama_panggilan']),
                'tempat_lahir' => $dataMempelaiWanita['tempat_lahir'],
                'tanggal_lahir' => $dataMempelaiWanita['tanggal_lahir'],
                'nama_ayah' => $dataMempelaiWanita['nama_ayah'],
                'nama_ibu' => $dataMempelaiWanita['nama_ibu'],
                'foto' => 'default',
                'tampilkan_foto' => 'false',
                'instagram' =>  'null',
                'facebook' => 'null',
                'twitter' => 'null',
            ]);
        }

        return response()->json([
            'message' => 'success',
            'data' => $user
        ]);
    }

    public function storeMempelaiPria(Request $request)
    {
        $user = User::find($request->user()->id);
        $dataMempelaiPria = $request->dataMempelaiPria;

        $user->MempelaiPriaApi()->create([
            'user_id' => $user->id,
            'nama_lengkap' => ucfirst($dataMempelaiPria['nama_lengkap']),
            'nama_panggilan' => ucfirst($dataMempelaiPria['nama_panggilan']),
            'tempat_lahir' => $dataMempelaiPria['tempat_lahir'],
            'tanggal_lahir' => Carbon::parse(strtr($dataMempelaiPria['tanggal_lahir'], '/', '-'))->format('Y-m-d'),
            'nama_ayah' => $dataMempelaiPria['nama_ayah'],
            'nama_ibu' => $dataMempelaiPria['nama_ibu'],
            'foto' => 'default',
            'tampilkan_foto' => 'false',
            'instagram' =>  'null',
            'facebook' => 'null',
            'twitter' => 'null',
        ]);


        return response()->json([
            'message' => 'success',
            'data' => $user
        ]);
    }

    public function updateMempelaiPria(Request $request)
    {
        $user = User::find($request->user()->id);
        $dataMempelaiPria = $request->dataMempelaiPria;

        $user->MempelaiPriaApi()->update([
            'user_id' => $user->id,
            'nama_lengkap' => ucfirst($dataMempelaiPria['nama_lengkap']),
            'nama_panggilan' => ucfirst($dataMempelaiPria['nama_panggilan']),
            'tempat_lahir' => $dataMempelaiPria['tempat_lahir'],
            'tanggal_lahir' => Carbon::parse(strtr($dataMempelaiPria['tanggal_lahir'], '/', '-'))->format('Y-m-d'),
            'nama_ayah' => $dataMempelaiPria['nama_ayah'],
            'nama_ibu' => $dataMempelaiPria['nama_ibu'],
            'foto' => 'default',
            'tampilkan_foto' => 'false',
            'instagram' =>  'null',
            'facebook' => 'null',
            'twitter' => 'null',
        ]);

        return response()->json([
            'message' => 'success',
            'data' => $user
        ]);
    }

    public function storeMempelaiWanita(Request $request)
    {
        $user = User::find($request->user()->id);
        $dataMempelaiWanita = $request->dataMempelaiWanita;

        $user->mempelaiWanitaApi()->create([
            'user_id' => $user->id,
            'nama_lengkap' => ucfirst($dataMempelaiWanita['nama_lengkap']),
            'nama_panggilan' => ucfirst($dataMempelaiWanita['nama_panggilan']),
            'tempat_lahir' => $dataMempelaiWanita['tempat_lahir'],
            'tanggal_lahir' => Carbon::parse(strtr($dataMempelaiWanita['tanggal_lahir'], '/', '-'))->format('Y-m-d'),
            'nama_ayah' => $dataMempelaiWanita['nama_ayah'],
            'nama_ibu' => $dataMempelaiWanita['nama_ibu'],
            'foto' => 'default',
            'tampilkan_foto' => 'false',
            'instagram' =>  'null',
            'facebook' => 'null',
            'twitter' => 'null',
        ]);

        $namaPanggilanMempelaiPria = $user->mempelaiPriaApi->nama_panggilan;

        $user->settingUndanganApi()->create([
            'user_id' => $user->id,
            'domain' => $namaPanggilanMempelaiPria . '-' . $dataMempelaiWanita['nama_panggilan'],
            'judul_undangan' => $namaPanggilanMempelaiPria . ' & ' . $dataMempelaiWanita['nama_panggilan'],
        ]);

        return response()->json([
            'message' => 'success',
            'data' => $user
        ]);
    }

    public function updateMempelaiWanita(Request $request)
    {
        $user = User::find($request->user()->id);
        $dataMempelaiWanita = $request->dataMempelaiWanita;

        $user->mempelaiWanitaApi()->update([
            'user_id' => $user->id,
            'nama_lengkap' => ucfirst($dataMempelaiWanita['nama_lengkap']),
            'nama_panggilan' => ucfirst($dataMempelaiWanita['nama_panggilan']),
            'tempat_lahir' => $dataMempelaiWanita['tempat_lahir'],
            'tanggal_lahir' => Carbon::parse(strtr($dataMempelaiWanita['tanggal_lahir'], '/', '-'))->format('Y-m-d'),
            'nama_ayah' => $dataMempelaiWanita['nama_ayah'],
            'nama_ibu' => $dataMempelaiWanita['nama_ibu'],
            'instagram' => $dataMempelaiWanita['instagram'] ?? 'null',
        ]);

        return response()->json([
            'message' => 'success',
            'data' => $user
        ]);
    }
}
@extends('layouts.master')

@section('title', 'Pendaftaran')

@section('content')
    <x-navigation.navbar />
    <main class="hero min-h-screen bg-base-200">
        <div class="hero-content my-6">
            <section>
                <div class="w-full max-w-xl flex-shrink-0">
                    <ol class="border-l-2 border-blue-600">
                        <li>
                            <div class="flex-start flex items-center">
                                <div class="-ml-2 mr-3 -mt-2 flex h-4 w-4 items-center justify-center rounded-full bg-blue-600">
                                </div>
                                <h4 class="-mt-2 text-xl font-semibold text-gray-800">Daftar Akun</h4>
                            </div>

                            <div class="ml-6" id="pendaftaran">
                                <p class="-ml-1 text-sm text-green-500">Pendaftaran berhasil.</p>
                            </div>
                        </li>

                        <li class="{{ $dataMempelaiPria === null ? 'pb-6' : '' }} pt-6" id="section-mempelai-pria">
                            <div class="flex-start flex cursor-pointer items-center">
                                <div class="-ml-2 mr-3 -mt-2 flex h-4 w-4 items-center justify-center rounded-full bg-blue-600">
                                </div>
                                <h4 class="-mt-2 text-xl font-semibold text-gray-800">Profile Mempelai Pria</h4>
                            </div>
                            <div class="{{ $dataMempelaiPria === null ? '' : 'hidden' }} ml-6" id="form-mempelai-pria">
                                <p class="desc-timeline">Silahkan isi formulir dengan lengkap.</p>
                                @include('user.complete-register.partials.formMempelaiPria')
                            </div>

                            <div class="{{ $dataMempelaiPria === null ? 'hidden' : '' }} ml-6" id="form-mempelai-pria-not-null">
                                <p class="-ml-1 text-sm text-green-500">Informasi profile mempelai pria sudah lengkap.</p>
                            </div>
                        </li>

                        <li class="{{ $dataMempelaiPria === null ? 'hidden' : '' }} pt-6 pb-6" id="section-mempelai-wanita">
                            <div class="flex-start flex cursor-pointer items-center">
                                <div class="-ml-2 mr-3 -mt-2 flex h-4 w-4 items-center justify-center rounded-full bg-blue-600">
                                </div>
                                <h4 class="-mt-2 text-xl font-semibold text-gray-800">Profile Mempelai Wanita </h4>
                            </div>
                            <div class="{{ $dataMempelaiWanita === null ? '' : 'hidden' }} ml-6" id="form-wanita">
                                <p class="desc-timeline">Silahkan isi formulir dengan lengkap.</p>
                                @include('user.complete-register.partials.formMempelaiWanita')
                            </div>

                            <div class="{{ $dataMempelaiWanita === null ? 'hidden' : '' }} ml-6" id="form-mempelai-wanita-not-null">
                                <p class="-ml-1 text-sm text-green-500">Informasi profile mempelai Wanita sudah lengkap.</p>
                            </div>
                        </li>

                    </ol>
                </div>
            </section>
        </div>
    </main>

    <x-toast-alert id="toast-success" type="success" message="Berhasil." />
@endsection

@push('scripts')
    <script>
        flatpickr("#tanggal-lahir-pria", {
            locale: "id",
            dateFormat: "d/m/Y",
        });

        flatpickr("#tanggal-lahir-wanita", {
            locale: "id",
            dateFormat: "d/m/Y",
        });
    </script>
    <script type="module">
        // Variabel
        $('#footer').addClass('hidden')
        var dataMempelaiPria = @json($dataMempelaiPria);
        var dataMempelaiWanita = @json($dataMempelaiWanita);

        var dataNull = {
            'dataMempelaiPria' : dataMempelaiPria !== null ? false : true,
            'dataMempelaiWanita' : dataMempelaiWanita !== null ? false : true,
        }

        if(dataMempelaiPria === null){
            $('html, body').animate({
                scrollTop: $("#section-mempelai-pria").offset().top
            }, 1000);
        } else if(dataMempelaiWanita === null){
            $('html, body').animate({
                scrollTop: $("#section-mempelai-wanita").offset().top
            }, 1000);
        }

        $('#handleStoreDataMempelaiPria').click(function(){
            storeDataMempelaiPria()
        })

        $('#handleStoreDataMempelaiwanita').click(function(){
            storeDataMempelaiWanita()
        })

        function storeDataMempelaiPria() {
            var dataMempelaiPria = {
                id: $('#id-pria').val(),
                nama_lengkap: $('#nama-lengkap-pria').val(),
                nama_panggilan: $('#nama-panggilan-pria').val(),
                tanggal_lahir: $('#tanggal-lahir-pria').val(),
                tempat_lahir: $('#tempat-lahir-pria').val(),
                nama_ayah: $('#nama-ayah-pria').val(),
                nama_ibu: $('#nama-ibu-pria').val(),
                instagram: $('#instagram-pria').val(),
            }

            $.ajax({
                url: `${dataNull.dataMempelaiPria === false ? '/mempelai/update-data-mempelai-pria' : '/mempelai/store-data-mempelai-pria'}`,
                type: 'GET',
                dataType: 'json',
                data: {
                    dataMempelaiPria,
                    dataNull,
                },
                beforeSend: function() {
                    $('.btn-handle').html('Loading...').addClass('opacity-50 cursor-not-allowed');
                },
                error: function(error) {
                    $('.btn-handle').html('Coba lagi').removeClass('opacity-50 cursor-not-allowed').addClass('bg-red-500');
                },
                success: function(response) {
                    $('#toast-success').removeClass('hidden');
                    $('.btn-handle').html('Lanjutkan').removeClass('opacity-50 cursor-not-allowed');
                    setTimeout(() => {
                       $('#toast-success').addClass('hidden')
                    }, 3000);
                    $('#section-mempelai-wanita').removeClass('hidden').addClass('pb-6')
                    $('#section-mempelai-pria').removeClass('pb-6')
                    $('#form-mempelai-pria').addClass('hidden')
                    $('#form-mempelai-pria-not-null').removeClass('hidden')
                    $('html, body').animate({
                        scrollTop: $("#section-mempelai-wanita").offset().top
                    }, 1000);
                    getDataMempelaiPria()
                }
            });
        }

        function storeDataMempelaiWanita(){
            var dataMempelaiWanita = {
                id: $('#id-wanita').val(),
                nama_lengkap: $('#nama-lengkap-wanita').val(),
                nama_panggilan: $('#nama-panggilan-wanita').val(),
                tanggal_lahir: $('#tanggal-lahir-wanita').val(),
                tempat_lahir: $('#tempat-lahir-wanita').val(),
                nama_ayah: $('#nama-ayah-wanita').val(),
                nama_ibu: $('#nama-ibu-wanita').val(),
                instagram: $('#instagram-wanita').val(),
            }

            $.ajax({
                url: `${dataNull.dataMempelaiWanita === false ? '/mempelai/update-data-mempelai-wanita' : '/mempelai/store-data-mempelai-wanita'}`,
                type: 'GET',
                dataType: 'json',
                data: {
                    dataMempelaiWanita,
                    dataNull,
                },
                beforeSend: function() {
                    $('.btn-handle').html('Loading...').addClass('opacity-50 cursor-not-allowed');
                },
                error: function(error) {
                    $('.btn-handle').html('Coba lagi').removeClass('opacity-50 cursor-not-allowed').addClass('bg-red-500');
                },
                success: function(response) {
                    $('#toast-success').removeClass('hidden');
                    $('.btn-handle').html('Lanjutkan').removeClass('opacity-50 cursor-not-allowed');
                    setTimeout(() => {
                       $('#toast-success').addClass('hidden')
                    }, 3000);
                    $('#section-mempelai-wanita').removeClass('pb-6')
                    $('#form-wanita').addClass('hidden')
                    $('html, body').animate({
                        scrollTop: $("#section-mempelai-wanita").offset().top
                    }, 1000);
                    window.location.href = '/dashboard'
                }
            });
        }
</script>
@endpush
function time_elapsed_string($ptime)
{
    $etime = $ptime - time();

    if ($etime < 1)
    {
        return '0 seconds';
    }

    $a = array( 365 * 24 * 60 * 60  =>  'year',
                 30 * 24 * 60 * 60  =>  'month',
                      24 * 60 * 60  =>  'day',
                           60 * 60  =>  'hour',
                                60  =>  '',
                                 1  =>  ''
                );
    $a_plural = array( 'year'   => 'years',
                       'month'  => 'months',
                       'day'    => 'days',
                       'hour'   => 'hours',
                       'minute' => '',
                       'second' => ''
                );

    foreach ($a as $secs => $str)
    {
        $d = $etime / $secs;
        if ($d >= 1)
        {
            $r = round($d);
            return $r . '' . ($r > 1 ? $a_plural[$str] : $str);
        }
    }
}
<?php
// Original Answer
header('Content-Type: application/json');
$request = file_get_contents('php://input');
$req_dump = print_r( $request, true );
$fp = file_put_contents( 'request.log', $req_dump );

// Updated Answer
if($json = json_decode(file_get_contents("php://input"), true)){
   $data = $json;
}
print_r($data);
?>
$data = Project::limit(100)->get();
return ProjectResource::collection($data)->additional(['some_id => 1']);
// Empty data and rules
$validator = \Validator::make([], []);

// Add fields and errors
$validator->errors()->add('fieldName', 'This is the error message');

throw new \Illuminate\Validation\ValidationException($validator);
    $inputs = [
        'email'    => 'foo',
        'password' => 'bar',
    ];

    $rules = [
        'email'    => 'required|email',
        'password' => [
            'required',
            'string',
            'min:10',             // must be at least 10 characters in length
            'regex:/[a-z]/',      // must contain at least one lowercase letter
            'regex:/[A-Z]/',      // must contain at least one uppercase letter
            'regex:/[0-9]/',      // must contain at least one digit
            'regex:/[@$!%*#?&]/', // must contain a special character
        ],
    ];

    $validation = \Validator::make( $inputs, $rules );

    if ( $validation->fails() ) {
        print_r( $validation->errors()->all() );
    }
$event_startdate_raw = intval(get_field('start_date', false, false)) / 1000;
    $event_startdate = new DateTime();
    $event_startdate->setTimestamp($event_startdate_raw)
    $event_startdate->setTimezone(new DateTimeZone(timezone_name_from_abbr('',  get_option('gmt_offset') * 3600, 0)));
    $event_startdate_jMY = $event_startdate->format('j M Y');
// Display Object or Array
public function oa($model)
{
    if (gettype($model) === 'object') {
        dump(get_class($model));
        dump($model->toArray());
    } else {
        dump(gettype($model));
        dump($model);
    }
}
// Display string
public function s($model)
{
    dump($model);
}
<?php
//toXML.php

//create new XML doc
$xmlDoc = new DOMDocument('1.0', 'utf-8');
$xmlDoc->formatOutput = true;

//build XML File  with root element
$xmlRoot = $xmlDoc -> createElement('person');
$xmlDoc->appendChild($xmlRoot);

//build childs of root element
$xmlGender = $xmlDoc->createElement('gender', 'female');
$xmlRoot->appendChild($xmlGender);

$xmlVorname = $xmlDoc->createElement('vorname', 'Eva');
$xmlRoot->appendChild($xmlVorname);

$xmlNachname = $xmlDoc->createElement('nachname', 'Lurch');
$xmlRoot->appendChild($xmlNachname);


$filename = "person.xml";
$xmlDoc->save($filename);

?>
<?php

$dataname = "e2fi1.csv";

$fp = fopen($dataname, "r");

//first line of csv is header, needs to be read out seperately
//fgetcsv macht automatisch weiter bei der nächsten Zeile, merkt sich wo der pointer steht
$row_header = fgetcsv($fp, null, ";");
$row_header_nummer = $row_header[0];
$row_header_vorname = $row_header[1];
$row_header_nachname = $row_header[2];

//create XML
$xml_doc = new DOMDocument('1.0', 'utf-8');
$xml_doc->formatOutput = true;

//build XML file with root element
$xml_root = $xml_doc->createElement('klasse_e2fi1');
$xml_doc->appendChild($xml_root);

//create string from CSV
while (!feof($fp)) {
    $row_a = fgetcsv($fp, null, ";");

    if (empty($row_a)) {
        continue;
    }

    $schueler_nummer = $row_a[0];
    $schueler_vorname = $row_a[1];
    $schueler_nachname = $row_a[2];

    //create sub element for students
    $xml_student = $xml_doc->createElement('schueler');
    $xml_student->setAttribute("nr", $schueler_nummer);
    $xml_root->appendChild($xml_student);

    //create element that fills the
    $xml_vorname = $xml_doc->createElement($row_header_vorname, $schueler_vorname);
    $xml_student->appendChild($xml_vorname);

    $xml_nachname = $xml_doc->createElement($row_header_nachname, $schueler_nachname);
    $xml_student->appendChild($xml_nachname);
}

$xml_filename = "klasse1fi1.xml";
$xml_doc->save($xml_filename);
<?php
require_once('class.excel_xml.php');

$xls = new excel_xml; // initiate the class

$xls->set_titles(array('title one','title two','title three')); // optional: sets the titles of the spreadsheet columns

// adding 6 rows to the spreadsheet

$xls->add_row(array('text',-22.2,'bla bla')); // first row

$xls->add_row(array('1500.3',14.5,'bingo!')); // second row

$xls->add_row(array('2014-11-01',14.5,'a date in cell A4!!')); // third row

$xls->add_row(array('Timestamp in cell C5',14.5,'2014-11-01 12:00:10','extra data, a longer text')); // fourth row

$xls->add_row(array()); // fifth (empty) row

$xls->add_row(array('Time in cell C7',14.5,'12:00:10'));// sixth row

// writes output to file.xml (check please write permissions)
//$xls->output('file'); // comment it out to enable writing

// send the data to the browser
$xls->output();
<?php
/** create XML file */ 
$mysqli = new mysqli("localhost", "root", "", "dbbookstore");
/* check connection */
if ($mysqli->connect_errno) {
   echo "Connect failed ".$mysqli->connect_error;
   exit();
}
$query = "SELECT id, title, author_name, price, ISBN, category FROM books";
$booksArray = array();
if ($result = $mysqli->query($query)) {
    /* fetch associative array */
    while ($row = $result->fetch_assoc()) {
       array_push($booksArray, $row);
    }
  
    if(count($booksArray)){
         createXMLfile($booksArray);
     }
    /* free result set */
    $result->free();
}
/* close connection */
$mysqli->close();
function createXMLfile($booksArray){
  
   $filePath = 'book.xml';
   $dom     = new DOMDocument('1.0', 'utf-8'); 
   $root      = $dom->createElement('books'); 
   for($i=0; $i<count($booksArray); $i++){
     
     $bookId        =  $booksArray[$i]['id'];  
     $bookName = htmlspecialchars($booksArray[$i]['title']);
     $bookAuthor    =  $booksArray[$i]['author_name']; 
     $bookPrice     =  $booksArray[$i]['price']; 
     $bookISBN      =  $booksArray[$i]['ISBN']; 
     $bookCategory  =  $booksArray[$i]['category'];  
     $book = $dom->createElement('book');
     $book->setAttribute('id', $bookId);
     $name     = $dom->createElement('title', $bookName); 
     $book->appendChild($name); 
     $author   = $dom->createElement('author', $bookAuthor); 
     $book->appendChild($author); 
     $price    = $dom->createElement('price', $bookPrice); 
     $book->appendChild($price); 
     $isbn     = $dom->createElement('ISBN', $bookISBN); 
     $book->appendChild($isbn); 
     
     $category = $dom->createElement('category', $bookCategory); 
     $book->appendChild($category);
 
     $root->appendChild($book);
   }
   $dom->appendChild($root); 
   $dom->save($filePath); 
 } 
function createXMLfile($booksArray){
  
   $filePath = 'book.xml';

   $dom     = new DOMDocument('1.0', 'utf-8'); 

   $root      = $dom->createElement('books'); 

   for($i=0; $i<count($booksArray); $i++){
     
     $bookId        =  $booksArray[$i]['id'];  

     $bookName      =   htmlspecialchars($booksArray[$i]['title']);

     $bookAuthor    =  $booksArray[$i]['author_name']; 

     $bookPrice     =  $booksArray[$i]['price']; 

     $bookISBN      =  $booksArray[$i]['ISBN']; 

     $bookCategory  =  $booksArray[$i]['category'];  

     $book = $dom->createElement('book');

     $book->setAttribute('id', $bookId);

     $name     = $dom->createElement('title', $bookName); 

     $book->appendChild($name); 

     $author   = $dom->createElement('author', $bookAuthor); 

     $book->appendChild($author); 

     $price    = $dom->createElement('price', $bookPrice); 

     $book->appendChild($price); 

     $isbn     = $dom->createElement('ISBN', $bookISBN); 

     $book->appendChild($isbn); 
     
     $category = $dom->createElement('category', $bookCategory); 

     $book->appendChild($category);
 
     $root->appendChild($book);

   }

   $dom->appendChild($root); 

   $dom->save($filePath); 

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

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content=
		"width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">

	<link rel="stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
	<title>Attendance Page</title>
</head>

<body>
	<div class="container">
		<div class="row">
			<h2>Attendance</h2>
			<table class="table table-hover">
				<thead>
					<tr>
						<th>Sno.</th>
						<th>Student Name</th>
						<th>Attendance</th>
					</tr>
				</thead>

				<tbody>
					<?php
						include_once('connection.php');
						$a=1;
						$stmt = $conn->prepare("SELECT * FROM kundendaten");
						$stmt->execute();
						$users = $stmt->fetchAll();
						foreach($users as $user)
						{
					?>
					<tr>
						<td>
							<?php echo $user['id']; ?>
						</td>
						<td>
							<?php echo $user['studentname']; ?>
						</td>

						<td>
							<div class="form-check form-check-inline">
								<input class="form-check-input"
										type="radio" name="''"
										
										id="inlineRadio1"
									value="'..$a..'">
								<label class="form-check-label"
									for="inlineRadio1">A</label>
							</div>

							<div class="form-check form-check-inline">
								<input class="form-check-input"
									type="radio" name="'..$a..'"
									id="inlineRadio2" value="option2">

								<label class="form-check-label"
									for="inlineRadio2">P</label>
							</div>
						</td>
					</tr>
					<?php
					}
					?>
				</tbody>
			</table>

			<input class="btn btn-primary"
					type="submit" value="Submit">
		</div>
	</div>
</body>

</html>
.ssh directory: 700 (drwx------)
public key (.pub file): 644 (-rw-r--r--)
private key (id_rsa): 600 (-rw-------)
#  Home directory
lastly your home directory should not be writeable by the group or others (default 755 (drwxr-xr-x)).
 If you are looking for better security and privacy, you can change the default permissions to 750.
request()->validate([
            'name'=>'required',
            'email'=>'required|email',
            'subject'=>'required'
        ]);
Mail::send('emails.correo1', $datos, function ($message) use ($datos){
            $message->from($datos['email'], $datos['name'])
                    ->to('pablo.martin.lopez@ieslaarboleda.es', 'Administrador')
                    ->subject($datos['subject']);
        });
return back()->with('flash', $request->name.' mensaje enviado');
@if (session()->has('flash'))
	<div class="alert alert-info alert-dismissable">
		<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
			{{ session()->get('flash') }}
	</div>
@endif
$apiKey = getenv('SENDGRID_API_KEY');
//Custom Validation 

$validated = Validator::make($data, [
                    'username' => 'required|unique:wbx_pos_merchant_terminals', // note the email field
                    'email' => 'required|unique:wbx_pos_merchant_terminals', // note the email field
                ]);
                return json_encode(
                    [
                        'error' => true,
                        'messages'=>$validated->errors()->all()
                    ]
                );
$thumbnail = get_the_post_thumbnail( $the_id, $image_size );
if ( $thumbnail == '' ) {
  $press_pdf = get_field( 'press_releases_pdf', $the_id );
  if ( $press_pdf ) {
    $file_url = $press_pdf['url'];
    $pdf_image = str_replace('.pdf', '-pdf.jpg', $file_url);
  }
  $thumbnail = '<img class="pdf-image-thumbnail" src="'.$pdf_image.'">';
}
Route::get('/concat-table', function(){
    $users = App\Models\User::get();
    $posts = App\Models\Post::get();
    $data = $users->concat($posts);
    dd($data);
});
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --1
public function ImageOrderUpdate (Request $request, $prop, $photo) {

//The photo to edit 
$Photos_Edit = Images::where('property_id', $prop->id)->where('id', $photo)->firstorfail();

$OldPosition = $Photos_Edit->order;     // Old position
$NewPosition = $request->photoorder;    // New position

// Moving down where the fall between positions
if($NewPosition > $OldPosition) {
    Images::where('order','<', $NewPosition)->where('order','>', $OldPosition)->decrement('order');
} 
else {
    Images::where('order','>', $NewPosition)->where('order','<', $OldPosition)->increment('order');
}

// Update the image sort position
$Photos_Edit->order = $NewPosition;

return back();
@if (Route::has('login'))
        <div class="hidden fixed top-0 right-0 px-6 py-4">
            @auth
                <a href="{{ url('/dashboard') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Dashboard</a>
            @else
                <a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>

                @if (Route::has('register'))
                    <a href="{{ route('register') }}"
                        class="ml-4 text-sm text-gray-700 dark:text-gray-500 underline">Register</a>
                @endif
            @endauth
        </div>
    @endif
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    <div>
        <input type="text" value="" name="s" id="s" placeholder="Search" />
        <input type="submit" id="searchsubmit" value="Search" />
    </div>
</form>
wp_enqueue_style('single-team', get_stylesheet_directory_uri().'/assets/css/single-team.css');
$content = apply_filters( 'the_content', get_the_content() );
echo $content;
// add this to functions.php
//register acf fields to Wordpress API
//https://support.advancedcustomfields.com/forums/topic/json-rest-api-and-acf/

function acf_to_rest_api($response, $post, $request) {
    if (!function_exists('get_fields')) return $response;

    if (isset($post)) {
        $acf = get_fields($post->id);
        $response->data['acf'] = $acf;
    }
    return $response;
}
add_filter('rest_prepare_post', 'acf_to_rest_api', 10, 3);
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
//Find duplicates 

$arr = array( 
    'unique', 
    'duplicate', 
    'distinct', 
    'justone', 
    'three3', 
    'duplicate', 
    'three3', 
    'three3', 
    'onlyone' 
);

$unique = array_unique($arr); 
$dupes = array_diff_key( $arr, $unique ); 
    // array( 5=>'duplicate', 6=>'three3' 7=>'three3' )

// count duplicates

array_count_values($dupes); // array( 'duplicate'=>1, 'three3'=>2 )
// when eager loading
$school = School::with(['students' => function ($q) {
  $q->orderBy('whateverField', 'asc/desc');
}])->find($schoolId);

// when lazy loading
$school = School::find($schoolId);
$school->load(['students' => function ($q) {
  $q->orderBy('whateverField', 'asc/desc');
}]);

// or on the collection
$school = School::find($schoolId);
// asc
$school->students->sortBy('whateverProperty');
// desc
$school->students->sortByDesc('whateverProperty');


// or querying students directly
$students = Student::whereHas('school', function ($q) use ($schoolId) {
  $q->where('id', $schoolId);
})->orderBy('whateverField')->get();
//Use localStorage for that. It's persistent over sessions.

//Writing :
localStorage['myKey'] = 'somestring'; // only strings

//Reading :
var myVar = localStorage['myKey'] || 'defaultValue';

//If you need to store complex structures, you might serialize them in JSON. For example :

//Reading :
var stored = localStorage['myKey'];
if (stored) myVar = JSON.parse(stored);
else myVar = {a:'test', b: [1, 2, 3]};

//Writing :
localStorage['myKey'] = JSON.stringify(myVar);

//Note that you may use more than one key. They'll all be retrieved by all pages on the same domain.

//Unless you want to be compatible with IE7, you have no reason to use the obsolete and small cookies.
add_filter( 'woocommerce_package_rates', 'unset_shipping_when_free_is_available_all_zones', 9999, 2 );

function unset_shipping_when_free_is_available_all_zones( $rates, $package ) {

    $all_free_rates = array();

    foreach ( $rates as $rate_id => $rate ) {
        if ( 'free_shipping' === $rate->method_id ) {
            $all_free_rates[ $rate_id ] = $rate;
            break;
        }
    }

    if ( empty( $all_free_rates )) {
        return $rates;
    } else {
        return $all_free_rates;
    } 
}
<?php  

    // PAGINATION CODE

    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;

    $mainarray = array(

        'post_type' => array('post'),

        'post_status' => array('publish'),

        'orderby' => 'date',

        'order' => 'DESC',

        'posts_per_page' => 6,

        'paged'       => $paged,

    );

    $q = new WP_Query($mainarray); 

?>

​

    <div class="row custom-blog-main-wrapper">

        <?php while ($q->have_posts()) : $q->the_post(); ?>

        <div class="col-md-4 col-sm-6">

            <div class="blog-news-wrapper">

                <div class="blog-image">

                    <a href="<?php the_permalink(); ?>">

                        <?php if (has_post_thumbnail()):

$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(),'large', true);

?>

                        <img src="<?php echo $thumbnail[0]; ?>" alt="Picture" class="featured-image">

                        <?php else: ?>

                        <img src="<?php echo site_url('PATH'); ?>" alt="Picture" class="featured-image">

                        <?php endif; ?>

                    </a>

                </div>

                <div class="blog-content">

                    <p class="blog-date">

                        <?php echo get_the_date('M d Y'); ?>

                    </p>

                    <h3 class="blog-title">

                        <a href="<?php the_permalink(); ?>">

                            <?php the_title(); ?>

                        </a>

                    </h3>

                    <div class="blog-inner">

                        <p class="blog-text">

                            <?php if(!empty(get_the_excerpt())){

                                echo strip_tags(substr(get_the_excerpt(), 0, 200));

                            }

                            else{
php artisan make:migration update_products_table
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');

function redirect_to_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
}
add_filter( 'woocommerce_product_tabs', 'woo_rename_tab', 98);
function woo_rename_tab($tabs) {

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

 return $tabs;
}
add_filter('woocommerce_get_availability', 'availability_filter_func');

function availability_filter_func($availability)
{
	$availability['availability'] = str_ireplace('Out of stock', 'Sold', $availability['availability']);
	return $availability;
}
add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 );
 
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {
  if ( $is_admin_email ) {
    echo '<p><strong>Payment Method:</strong> ' . $order->payment_method_title . '</p>';
  }
}
function art_woocommerce_sorting_attributes_list( $attr ) {

	return wp_list_sort( $attr, 'attribute_label', 'ASC' );
}


add_filter( 'woocommerce_attribute_taxonomies', 'art_woocommerce_sorting_attributes_list' );
function searchfilter($query) {
 
    if ($query->is_search && !is_admin() && !is_woocommerce()) {
        $query->set('post_type','post');
    }
 
return $query;
}
 
add_filter('pre_get_posts','searchfilter');
add_action( 'pre_get_posts', 'mov_vec_archive_page' );

function mov_vec_archive_page( $query ) {
	
	 // Evita añadir meta argumentos en las páginas de adminsitración de WordPress
    if (is_admin()) {
        return;
    }
	// Solo lo aplico a un CPT determinado y a una taxonomía personalizada
    if( $query->is_main_query() && is_post_type_archive( 'nombre_de_mi_cpt' ) || $query->is_main_query() && is_tax('nombre_de_mi_custom_taxonomy')  ) {
		
		//Obtenemos la meta query original
        $meta_query = (array)$query->get('meta_query');

        // Aplico la modificación de la query
        $query->set( 'posts_per_page', '8' );
		
        $meta_query = array(
			
			'agrupar_listado_por_campo_personalizado' => array(
				'key' => 'nombre_campo_personalziado_para_agrupar_posts',
			),
			
			'destacado_del_listado' => array(
				'key' => 'nombre_campo_personalizado_true_false_acf',
			),
		);

        // Set the meta query to the complete, altered query
        $query->set( 'meta_query', $meta_query );
		$query->set( 'orderby', array( 'agrupar_listado_por_campo_personalizado' => 'ASC', 'destacado_del_listado' => 'DESC', 'title' => 'ASC'  ) );
		
	}
}
function np_woocommerce_sorting_attributes_list( $attr ) {

	return wp_list_sort( $attr, 'attribute_label', 'ASC' );
}

add_filter( 'woocommerce_attribute_taxonomies', 'np_woocommerce_sorting_attributes_list' );
add_action('admin_init', function () {
    // Redirect any user trying to access comments page
    global $pagenow;
    
    if ($pagenow === 'edit-comments.php') {
        wp_safe_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);
    }
});
/wp-login.php?action=entered_recovery_mode
add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
function avia_add_heading_font($fonts) {
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
    return $fonts;
}

add_filter( 'avf_google_content_font', 'avia_add_content_font');
function avia_add_content_font($fonts) {
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
    return $fonts;
}
// show
return Responder::respondValid(
    [
        'Model' => Model::with($relationships)->find($consultTopicId)
    ]
);

// index
return Responder::respondValid(
  	[
      	'MemberProviderConsults' => ConsultLogResource::collection(
        	MemberProviderConsult::with(
            	$this->relations
            )->where('columns', $filter)->orderBy('id', 'desc')->get()
      )
  ]
);

// Store
 $models = Model::create(
    [
        'name' => $request->input('name')
        'description' => $request->input('description', null)
    ]
);

$model->BelongsToManyRelation()->sync($request->input('relatedModelIds'));

return Responder::respondValid(
    [
        'model' => $model
    ]
);

// Update
$model = Model::find($modelId);

if ($request->input('name')) {
    $model->update(
        [
            'name' => $request->input('name')
            'description' => $request->input('description', null)
        ]
    );
}
$model->belongsToManyRelation()->sync($request->input('relatedModelIds'));
$model->questions()->sync($request->input('otherRelatedModelIds'));

$this->updateRequiredQuestions($request, $model->id);

return Responder::respondValid(
    [
        'model' => $model->refresh()->load($this->relations)
    ]
);
GET /widgets/ HTTP/1.1
Host: api.mydomain.com
Origin: https://www.mydomain.com
[Rest of request...]
The easiest way is to JSON-encode your object and then decode it back to an array:

$array = json_decode(json_encode($object), true);

Or if you prefer, you can traverse the object manually, too:

foreach ($object as $value) 
    $array[] = $value->post_id;
<?php 

function get_subcategory_terms( $terms, $taxonomies, $args ) {
 
	$new_terms 	= array();
	$hide_category 	= array( 300 );  // 300 is the category id, replace it with yours
 	
 	  // if a product category and on the shop page
	if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop() ) {
	    foreach ( $terms as $key => $term ) {
		if ( ! in_array( $term->term_id, $hide_category ) ) { 
			$new_terms[] = $term;
		}
	    }
	    $terms = $new_terms;
	}
  return $terms;
}
add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
<?php
function plugin_hide() {
  global $wp_list_table;
  // replace your plugin url here
  $hidearr = array('advanced-custom-fields/acf.php' , 'otro-plugin/plugin.php');  
  
  $myplugins = $wp_list_table->items;
  foreach ($myplugins as $key => $val) {
    if (in_array($key,$hidearr)) {
      unset($wp_list_table->items[$key]);
    }
  }
}
add_action('pre_current_active_plugins', 'plugin_hide');
?>
add_filter( 'woocommerce_countries_inc_tax_or_vat', function( $tax_or_vat ) {
	return "Texto personalizado"; // Escribir nuevo texto o dejar en blanco para ocultar
} );

add_filter( 'woocommerce_countries_ex_tax_or_vat', function( $tax_or_vat ) {
	return "Texto personalizado"; // Escribir nuevo texto o dejar en blanco para ocultar
} );
After the Ethereum Merge Event, Ethereum has become more admired in the crypto industry. Meantime, the price of ethereum has skyrocketed. Do you wanna create an ethereum standard token? https://bit.ly/3TlCuwx 

Being the trusted Ethereum Token Development Company that rendering excellent Token Development Services on multiple ethereum standards such as ERC20, ERC1155, ERC223, ERC721, ERC777, ERC827, ERC 998, and ERC1400 to enhance your tokenomics business and platform.

For Instant Connect, 
Whatsapp +91 9384587998 || Telegram @maticzofficial

// Disable cropping of Big Preview on Single
function custom_blog_img_size($thumb,$current_post,$size) {
	return get_the_post_thumbnail($current_post["the_id"], 'large');
}
add_filter('avf_post_featured_image_link','custom_blog_img_size', 10, 3);
public function __construct() {

	$this->id = 'misha'; // payment gateway plugin ID
	$this->icon = ''; // URL of the icon that will be displayed on checkout page near your gateway name
	$this->has_fields = true; // in case you need a custom credit card form
	$this->method_title = 'Misha Gateway';
	$this->method_description = 'Description of Misha payment gateway'; // will be displayed on the options page

	// gateways can support subscriptions, refunds, saved payment methods,
	// but in this tutorial we begin with simple payments
	$this->supports = array(
		'products'
	);

	// Method with all the options fields
	$this->init_form_fields();

	// Load the settings.
	$this->init_settings();
	$this->title = $this->get_option( 'title' );
	$this->description = $this->get_option( 'description' );
	$this->enabled = $this->get_option( 'enabled' );
	$this->testmode = 'yes' === $this->get_option( 'testmode' );
	$this->private_key = $this->testmode ? $this->get_option( 'test_private_key' ) : $this->get_option( 'private_key' );
	$this->publishable_key = $this->testmode ? $this->get_option( 'test_publishable_key' ) : $this->get_option( 'publishable_key' );

	// This action hook saves the settings
	add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );

	// We need custom JavaScript to obtain a token
	add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
	
	// You can also register a webhook here
	// add_action( 'woocommerce_api_{webhook name}', array( $this, 'webhook' ) );
 }
/*
 * This action hook registers our PHP class as a WooCommerce payment gateway
 */
add_filter( 'woocommerce_payment_gateways', 'misha_add_gateway_class' );
function misha_add_gateway_class( $gateways ) {
	$gateways[] = 'WC_Misha_Gateway'; // your class name is here
	return $gateways;
}

/*
 * The class itself, please note that it is inside plugins_loaded action hook
 */
add_action( 'plugins_loaded', 'misha_init_gateway_class' );
function misha_init_gateway_class() {

	class WC_Misha_Gateway extends WC_Payment_Gateway {

 		/**
 		 * Class constructor, more about it in Step 3
 		 */
 		public function __construct() {

		...

 		}

		/**
 		 * Plugin options, we deal with it in Step 3 too
 		 */
 		public function init_form_fields(){

		...
	
	 	}

		/**
		 * You will need it if you want your custom credit card form, Step 4 is about it
		 */
		public function payment_fields() {

		...
				 
		}

		/*
		 * Custom CSS and JS, in most cases required only when you decided to go with a custom credit card form
		 */
	 	public function payment_scripts() {

		...
	
	 	}

		/*
 		 * Fields validation, more in Step 5
		 */
		public function validate_fields() {

		...

		}

		/*
		 * We're processing the payments here, everything about it is in Step 5
		 */
		public function process_payment( $order_id ) {

		...
					
	 	}

		/*
		 * In case you need a webhook, like PayPal IPN etc
		 */
		public function webhook() {

		...
					
	 	}
 	}
}
/*
 * This action hook registers our PHP class as a WooCommerce payment gateway
 */
add_filter( 'woocommerce_payment_gateways', 'misha_add_gateway_class' );
function misha_add_gateway_class( $gateways ) {
	$gateways[] = 'WC_Misha_Gateway'; // your class name is here
	return $gateways;
}

/*
 * The class itself, please note that it is inside plugins_loaded action hook
 */
add_action( 'plugins_loaded', 'misha_init_gateway_class' );
function misha_init_gateway_class() {

	class WC_Misha_Gateway extends WC_Payment_Gateway {

 		/**
 		 * Class constructor, more about it in Step 3
 		 */
 		public function __construct() {

		...

 		}

		/**
 		 * Plugin options, we deal with it in Step 3 too
 		 */
 		public function init_form_fields(){

		...
	
	 	}

		/**
		 * You will need it if you want your custom credit card form, Step 4 is about it
		 */
		public function payment_fields() {

		...
				 
		}

		/*
		 * Custom CSS and JS, in most cases required only when you decided to go with a custom credit card form
		 */
	 	public function payment_scripts() {

		...
	
	 	}

		/*
 		 * Fields validation, more in Step 5
		 */
		public function validate_fields() {

		...

		}

		/*
		 * We're processing the payments here, everything about it is in Step 5
		 */
		public function process_payment( $order_id ) {

		...
					
	 	}

		/*
		 * In case you need a webhook, like PayPal IPN etc
		 */
		public function webhook() {

		...
					
	 	}
 	}
}
/*
 * This action hook registers our PHP class as a WooCommerce payment gateway
 */
add_filter( 'woocommerce_payment_gateways', 'misha_add_gateway_class' );
function misha_add_gateway_class( $gateways ) {
	$gateways[] = 'WC_Misha_Gateway'; // your class name is here
	return $gateways;
}

/*
 * The class itself, please note that it is inside plugins_loaded action hook
 */
add_action( 'plugins_loaded', 'misha_init_gateway_class' );
function misha_init_gateway_class() {

	class WC_Misha_Gateway extends WC_Payment_Gateway {

 		/**
 		 * Class constructor, more about it in Step 3
 		 */
 		public function __construct() {

		...

 		}

		/**
 		 * Plugin options, we deal with it in Step 3 too
 		 */
 		public function init_form_fields(){

		...
	
	 	}

		/**
		 * You will need it if you want your custom credit card form, Step 4 is about it
		 */
		public function payment_fields() {

		...
				 
		}

		/*
		 * Custom CSS and JS, in most cases required only when you decided to go with a custom credit card form
		 */
	 	public function payment_scripts() {

		...
	
	 	}

		/*
 		 * Fields validation, more in Step 5
		 */
		public function validate_fields() {

		...

		}

		/*
		 * We're processing the payments here, everything about it is in Step 5
		 */
		public function process_payment( $order_id ) {

		...
					
	 	}

		/*
		 * In case you need a webhook, like PayPal IPN etc
		 */
		public function webhook() {

		...
					
	 	}
 	}
}
<?php
/*
 * Plugin Name: WooCommerce Custom Payment Gateway
 * Plugin URI: https://rudrastyh.com/woocommerce/payment-gateway-plugin.html
 * Description: Take credit card payments on your store.
 * Author: Misha Rudrastyh
 * Author URI: http://rudrastyh.com
 * Version: 1.0.1
 */
<?php
/*
 * Plugin Name: WooCommerce Custom Payment Gateway
 * Plugin URI: https://rudrastyh.com/woocommerce/payment-gateway-plugin.html
 * Description: Take credit card payments on your store.
 * Author: Misha Rudrastyh
 * Author URI: http://rudrastyh.com
 * Version: 1.0.1
 */
<?php echo do_shortcode(get_field('my_shortcode')); ?php>
<?php
/**
 * Prevent update notification for plugin
 * http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
 * Place in theme functions.php or at bottom of wp-config.php
 */
function disable_plugin_updates( $value ) {
  if ( isset($value) && is_object($value) ) {
    if ( isset( $value->response['theme-my-login/theme-my-login.php'] ) ) {
      unset( $value->response['theme-my-login/theme-my-login.php'] );
    }
  }
  return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );
// Limit 'the_content()' in wp
<div class="book-description">
<?php $content= get_the_content();
echo substr($content, 0,400)."..."."<a href='".get_permalink()."'>[Learn More]</a>";
?>
 </div> 
// Disable Sideber on custom archive
add_filter('avia_layout_filter', 'avia_change_post_layout', 10, 2);
function avia_change_post_layout($layout, $post_id){
    if(is_category('CATEGORY ID/NAME HERE'))
    {
        $layout['current'] = $layout["fullsize"];
        $layout['current']['main'] = "fullsize";
    }
    return $layout;
}
// Splide JS 
function splide_js() {
    if (is_singular('company')) {
        wp_enqueue_script( 'splide-js', 'https://cdn.jsdelivr.net/npm/@splidejs/splide@4.1.2/dist/js/splide.min.js', null, null, true );
        wp_enqueue_style('splide-css', 'https://cdn.jsdelivr.net/npm/@splidejs/splide@4.1.2/dist/css/splide.min.css');
        
    }
}

add_action('wp_enqueue_scripts','splide_js');

// Splide JS Markup
<section class="splide" aria-label="Splide Basic HTML Example">
  <div class="splide__track">
		<ul class="splide__list">
			<li class="splide__slide">Slide 01</li>
			<li class="splide__slide">Slide 02</li>
			<li class="splide__slide">Slide 03</li>
		</ul>
  </div>
</section>
single-cpt.php

<?php
	if ( ! defined( 'ABSPATH' ) ){ die(); }

	global $avia_config, $wp_query;

	/*
	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
	 */
	get_header(); ?>

        <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
			<div class='container'>
				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
        		
        		<!--CUSTOM MARKUP GOES BELOW -->
                TEST
				
				<!--end content-->
				</main>

			</div><!--end container-->

		</div><!-- close default .container_wrap element -->



<?php
		get_footer();
[gravityform id="1" title="false" description="false" ajax="true" tabindex="124"]
// Avia Layout Builder in custom post types

function avf_alb_supported_post_types_mod( array $supported_post_types )
{
  $supported_post_types[] = 'case_studies';
  return $supported_post_types;
}
add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);

function avf_metabox_layout_post_types_mod( array $supported_post_types )
{
 $supported_post_types[] = 'case_studies';
 return $supported_post_types;
}
add_filter('avf_metabox_layout_post_types', 'avf_metabox_layout_post_types_mod', 10, 1);
// Fa Fa Icons Script
function site_styles() {
    wp_register_style('fontawesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css', array(), false, 'all');
    wp_enqueue_style('fontawesome');
}
add_action('wp_enqueue_scripts', 'site_styles');
// Shortcold for HTML 
function vip_svg() { 
	ob_start(); ?>
	<a href="/pricing/vip/">
		<HTML>
	</a>
<?php return ob_get_clean(); 
}

add_shortcode('vip_svg_code', 'vip_svg');
function enqueue_custom_fonts()
{
    wp_register_style('custom-fonts', get_stylesheet_directory_uri() . '/fonts/custom-fonts.css', array(), '1.0', 'all');
    wp_enqueue_style('custom-fonts'); 
    
    
}

add_action('wp_enqueue_scripts', 'enqueue_custom_fonts');
// Shortcode [insight_posts category='' number='']

function insight_posts_shortcode( $atts, $content = null ) {
    loadmoreinsights_scripts();
    $atts = shortcode_atts(
        array(
            'uid' => '',
            'category' => '',
            'number' => '-1',
        ),
        $atts,
        'insight_posts'
    );

    $args = array(
        'post_type' => 'insight',
        'post_status' => 'publish',
        'posts_per_page' => $atts['number'],
        'orderby' => 'date',
        'order' => 'DESC',
        'meta_query' => array(
            array(
                'key' => 'insight_category',
                'value' => $atts['category'],
                'compare' => '='
            )
        )
    );
    $insight_posts_query = new WP_Query( $args );
    ob_start(); ?>

    
    
    <?php
    if ( $insight_posts_query->have_posts() ) { ?>
        
        <div id="<?php echo $atts['uid']; ?>" class="insights-post-wrap">
        
        <?php while( $insight_posts_query->have_posts() ) { $insight_posts_query->the_post(); ?>
        
            <div class="insights-post">
                <div class="insights-post-date"><?php echo get_the_date(); ?></div>
                <?php if(get_field('insight_pdf')) { ?>
                    <div class="insights-title-link"><a target="_blank" href="<?php the_field('insight_pdf'); ?>"><h3 class="insights-post-title"><?php the_title(); ?></h3></a></div>
                <?php } else { ?>
                    <div class="insights-title-link"><a href="<?php the_permalink(); ?>"><h3 class="insights-post-title"><?php the_title(); ?></h3></a></div>
                <?php } ?>
                <?php if(get_field('video_html')) { ?>
                    <div class="insights-post-video"><?php the_field('video_html'); ?></div>
                <?php } ?>
                <div class="insights-post-exceprt"><?php the_field('insight_synopsis'); ?></div>
                
                <?php if(get_field('insight_pdf')) { ?>
                    <div class="insights-post-link"><a target="_blank" href="<?php the_field('insight_pdf'); ?>">Learn More..</a></div>
                <?php } else { ?>
                    <div class="insights-post-link"><a href="<?php the_permalink(); ?>">Read more..</a></div>
                <?php } ?>
    
            </div>

        <?php } ?>
        
        </div>
        <?php
        wp_reset_postdata();
    } else {
        
        echo '<p>Nothing found</p>';
    }
    return ob_get_clean();
}

add_shortcode( 'insight_posts', 'insight_posts_shortcode' );
<?php
      if ( !defined('ABSPATH') ){ die(); }

      global $avia_config;

      /*
       * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
       */
       get_header();

      $title  = __('Blog - Latest News', 'avia_framework'); //default blog title
      $t_link = home_url('/');
      $t_sub = "";

      if(avia_get_option('frontpage') && $new = avia_get_option('blogpage'))
      {
            $title      = get_the_title($new); //if the blog is attached to a page use this title
            $t_link = get_permalink($new);
            $t_sub =  avia_post_meta($new, 'subtitle');
      }

      if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title(array('heading'=>'strong', 'title' => $title, 'link' => $t_link, 'subtitle' => $t_sub));

      do_action( 'ava_after_main_title' );

?>
        <!-- Insight Heading AREA  -->
        
        <div class='insight-heading-wrap container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>

            <div class='container template-blog template-single-blog'>

                  <main class='content units <?php avia_layout_class( 'content' ); ?> <?php echo avia_blog_class_string(); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
                        <div class="post-entry post-entry-type-page post-entry-156">
                            <div class="entry-content-wrapper clearfix">
                                <div class="insight-heading-block">
                                    <h1 class="av-special-heading-tag insight-heading"><?php the_title(); ?></h1>
                                    <span class="insighe-subheading"><?php the_field('insight_subtitle'); ?></span>
                                </div>
                            </div>
                         </div>
                  <!--end content-->
                  </main>

            </div><!--end container-->

      </div>
      
      <!-- Insight BODY AREA  -->
      
      <div class='insight-content-wrap container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>

            <div class='container template-blog template-single-blog'>

                  <main class='content units <?php avia_layout_class( 'content' ); ?> <?php echo avia_blog_class_string(); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
                        <div class="post-entry post-entry-type-page post-entry-156">
                            <div class="entry-content-wrapper clearfix">
                                  <div class="insights-inner">
                                        <?php
                                        if (have_posts()) :
                                              while (have_posts()) : the_post();
                                              the_content();
                                            endwhile;
                                        endif; ?>
                                  </div>
                            </div>
                         </div>
                  <!--end content-->
                  </main>

                  <?php
                  $avia_config['currently_viewing'] = "blog";
                  //get the sidebar
                  get_sidebar();

                  ?>

            </div><!--end container-->

      </div><!-- close default .container_wrap element -->
      
      <?php if(get_field('video_html')) { ?>
          
          <!-- Insight VIDEO AREA  -->
            
            <div class='insight-video-wrap container_wrap container_wrap_first alternate_color <?php avia_layout_class( 'main' ); ?>'>
    
                <div class='container template-blog template-single-blog'>
    
                      <main class='content units <?php avia_layout_class( 'content' ); ?> <?php echo avia_blog_class_string(); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
                            <div class="post-entry post-entry-type-page post-entry-156">
                                <div class="entry-content-wrapper clearfix">
                                    <div class="insights-video">
                                        <?php echo get_field('video_html'); ?>
                                    </div>
                                </div>
                             </div>
                      <!--end content-->
                      </main>
    
                </div><!--end container-->
    
            </div>
        <?php } ?>


<?php get_footer();
function _thz_enable_vcard_upload( $mime_types ){
  	$mime_types['vcf'] = 'text/vcard';
	$mime_types['vcard'] = 'text/vcard';
  	return $mime_types;
}
add_filter('upload_mimes', '_thz_enable_vcard_upload' );
function breadcrumbs() {

	// Code
	if(!is_home()) {
		$output  = '<nav class="breadcrumbs">';
		$output .= '<a href="'.home_url('/').'">Home</a> <span class="divider">/</span> ';
		if (is_category() || is_single()) {
		$output .=	'<a href="'.home_url('/insights/').'">Insights</a>';
			if (is_single()) {
		$output .=	' <span class="divider">/</span> ';
		$output .=	get_the_title();
			}
		} elseif (is_page()) {
		$output .= get_the_title();
		}
		$output .= '</nav>';
	}
	return $output;
}

add_shortcode( 'breadcrumbs', 'breadcrumbs' );
Route:: get ('/', function () {
     \Illuminate\Support\Facades \DB::listen (function ($query) {
         logger($query->sql, $query->bindings); // Helper fn for \Log::info();
     });
     return view ('posts', [
          'posts' => Post::all()
     ]);
 });
$insert_eigenes_turnier_check = $wpdb->insert(
  'tman_anmeldung',
  array(
    'anmeldung_verein' => $anmeldung_verein,
    'anmeldung_verein_id' => $verein_id,
    'turnier_id' => $turnier_id,
    'status_id' => 3,
    'anmeldung_manuell' => 1,
    'anmeldung_gebuehr_bezahlt' => 2,   //2=offen, 1=gebühr erhalten
    'anmeldung_trainer_vorname' => $trainer_vorname,
    'anmeldung_trainer_nachname' => $trainer_nachname,
    'anmeldung_email' => $anmeldung_email,
    'anmeldung_telefon' => $anmeldung_telefon,
    'anmeldung_jugend' => $anmeldung_jugend,
    'anmeldung_nachricht' => "",
    'anmeldung_datum' => $datetime_heute,
    'user_id' => $user_id
  )
);
$anmeldung_id = $wpdb->insert_id;
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
 deny from all
</Files>
public function lastMessages() {
 return $this->hasMany('App\Message', 'recipient_id')->latest()->get()->unique('author_id')
<?php
if(isset($_POST['Submit'])){

  $emp_name=trim($_POST["emp_name"]);
  $emp_number=trim($_POST["emp_number"]);
  $emp_email=trim($_POST["emp_email"]);

  if($emp_name =="") {
    $errorMsg=  "error : You did not enter a name.";
    $code= "1" ;
  }
  elseif($emp_number == "") {
    $errorMsg=  "error : Please enter number.";
    $code= "2";
  }
  //check if the number field is numeric
  elseif(is_numeric(trim($emp_number)) == false){
    $errorMsg=  "error : Please enter numeric value.";
    $code= "2";
  }
  elseif(strlen($emp_number)<10){
    $errorMsg=  "error : Number should be ten digits.";
    $code= "2";
  }
  //check if email field is empty
  elseif($emp_email == ""){
    $errorMsg=  "error : You did not enter a email.";
    $code= "3";
} //check for valid email 
elseif(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $emp_email)){
  $errorMsg= 'error : You did not enter a valid email.';
  $code= "3";
}
else{
  echo "Success";
  //final code will execute here.
}

}
?>
<?php

    class AcessoBD{

        private $conn;
        private $host;
        private $dbname;
        private $username;
        private $password;

        public function __construct($dbname){
            $this ->host="localhost";
            $this ->dbname=$dbname;
            $this ->username="root";
            $this ->password="";
            $this ->setConn();
        }

        private function setConn(){
            try {
                $this ->conn = new PDO("mysql:host=".$this->host.";dbname=".$this->dbname, $this->username, $this->password);
                $this ->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            } catch(PDOException $e) {
                echo 'ERROR: ' . $e->getMessage();
            }
        }

        public function select($sql,$parametros){
            $stmt = $this ->conn->prepare($sql);
            $stmt->execute($parametros);
            return $stmt ->fetchAll();
        }
    }
 
 ?>
<?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
	private $textTag; 
	
	//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;
		$this->textTag="";
	}


	//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) {
			if ($this->textTag==""){
				foreach ($this->subelementos as $subelemento){
					$codigo.=$subelemento->getCodigo(); 
				}
			}else{
				$codigo.=$this->textTag."\n";
			}
			
			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;
	}

	public function addTextToTag($textTag) {
		$this->textTag=$textTag;
	}
    
	
} 

?>
 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 / {
      # First attempt to serve request as file, then
      # as directory, then fall back to displaying a 404.
      try_files $uri $uri/ @extensionless-php;
    }

    location @extensionless-php {
      if ( -f $document_root$uri.php ) {
        rewrite ^ $uri.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 );     
}
// 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 );
<?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://gwfh.mranftl.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>


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML aside Tag</title>
</head>
<body>
	<h1>Apollo 13 Mission</h1>
	<p>This is paragraph</p>
	<p>[...]</p>
    <aside>
		<h1>Apollo 13 Facts</h1>
		<p>The aside element represents a section of the web page that encloses content which is tangentially related to the content around it.</p>
	</aside>
</body>
</html>


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of HTML article Tag</title>
</head>
<body>
    <article>
		<h1>Introduction to HTML</h1>
		<p>HTML is a markup language that is used for creating web pages.</p>
	</article>
</body>
</html>


<!DOCTYPE html>
<html>
<body>

<h1>The map and area elements</h1>

<p>Click on the computer, the phone, or the cup of coffee to go to a new page and read more about the topic:</p>

<img src="/img/favicon.png" alt="Workplace" usemap="#workmap" width="400" height="379">

<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>

</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML address tag </title>
</head>
<body>
    <address>
        Written by <a href="mailto:hello@example.com">Alson</a>.<br> 
        Contact us at:<br>
        street NO:, Hollywood<br>
        USA
    </address>
</body>
</html> 

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

But when I saw my app/Providers/RouteServiceProvider.php file, I had namespaces inside my boot method. Then I just uncommented this => protected $namespace = 'App\\Http\\Controllers'; Now my project is working
<div class="table-questions border-top-none">
        @foreach($questions as $key => $v)
            @php
                $question = $v['questions'][0];
                $questionType = $question['type'];
                $question_order = $question['order'];
            @endphp
            @if ($questionType === 'MCQSA')
                @include('teacher.subject_teacher.assessment_course.regular.type._pilihan_ganda')
            @elseif ($questionType === 'QSAT_C_INSENSITIVE')
                @include('teacher.subject_teacher.assessment_course.regular.type._isian_bahasa')
            @elseif ($questionType === 'EQ')
                @include('teacher.subject_teacher.assessment_course.regular.type._esai')
            @endif
        @endforeach
    </div>
<?php

$filename = 'readme.txt';

if (file_exists($filename)) {
    $message = "The file $filename exists";
} else {
    $message = "The file $filename does not exist";
}
echo $message;
Code language: HTML, XML (xml)
echo 'hello worl;'
#!/bin/bash
for i in {6000..18000..4000}
  do 
    bin/console fos:elastica:populate --no-reset --first-page="$i" --last-page="$((i + 4000))"
  done
bin/console fos:elastica:populate --no-reset --first-page=18000
/**
 * Implements hook_preprocess_HOOK().
 */
function carters_core_preprocess_facets_result_item(&$variables) {
  if ($variables['facet']->get('name') == 'Popust') {
    $variables['value'] = $variables['value'] . '%';
  }
}
$types = [];
$contentTypes = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
foreach ($contentTypes as $contentType) {
  $types[] = $contentType->id();
}
public function deletePayment($id)
{
    return response()->json(Api::schoolPayment()->destroy($id)->toArray());
}

//ROOT

Route::get('/delete-payment/{id}', 'Teacher\ExampleController@deletePayment');

public function getDetailSummary($id)
{
    $dataSummary = Api::libraryAssessment()->summary($id)->data();

    return response()->json($dataSummary);
}

//ROOT

Route::get('/summary/{id}', 'Teacher\AssessmentCourseController@getDetailSummary');
<?php

/**
 * @file
 * Contains musin_core.module.
 */

use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Url;

/**
 * Implements hook_views_data_alter().
 */
function musin_core_views_data_alter(array &$data) {

  $data['private_message_threads']['members_list'] = [
    'title' => t('Member(s) name list'),
    'help' => t('The member(s) name of the private message thread'),
    'field' => [
      'id' => 'musin_core_private_message_members_list',
    ],
  ];

  $data['private_message_threads']['members_pictures'] = [
    'title' => t('Member(s) pictures'),
    'help' => t('The member(s) pictures of the private message thread'),
    'field' => [
      'id' => 'musin_core_private_message_members_pictures',
    ],
  ];

  $data['private_message_threads']['thread_last_message'] = [
    'title' => t('Last message'),
    'help' => t('The last message of the private message thread'),
    'field' => [
      'id' => 'musin_core_private_message_thread_last_message',
    ],
  ];

  $data['private_message_threads']['thread_is_unread'] = [
    'title' => t('Is unread or not'),
    'help' => t('The last message is unreaded of the private message thread'),
    'field' => [
      'id' => 'musin_core_private_message_thread_is_unread',
    ],
  ];

}

/**
 * Implements hook_entity_extra_field_info().
 */
function musin_core_entity_extra_field_info() {
  $extra_field = [];

  $extra_field['private_message']['private_message']['display']['author_image'] = [
    'label' => t('Author image'),
    'description' => t('Author image.'),
    'weight' => 100,
    'visible' => TRUE,
  ];

  $extra_field['private_message']['private_message']['display']['author_name'] = [
    'label' => t('Author name'),
    'description' => t('Author name.'),
    'weight' => 100,
    'visible' => TRUE,
  ];

  return $extra_field;
}

/**
 * Implements hook_ENTITY_TYPE_view().
 */
function musin_core_private_message_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {

  if ($display->getComponent('author_image')) {

    /** @var \Drupal\musin_core\MessagesService $messages_service */
    $messages_service = \Drupal::service('musin_core.messages.service');

    $build['author_image'] = $messages_service->getUserPictureElement($entity->getOwner());

  }
  if ($display->getComponent('author_name')) {

    /** @var \Drupal\private_message\Entity\PrivateMessage $entity*/
    //$author_name = $entity->getOwner()->get('field_first_name')->value . ' ' . $entity->getOwner()->get('field_last_name')->value;
    $author_name = $entity->getOwner()->get('name')->value;

    $build['author_name'] = [
      '#type' => 'markup',
      '#markup' => $author_name,
    ];

  }
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function musin_core_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $view = $form_state->getStorage('view');

  if ($view && $view['view']->id() == 'search') {
    $form['search_api_fulltext_1']['#prefix'] = '<div class="search-dropdown">';
    $form['field_genres']['#suffix'] = '</div>';
    $form['field_instruments']['#options']['All'] = 'Instruments';
    $form['field_genres']['#options']['All'] = 'Genres';
  }
}

/**
 * Implements hook_form_FORM_ID_alter().
 * Redirect user to profile page after saving the profile
 */

function musin_core_form_alter(&$form, $form_state, $form_id) {
  if ($form_id === 'user_form') {
    $form['#after_build'][] = '_musin_core_user_edit_change_password_label';
    $form['actions']['submit']['#submit'][] = 'musin_core_user_edit_form_submit';
  }

  if ($form_id === 'node_gig_edit_form') {
    $form['revision_information']['#access'] = FALSE;
  }
}

function _musin_core_user_edit_change_password_label($form, &$form_state) {
  //dsm($form['group_email_password_artist_name']['#groups']);
  $form['group_email_password_artist_name']['#groups']['group_email_password_artist_name'][0]['pass']['pass1']['#title'] = t('New password');
  $form['group_email_password_artist_name']['#groups']['group_email_password_artist_name'][0]['pass']['pass2']['#title'] = t('Confirm new password');

  return $form;
}


/**
 * Implements hook_field_widget_file_generic_form_alter().
 */
function musin_core_field_widget_file_generic_form_alter(&$element, FormStateInterface $form_state, $context) {
  if ($context['form']['#parents'][0] == "field_sample_tracks") {
    $element['#after_build'][] = '_set_description_field_required';
  }
}

function _set_description_field_required($element, FormStateInterface $form_state) {
  if (isset($element['description'])) {
    $element['description']['#required'] = TRUE;
  }
  return $element;
}

function musin_core_user_edit_form_submit($form, &$form_state) {
  $form_state->setRedirect('entity.user.canonical', ['user' => \Drupal::currentUser()->id()]);
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function musin_core_form_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form['#submit'][] = 'musin_core_user_login_form_submit';
}

/**
 * Custom submit handler for the login form.
 */
function musin_core_user_login_form_submit($form, FormStateInterface $form_state) {
  $url = Url::fromRoute('<front>');
  $form_state->setRedirectUrl($url);
}

/**
 * Implements hook_preprocess_HOOK().
 */
function musin_core_preprocess_region(&$variables) {
  if ($variables['region'] == 'primary_navigation') {
    $variables['#cache']['contexts'][] = 'user';
  }
}

/**
 * Implements hook_entity_presave().
 *
 * @param \Drupal\Core\Entity\EntityInterface $entity
 * @param $term
 */
function musin_core_entity_presave(EntityInterface $entity) {
  if ($entity instanceof \Drupal\user\UserInterface) {
    $completeness = \Drupal\musin_core\Services\UserHelperService::getProfileCompleteness($entity);
    $entity->set('field_completeness', $completeness);
//    // Add typed in instrument to users profile view.
//    $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties([
//      'field_typed_in_instrument' => 1
//    ]);
//    $term = reset($terms);
//    if ($term !== false) {
//      $entity->set('field_typed_in_instrument', $term);
//    }
  }


  // Moving typed in instruments to their vocabulary.
  if ($entity instanceof \Drupal\taxonomy\Entity\Term) {
    $name = $entity->get('name')->value;
    if ($entity->get('vid')->getValue()[0]['target_id'] == 'instruments' && $entity->get('field_typed_in_instrument')->value === 1) {
      $entity->set('vid', 'extra_instruments');
    } else if ($entity->get('vid')->getValue()[0]['target_id'] == 'genres' && $entity->get('field_typed_in_genre')->value === 1) {
      $entity->set('vid', 'extra_genres');
    }
  }

}
<?php

/**
 * @file
 * Contains fontana_commerce.module.
 */

use Drupal\commerce\EntityHelper;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\RedirectCommand;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\commerce_product\Entity\ProductVariationInterface;

/**
 * Implements hook_views_data_alter().
 */
function fontana_commerce_views_data_alter(array &$data) {

  $data['views']['custom_category_filter'] = [
    'title' => t('Custom category filter'),
    'filter' => [
      'title' => t('Custom category filter'),
      'help' => t('Provides a custom filter logic.'),
      'field' => 'nid',
      'id' => 'category_views_filter',
    ],
  ];

  $data['views']['sku_filter'] = [
    'title' => t('SKU filter'),
    'filter' => [
      'title' => t('SKU filter'),
      'help' => t('Provides a custom filter for filtering orders by sku.'),
      'field' => 'id',
      'id' => 'sku_filter',
    ],
  ];

  $data['commerce_shipment']['shipping_profile'] = [
    'title' => t('Shipping Profile'),
    'help' => t('Reference to the shipping profile of a commerce shipment.'),
    'relationship' => [
      'group' => 'Shipment',
      // Views name of the table being joined to from commerce_shipment.
      'base' => 'profile',
      // Database field name in profile for the join.
      'base field' => 'profile_id',
      // Real database field name in commerce_shipment for the join, to override
      // 'unique_dummy_name'.
      'field' => 'shipping_profile__target_id',
      // ID of relationship handler plugin to use.
      'id' => 'standard',
      'label' => t('Shipping Profile'),
    ],
  ];

  $data['commerce_order']['quick_view'] = [
    'title' => t('Quick view'),
    'field' => [
      'id' => 'commerce_order_quick_view',
    ],
  ];

  $data['commerce_order']['update_state']['field'] = [
    'title' => t('Update state'),
    'help' => t('Add buttons for update the order state.'),
    'id' => 'commerce_order_update_state',
  ];

}

/**
 * Implements hook_entity_extra_field_info().
 */
function fontana_commerce_entity_extra_field_info() {
  $extra = [];

  $extra['commerce_product']['default']['display']['manufacturer_declaration'] = [
    'label' => t('Manufacturer(display: declaration)'),
    'visible' => FALSE,
  ];

  $extra['commerce_product']['default']['display']['variation_sizes'] = [
    'label' => t('Product variations size attribute'),
    'visible' => TRUE,
  ];

  $extra['commerce_product']['default']['display']['variation_colors'] = [
    'label' => t('Product variations color attribute'),
    'visible' => TRUE,
  ];

  return $extra;
}

/**
 * Implements hook_entity_view().
 */
function fontana_commerce_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
  if ($entity->getEntityTypeId() === 'commerce_product' && $entity->bundle() === 'default' && $display->getComponent('manufacturer_declaration')) {
    if ($entity->hasField('field_manufacturer')) {
      /** @var \Drupal\taxonomy\Entity\Term $manufacturer */
      if ($manufacturer = $entity->get('field_manufacturer')->entity) {
        $view_builder = \Drupal::entityTypeManager()->getViewBuilder('taxonomy_term');
        $build['manufacturer_declaration'] = $view_builder->view($manufacturer, 'declaration');
      }
    }
  }

  if ($view_mode === 'teaser' && $entity->getEntityTypeId() === 'commerce_product' && $entity->bundle() === 'default') {
    $sizes = [];
    $colors = [];

    /** @var \Drupal\commerce_product\Entity\ProductVariationInterface $variation */
    foreach ($entity->getVariations() as $variation) {
      if ($size = $variation->getAttributeValue('attribute_size')) {
        $sizes[] = $size->label();
      }

      if ($color = $variation->getAttributeValue('attribute_boja')) {
        $colors[] = $color->label();
      }
    }

    if ($display->getComponent('variation_sizes')) {
      $build['variation_sizes'] = [
        '#type' => 'html_tag',
        '#tag' => 'div',
        '#value' => implode(', ', array_unique($sizes)),
        '#attributes' => [
          'class' => ['size-wrapper'],
        ],
      ];
    }

    if ($display->getComponent('variation_colors')) {
      $build['variation_colors'] = [
        '#type' => 'html_tag',
        '#tag' => 'div',
        '#value' => implode(', ', array_unique($colors)),
        '#attributes' => [
          'class' => ['color-wrapper'],
        ],
      ];
    }
  }
}

/**
 * Implements hook_form_alter().
 */
function fontana_commerce_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  // Get add to cart form from product page.
  if (
    str_contains($form_id, "commerce_order_item_dc_ajax_add_cart_form_commerce_product") ||
    str_contains($form_id, 'commerce_order_item_add_to_cart_form_commerce_product')
  ) {
    // Check if product contain variations.
    if (isset($form['purchased_entity']['widget'][0]['variation']['#options'])) {
      // Get variations.
      $variations = $form['purchased_entity']['widget'][0]['variation']['#options'];
      foreach ($variations as $key => $item) {
        // Load variation by key(id).
        $variation = \Drupal::entityTypeManager()->getStorage('commerce_product_variation')->load($key);
        // Set boja if exists.
        !empty($variation->get('attribute_boja')->target_id) ? $color = $variation->get('attribute_boja')->entity->getName() : $color = "";
        // Set size if exists.
        !empty($variation->get('attribute_size')->target_id) ? $size = $variation->get('attribute_size')->entity->getName() : $size = "";
        // If both fields are empty use default option.
        if (!empty($size) || !empty($color)) {
          $form['purchased_entity']['widget'][0]['variation']['#options'][$key] = $size . " " . $color;
        }
        $item_title = $variation->getTitle();
        $variation_images = $variation->get('field_image')->getValue();
        $images = [];
        foreach ($variation_images as $image) {
          if (empty($image['title'])) {
            $image['title'] = $item_title;
          }
          if (empty($image['alt'])) {
            $image['alt'] = $item_title;
          }
          $images[] = $image;
        }
        $variation->set('field_image', $images);
      }
    }
    if (isset($form['purchased_entity']['widget'][0]['variation'])) {
      if (isset($form['purchased_entity']['widget'][0]['variation']['#value'])) {
        $variation_id = $form['purchased_entity']['widget'][0]['variation']['#value'];
      }
      else {
        $variation_id = $form['purchased_entity']['widget'][0]['variation']['#default_value'];
      }
      $variation = \Drupal::entityTypeManager()->getStorage('commerce_product_variation')->load($variation_id);
      $square_meter_per_box = $variation->get('field_square_meters_per_box')->value;
      if (!empty($square_meter_per_box)) {
        $form['quantity']['widget'][0]['value']['#step'] = '0.01';
      }
    }
  }
  // Get checkout flow form and step order information.
  if ($form_id == 'commerce_checkout_flow_multistep_default' && $form['#step_id'] == 'order_information') {
    $form['actions']['captcha'] = [
      '#type' => 'captcha',
      '#captcha_type' => 'recaptcha/reCAPTCHA',
    ];
  }

  if ($form_id == 'commerce_order_default_edit_form') {
    $order_id = \Drupal::routeMatch()->getRawParameter('commerce_order');
    $order = \Drupal::entityTypeManager()->getStorage('commerce_order')->load($order_id);
    $payment_gateway = $order->payment_gateway->first()->entity;
    if (!empty($payment_gateway)) {
      $payment_label = $payment_gateway->label();
      $form['payment_gateway'] = [
        '#type' => 'details',
        '#group' => 'advanced',
        '#open' => TRUE,
        '#title' => t('Payment Method'),
        'payment_gateway' => [
          '#type' => 'item',
          '#markup' => $payment_label,
        ],
      ];
    }
  }

  $input = $form_state->getUserInput();
  $is_ajax = (bool) ($input['_drupal_ajax'] ?? FALSE);
  if (str_contains($form_id, 'state_machine_transition_form_commerce_order_state') && $is_ajax) {
    foreach ($form['actions'] as $name => $action) {
      if (strpos($name, '#') !== FALSE) {
        continue;
      }
      $form['actions'][$name]['#ajax'] = [
        'callback' => 'fontana_commerce_order_state_ajax',
      ];
    }
  }
}

/**
 * Ajax callback for the order state form.
 *
 * @param array $form
 *   The form.
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *   The form state.
 *
 * @return \Drupal\Core\Ajax\AjaxResponse
 *   The ajax response.
 */
function fontana_commerce_order_state_ajax(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();

  $destination = \Drupal::request()->query->get('destination');
  $response->addCommand(new RedirectCommand($destination));

  return $response;
}

/**
 * Implements hook_element_info_alter().
 */
function fontana_commerce_element_info_alter(array &$info) {
  if (isset($info['address'])) {
    $info['address']['#process'][] = 'fontana_commerce_make_address_line2_visible';
  }
}

/**
 * Process callback for address element.
 */
function fontana_commerce_make_address_line2_visible(array &$element, FormStateInterface $form_state, array &$complete_form) {
  $element['address_line2']['#title_display'] = 'before';
  return $element;
}

/**
 * Implements hook_preprocess_HOOK().
 */
function fontana_commerce_preprocess_commerce_product(&$variables) {
  /** @var \Drupal\commerce_product\Entity\ProductInterface $product_entity */
  $product_entity = $variables['product_entity'];
  $variation = $product_entity->getDefaultVariation();

  if (!$variation instanceof ProductVariationInterface) {
    $variables['calculator_visible'] = FALSE;
  }
  else {
    /** @var \Drupal\presentcommerce_box_calculator\Service\BoxCalculator $box_calculator */
    $box_calculator = \Drupal::service('presentcommerce_box_calculator.box_calculator');
    if ($box_calculator->isVisible($variation)) {
      $variables['calculator_visible'] = TRUE;
    }
    else {
      $variables['calculator_visible'] = FALSE;
    }
  }
}

/**
 * Implements hook_entity_presave().
 */
function fontana_commerce_entity_presave(EntityInterface $entity) {
  // Check if entity is product variation and if autogenerate title is selected.
  if ($entity->getEntityTypeId() == "commerce_product_variation" && $entity->get('field_auto_generate_title')->value == TRUE) {
    $title = generate_variation_title($entity);
    $entity->setTitle($title);
  }
  elseif ($entity->getEntityTypeId() == "commerce_product_variation") {
    $title_alt = generate_image_title_alt($entity);
    if ($title_alt !== "") {
      $entity->set('field_image', $title_alt);
    }
  }

  if ($entity->getEntityTypeId() == 'commerce_product') {
    $userId = \Drupal::currentUser()->id();
    $user = \Drupal::entityTypeManager()->getStorage('user')->load($userId);
    $entity->set('field_updated_by', $user);
  }
   if ($entity->getEntityTypeId() == 'commerce_order_item' && $entity->getPurchasedEntity()->get('field_square_meters_per_box')->value !== NULL) {
     $quantity = $entity->getQuantity();
     $product = \Drupal::entityTypeManager()
       ->getStorage('commerce_product_variation')
       ->load($entity->getPurchasedEntityId());
     $square_meters = $product->get('field_square_meters_per_box')->value;
     $number_of_boxes = (integer) round($quantity / $square_meters);
     if ($number_of_boxes < 1) {
       $number_of_boxes = 1;
     }
     $entity->set('field_number_of_boxes', $number_of_boxes);
   }
}

/**
 * Generate Variation title based on attributes.
 */
function generate_variation_title(EntityInterface $entity) {
  if (!$entity->getProductId()) {
    // Title generation is not possible before the parent product is known.
    return '';
  }

  $product_title = $entity->getProduct()->getTitle();
  if ($attribute_values = $entity->getAttributeValues()) {
    $attribute_labels = EntityHelper::extractLabels($attribute_values);
    $title = $product_title . ' - ' . implode(', ', $attribute_labels);
  }
  else {
    // When there are no attribute fields, there's only one variation.
    $title = $product_title;
  }

  return $title;
}

/**
 * Generate Variation title based on attributes.
 */
function generate_image_title_alt(EntityInterface $entity) {

  if (!$entity->getProductId()) {
    // Title generation is not possible before the parent product is known.
    return '';
  }

  $product_title = $entity->getProduct()->getTitle();

  $variation_images = $entity->get('field_image')->getValue();
  $images = reset($variation_images);
  foreach ($variation_images as $image) {
    if (empty($image['alt'])) {
      $image['alt'] = $product_title;
    }
    if (empty($image['title'])) {
      $image['title'] = $product_title;
    }
    $images[] = $image;
  }
  return $images;
}

/**
 * Implements hook_page_attachments().
 */
function fontana_commerce_page_attachments(array &$attachments) {
  $config = \Drupal::config('system.theme');
  $theme = \Drupal::theme()->getActiveTheme()->getName();
  if ($theme == $config->get('admin')) {
    $attachments['#attached']['library'][] = 'fontana_commerce/extra.admin';
  }
}

/**
 * Implements hook_field_widget_form_alter().
 */
function fontana_commerce_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
  // Fix problem with displaying description on shipping pane
  // for single shipping method.
  if ($context['items']->getFieldDefinition()->getName() === 'shipping_method' && $context['items']->getFieldDefinition()->getTargetEntityTypeId() === 'commerce_shipment') {
    foreach ($element['#options'] as $key => $option) {
      $title = $element[$key]["#rate"]->getService()->getLabel();
      $option = (new FormattableMarkup('@service @amount', [
        '@service' => $title,
        '@amount' => '',
      ]));
      $element['#options'][$key] = $option;
    }
  }
}

/**
 * Implements hook_form_BASE_FORM_ID_alter().
 */
function fontana_commerce_form_views_form_commerce_cart_form_default_alter(&$form, FormStateInterface $form_state) {
  $order_items = $form['output'][0]['#view']->result[0]->_entity->getItems();
  foreach ($order_items as $key => $order_item) {
    $purchased_entity = $order_item->getPurchasedEntity();
    if (!empty($purchased_entity->get('field_square_meters_per_box')->getValue())) {
      $form['edit_quantity'][$key]['#step'] = '0.01';
    }
  }
}
<?php

namespace Drupal\musin_core\Plugin\Field\FieldWidget;

use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\WidgetBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Custom field widget for instruments.
 *
 * @FieldWidget(
 *   id = "instruments_widget",
 *   label = @Translation("Instruments widget"),
 *   description = @Translation("Instruments widget"),
 *   field_types = {
 *     "entity_reference",
 *     "string"
 *   }
 * )
 */
class InstrumentsWidget extends WidgetBase {

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityTypeManagerInterface $entityTypeManager) {
    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
    $this->entityTypeManager = $entityTypeManager;
  }

  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $plugin_id,
      $plugin_definition,
      $configuration['field_definition'],
      $configuration['settings'],
      $configuration['third_party_settings'],
      $container->get('entity_type.manager')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    // TODO: Implement formElement() method.
    $value = isset($items[$delta]->value) ? $items[$delta]->value : '';

    $rows = [];
    $taxonomies = $this->entityTypeManager
      ->getStorage('taxonomy_term')
      ->loadByProperties([
        'vid' => 'instruments',
      ]);
    foreach ($taxonomies as $term) {
      $rows[$term->getName()] = $term->getName();
    }

    $element['first'] = [
      '#type' => 'checkboxes',
      '#options' => $rows,
      '#attributes' => [
        'name' => 'base_taxonomy',
      ]
    ];

    $element['second'] = [
      '#type' => 'textfield',
      '#title' => 'Enter your instruments',
      '#states' => [
        'visible' => [
          ':input[name="base_taxonomy"]' => ['value' => 'Other']
        ]
      ]
    ];

    return $element;
  }

}

// Create dashboard widget of most recent posts
function wps_recent_posts_dw() {
?>
   <ol>
     <?php
          global $post;
          $args = array( 'numberposts' => 5 );

          $myposts = get_posts( $args );
                foreach( $myposts as $post ) :  setup_postdata($post); ?>
                    <li> (<? the_date('Y / n / d'); ?>) <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
          <?php endforeach; ?>
   </ol>
<?php
}

function add_wps_recent_posts_dw() {
       wp_add_dashboard_widget( 'wps_recent_posts_dw', __( 'Recent Posts' ), 'wps_recent_posts_dw' );
}
add_action('wp_dashboard_setup', 'add_wps_recent_posts_dw' );
composer create-project --prefer-dist laravel/laravel:^7.0 blog
$variation = \Drupal::entityTypeManager()->getStorage('commerce_product_variation')->load(id)->delete();
<?php

namespace Drupal\csv_import\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Messenger\Messenger;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\file\Entity\File;
use Drupal\node\Entity\Node;
use Drupal\paragraphs\Entity\Paragraph;
use Symfony\Component\DependencyInjection\ContainerInterface;

class CSVImportForm extends FormBase {

  public function getFormId() {
    return 'csv_import';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['csv_file'] = [
      '#title' => 'Upload your file',
      '#type' => 'managed_file',
      '#upload_location' => 'public://',
      '#upload_validators' => [
        'file_validate_extensions' => ['csv']
      ]
    ];

    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save'),
    ];

    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $csv_file = $form_state->getValue('csv_file');
    $csv_file = reset($csv_file);
    $file = File::load($csv_file);
    $data = $this->csvtoarray($file->getFileUri(), ',');
    foreach ($data as $row) {
      $operations[] = ['\Drupal\csv_import\Form\CSVImportForm::addImportContentItem', [$row]];
    }

    $batch = [
      'title' => $this->t('Importing data...'),
      'operations' => $operations,
      'init_message' => $this->t('Import is starting.'),
      'finished' => '\Drupal\csv_import\Form\CSVImportForm::addImportContentItemCallback',
    ];
    batch_set($batch);

    $this->messenger()->addMessage($this->t('Your form was submitted!'));
  }

  public function csvtoarray($filename='', $delimiter) {
    if (!file_exists($filename) || !is_readable($filename)) return FALSE;
    $header = NULL;

    if(($handle = fopen($filename, 'r')) !== FALSE) {
      while(($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
        if(!$header) {
          $header = $row;
        } else {
          $data[] = array_combine($header, $row);
        }
      }
      fclose($handle);
    }
    return $data;
  }

  public static function addImportContentItem($item, &$context) {
    $message = 'Creating ' . $item['Title'];
    $results = [];
    self::create_node($item);
    $context['message'] = $message;
    $context['results'] = $item;
  }

  public function addImportContentItemCallback($success, $results, $operations) {
    $number = count($results);
    if ($success) {
      $message = new PluralTranslatableMarkup($number, 'One item processed.','@count items processed.');
    } else {
      $message = t('Finished with an error.');
    }
    \Drupal::messenger()->addMessage(t($message->render()));
  }

  public static function create_node($item)
  {
    $data = file_get_contents($item['Image']);
    $file = file_save_data($data, 'public://sample.png', \Drupal\Core\File\FileSystemInterface::EXISTS_RENAME);

    $nodes = [
      'type' => 'articles_about_programming',
      'title' => $item['Title'],
      'field_description' => $item['Description'],
      'field_myimage' => [
        'target_id' => $file->id(),
        'alt' => 'Sample',
        'title' => 'Sample file',
      ],
      'field_link_to_website' => [
        'uri' => 'https://www.' . $item['Link to website'],
        'title' => $item['Title'],
        'options' => ['target' => '_blank'],
      ],
    ];
    $node = Node::create($nodes);
    $node->setPublished(TRUE);
    $node->save();
  }
}
--
-- Table structure for table `tblproduct`
--

CREATE TABLE `tblproduct` (
  `id` int(8) NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `image` text NOT NULL,
  `price` double(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tblproduct`
--

INSERT INTO `tblproduct` (`id`, `name`, `code`, `image`, `price`) VALUES
(1, 'FinePix Pro2 3D Camera', '3DcAM01', 'product-images/camera.jpg', 1500.00),
(2, 'EXP Portable Hard Drive', 'USB02', 'product-images/external-hard-drive.jpg', 800.00),
(3, 'Luxury Ultra thin Wrist Watch', 'wristWear03', 'product-images/watch.jpg', 300.00),
(4, 'XP 1155 Intel Core Laptop', 'LPN45', 'product-images/laptop.jpg', 800.00);

--
-- Indexes for table `tblproduct`
--
ALTER TABLE `tblproduct`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_code` (`code`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `tblproduct`
--
ALTER TABLE `tblproduct`
  MODIFY `id` int(8) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
COMMIT;
case "remove":
	if(!empty($_SESSION["cart_item"])) {
		foreach($_SESSION["cart_item"] as $k => $v) {
			if($_GET["code"] == $k)
				unset($_SESSION["cart_item"][$k]);				
			if(empty($_SESSION["cart_item"]))
				unset($_SESSION["cart_item"]);
		}
	}
	break;
case "empty":
	unset($_SESSION["cart_item"]);
        break;
<div id="shopping-cart">
<div class="txt-heading">Shopping Cart</div>

<a id="btnEmpty" href="index.php?action=empty">Empty Cart</a>
<?php
if(isset($_SESSION["cart_item"])){
    $total_quantity = 0;
    $total_price = 0;
?>	
<table class="tbl-cart" cellpadding="10" cellspacing="1">
<tbody>
<tr>
<th style="text-align:left;">Name</th>
<th style="text-align:left;">Code</th>
<th style="text-align:right;" width="5%">Quantity</th>
<th style="text-align:right;" width="10%">Unit Price</th>
<th style="text-align:right;" width="10%">Price</th>
<th style="text-align:center;" width="5%">Remove</th>
</tr>	
<?php		
    foreach ($_SESSION["cart_item"] as $item){
        $item_price = $item["quantity"]*$item["price"];
		?>
				<tr>
				<td><img src="<?php echo $item["image"]; ?>" class="cart-item-image" /><?php echo $item["name"]; ?></td>
				<td><?php echo $item["code"]; ?></td>
				<td style="text-align:right;"><?php echo $item["quantity"]; ?></td>
				<td  style="text-align:right;"><?php echo "$ ".$item["price"]; ?></td>
				<td  style="text-align:right;"><?php echo "$ ". number_format($item_price,2); ?></td>
				<td style="text-align:center;"><a href="index.php?action=remove&code=<?php echo $item["code"]; ?>" class="btnRemoveAction"><img src="icon-delete.png" alt="Remove Item" /></a></td>
				</tr>
				<?php
				$total_quantity += $item["quantity"];
				$total_price += ($item["price"]*$item["quantity"]);
		}
		?>

<tr>
<td colspan="2" align="right">Total:</td>
<td align="right"><?php echo $total_quantity; ?></td>
<td align="right" colspan="2"><strong><?php echo "$ ".number_format($total_price, 2); ?></strong></td>
<td></td>
</tr>
</tbody>
</table>		
  <?php
} else {
?>
<div class="no-records">Your Cart is Empty</div>
<?php 
}
?>
</div>
case "add":
	if(!empty($_POST["quantity"])) {
		$productByCode = $db_handle->runQuery("SELECT * FROM tblproduct WHERE code='" . $_GET["code"] . "'");
		$itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'quantity'=>$_POST["quantity"], 'price'=>$productByCode[0]["price"], 'image'=>$productByCode[0]["image"]));
		
		if(!empty($_SESSION["cart_item"])) {
			if(in_array($productByCode[0]["code"],array_keys($_SESSION["cart_item"]))) {
				foreach($_SESSION["cart_item"] as $k => $v) {
						if($productByCode[0]["code"] == $k) {
							if(empty($_SESSION["cart_item"][$k]["quantity"])) {
								$_SESSION["cart_item"][$k]["quantity"] = 0;
							}
							$_SESSION["cart_item"][$k]["quantity"] += $_POST["quantity"];
						}
				}
			} else {
				$_SESSION["cart_item"] = array_merge($_SESSION["cart_item"],$itemArray);
			}
		} else {
			$_SESSION["cart_item"] = $itemArray;
		}
	}
	break;
<?php
$product_array = $db_handle->runQuery("SELECT * FROM tblproduct ORDER BY id ASC");
if (!empty($product_array)) { 
	foreach($product_array as $key=>$value){
?>
	<div class="product-item">
		<form method="post" action="index.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>">
		<div class="product-image"><img src="<?php echo $product_array[$key]["image"]; ?>"></div>
		<div class="product-tile-footer">
		<div class="product-title"><?php echo $product_array[$key]["name"]; ?></div>
		<div class="product-price"><?php echo "$".$product_array[$key]["price"]; ?></div>
		<div class="cart-action"><input type="text" class="product-quantity" name="quantity" value="1" size="2" /><input type="submit" value="Add to Cart" class="btnAddAction" /></div>
		</div>
		</form>
	</div>
<?php
	}
}
?>
function custom_price_shortcode_callback( $atts ) {

    $atts = shortcode_atts( array(
        'id' => null,
    ), $atts, 'product_price' );

    $html = '';

    if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
        // Get an instance of the WC_Product object
        $product = wc_get_product( intval( $atts['id'] ) );

        // Get the product prices
        $price         = wc_get_price_to_display( $product, array( 'price' => $product->get_price() ) ); // Get the active price
        $regular_price = wc_get_price_to_display( $product, array( 'price' => $product->get_regular_price() ) ); // Get the regular price
        $sale_price    = wc_get_price_to_display( $product, array( 'price' => $product->get_sale_price() ) ); // Get the sale price

        // Your price CSS styles
        $style1 = 'style="font-size:40px;color:#e79a99;font-weight:bold;"';
        $style2 = 'style="font-size:25px;color:#e79a99"';

        // Formatting price settings (for the wc_price() function)
        $args = array(
            'ex_tax_label'       => false,
            'currency'           => 'EUR',
            'decimal_separator'  => '.',
            'thousand_separator' => ' ',
            'decimals'           => 2,
            'price_format'       => '%2$s&nbsp;%1$s',
        );

        // Formatting html output
        if( ! empty( $sale_price ) && $sale_price != 0 && $sale_price < $regular_price )
            $html = "<del $style2>" . wc_price( $regular_price, $args ) . "</del> <ins $style1>" . wc_price( $sale_price, $args ) . "</ins>"; // Sale price is set
        else
            $html = "<ins $style1>" . wc_price( $price, $args ) . "</ins>"; // No sale price set
    }
    return $html;
 }
 add_shortcode( 'product_price', 'custom_price_shortcode_callback' );
// If we want to use it as a dependency injection (we should),
// than this is the right way.

/**
 * Logger interface.
 *
 * @var \Psr\Log\LoggerInterface
 */
protected $logger;

// After that we add it to constructor method.

/**
* Controller_name constructor
 *
 * @param \Psr\Log\LoggerInterface $logger
 *  Logger interface.
 */
public function __construct(LoggerInterface $logger) {
  $this->logger = $logger;
}

public function someFunction(){
  if (something) {
    // Line of code...
  } else {
    $this->logger->error('Error message');
  }
}
stormtextil_core.edifact_orders:
  path: '/cron/synchronize-edifact-orders'
  defaults:
    _controller: '\Drupal\stormtextil_synchronization\Controller\SynchronizeEdifactOrders::parse'
    _title: 'Edifact Parser'
  requirements:
    _permission: 'access content'
<?php

namespace Drupal\stormtextil_config\Form;

use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Class StormTextil Config Form.
 */
class StormTextilConfigForm extends ConfigFormBase {

  /**
   * EntityTypeManagerInterface.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * StormTextilConfigForm constructor.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
   *   The Entity Type Manager.
   */
  public function __construct(EntityTypeManagerInterface $entityTypeManager) {
    $this->entityTypeManager = $entityTypeManager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('entity_type.manager')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'stormtextil_config.config_form';
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return ['stormtextil_config.settings'];
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    $config = $this->config('stormtextil_config.settings');

    // Promotions e-mail.
    $form['promotions_email'] = [
      '#type' => 'details',
      '#title' => $this->t('Promotions in Order e-mail'),
      '#description' => $this->t('Add custom promotional text into order confirmation e-mail'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $promotions_email = $config->get('promotions_email');

    $form['promotions_email']['enabled'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Enable promotions'),
      '#default_value' => isset($promotions_email['enabled']) ? $promotions_email['enabled'] : '',
    ];

    $form['promotions_email']['EN'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - en'),
      '#format' => 'full_html',
      '#default_value' => isset($promotions_email['EN']['value']) ? $promotions_email['EN']['value'] : '',
    ];

    $form['promotions_email']['DA'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - da'),
      '#format' => 'full_html',
      '#default_value' => isset($promotions_email['DA']['value']) ? $promotions_email['DA']['value'] : '',
    ];

    $form['promotions_email']['DE'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - de'),
      '#format' => 'full_html',
      '#default_value' => isset($promotions_email['DE']['value']) ? $promotions_email['DE']['value'] : '',
    ];

    // Stock notify e-mail.
    $form['stock_notify_email'] = [
      '#type' => 'details',
      '#title' => $this->t('Stock notify e-mail'),
      '#description' => $this->t('Add custom text into stock notify e-mail'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $stock_notify_email = $config->get('stock_notify_email');

    $form['stock_notify_email']['en']['subject'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Subject - en'),
      '#default_value' => isset($stock_notify_email['en']['subject']) ? $stock_notify_email['en']['subject'] : '',
      '#size' => 50,
    ];

    $form['stock_notify_email']['en']['message'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - en'),
      '#format' => 'full_html',
      '#default_value' => isset($stock_notify_email['en']['message']['value']) ? $stock_notify_email['en']['message']['value'] : '',
    ];

    $form['stock_notify_email']['da']['subject'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Subject - da'),
      '#default_value' => isset($stock_notify_email['da']['subject']) ? $stock_notify_email['da']['subject'] : '',
      '#size' => 50,
    ];

    $form['stock_notify_email']['da']['message'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - da'),
      '#format' => 'full_html',
      '#default_value' => isset($stock_notify_email['da']['message']['value']) ? $stock_notify_email['da']['message']['value'] : '',
    ];

    $form['stock_notify_email']['de']['subject'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Subject - de'),
      '#default_value' => isset($stock_notify_email['de']['subject']) ? $stock_notify_email['de']['subject'] : '',
      '#size' => 50,
    ];

    $form['stock_notify_email']['de']['message'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - de'),
      '#format' => 'full_html',
      '#default_value' => isset($stock_notify_email['de']['message']['value']) ? $stock_notify_email['de']['message']['value'] : '',
    ];

    // Exchange rates.
    $form['exchange_rates'] = [
      '#type' => 'details',
      '#title' => $this->t('Exchange rates'),
      '#description' => $this->t('Defines the exchange rate for 1 unit of the currency in DKK.'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $exchange_rates = $config->get('exchange_rates');

    $form['exchange_rates']['EUR'] = [
      '#type' => 'textfield',
      '#title' => $this->t('EUR to DKK'),
      '#default_value' => isset($exchange_rates['EUR']) ? $exchange_rates['EUR'] : '',
      '#size' => 10,
    ];

    $form['exchange_rates']['SEK'] = [
      '#type' => 'textfield',
      '#title' => $this->t('SEK to DKK'),
      '#default_value' => isset($exchange_rates['SEK']) ? $exchange_rates['SEK'] : '',
      '#size' => 10,
    ];

    // Order fees.
    $form['order_fees'] = [
      '#type' => 'details',
      '#title' => $this->t('Order fees'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $form['order_fees']['administration_fee'] = [
      '#type' => 'details',
      '#title' => $this->t('Administration fees'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $administration_fee = $config->get('administration_fee');

    $form['order_fees']['administration_fee']['DKK']['range'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Invoice total (DKK)'),
      '#default_value' => isset($administration_fee['DKK']['range']) ? $administration_fee['DKK']['range'] : '',
      '#size' => 10,
    ];

    $form['order_fees']['administration_fee']['DKK']['fee'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Fee (DKK)'),
      '#default_value' => isset($administration_fee['DKK']['fee']) ? $administration_fee['DKK']['fee'] : '',
      '#size' => 10,
    ];

    $form['order_fees']['administration_fee']['EUR']['range'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Invoice total (EUR)'),
      '#default_value' => isset($administration_fee['EUR']['range']) ? $administration_fee['EUR']['range'] : '',
      '#size' => 10,
    ];

    $form['order_fees']['administration_fee']['EUR']['fee'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Fee (EUR)'),
      '#default_value' => isset($administration_fee['EUR']['fee']) ? $administration_fee['EUR']['fee'] : '',
      '#size' => 10,
    ];

    $form['order_fees']['administration_fee']['SEK']['range'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Invoice total (SEK)'),
      '#default_value' => isset($administration_fee['SEK']['range']) ? $administration_fee['SEK']['range'] : '',
      '#size' => 10,
    ];

    $form['order_fees']['administration_fee']['SEK']['fee'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Fee (SEK)'),
      '#default_value' => isset($administration_fee['SEK']['fee']) ? $administration_fee['SEK']['fee'] : '',
      '#size' => 10,
    ];

    // Added costs.
    $form['order_fees']['added_cost'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Added cost price (DKK)'),
      '#default_value' => $config->get('added_cost'),
      '#size' => 10,
    ];

    // VAT.
    $form['order_fees']['vat'] = [
      '#type' => 'textfield',
      '#title' => $this->t('VAT (%)'),
      '#default_value' => $config->get('vat'),
      '#size' => 10,
    ];

    // Balance is overdue notice.
    $form['balance_is_overdue'] = [
      '#type' => 'details',
      '#title' => $this->t('Balance is overdue notification'),
      '#description' => $this->t('Add custom notification text for user with overdue balance'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $balance_is_overdue = $config->get('balance_is_overdue');

    $form['balance_is_overdue']['enabled'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Enable notifications'),
      '#default_value' => isset($balance_is_overdue['enabled']) ? $balance_is_overdue['enabled'] : '',
    ];

    $form['balance_is_overdue']['EN'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - en'),
      '#format' => 'full_html',
      '#default_value' => isset($balance_is_overdue['EN']['value']) ? $balance_is_overdue['EN']['value'] : '',
    ];

    $form['balance_is_overdue']['DA'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - da'),
      '#format' => 'full_html',
      '#default_value' => isset($balance_is_overdue['DA']['value']) ? $balance_is_overdue['DA']['value'] : '',
    ];

    $form['balance_is_overdue']['DE'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Text - de'),
      '#format' => 'full_html',
      '#default_value' => isset($balance_is_overdue['DE']['value']) ? $balance_is_overdue['DE']['value'] : '',
    ];
    // Edifact orders ftp connection.
    $form['edifact'] = [
      '#type' => 'details',
      '#title' => $this->t('Ftp connection'),
      '#description' => $this->t('Configure ftp connection to remote server'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $ftp_connection = $config->get('edifact');

    $form['edifact']['server'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Ftp server'),
      '#default_value' => isset($ftp_connection['server']) ? $ftp_connection['server'] : '',
      '#size' => 30,
    ];
    $form['edifact']['username'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Username'),
      '#default_value' => isset($ftp_connection['username']) ? $ftp_connection['username'] : '',
      '#size' => 30,
    ];
    $form['edifact']['password'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Password'),
      '#default_value' => isset($ftp_connection['password']) ? $ftp_connection['password'] : '',
      '#size' => 30,
    ];
    // Samba connection.
    $form['samba'] = [
      '#type' => 'details',
      '#title' => $this->t('Samba connection'),
      '#description' => $this->t('Configure connection to remote computer'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $samba = $config->get('samba');

    $form['samba']['username'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Username'),
      '#default_value' => isset($samba['username']) ? $samba['username'] : '',
      '#size' => 30,
    ];

    $form['samba']['password'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Password'),
      '#default_value' => isset($samba['password']) ? $samba['password'] : '',
      '#size' => 30,
    ];

    $form['samba']['workgroup'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Workgroup'),
      '#default_value' => isset($samba['workgroup']) ? $samba['workgroup'] : '',
      '#size' => 30,
    ];

    $form['samba']['pdf'] = [
      '#type' => 'details',
      '#title' => $this->t('Order PDF files'),
      '#description' => $this->t('Configure connection to remote computer to synchronize PDF files'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $form['samba']['pdf']['host'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Host (IP address of remote computer)'),
      '#default_value' => isset($samba['pdf']['host']) ? $samba['pdf']['host'] : '',
      '#size' => 30,
    ];

    $form['samba']['pdf']['share'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Shared folder'),
      '#default_value' => isset($samba['pdf']['share']) ? $samba['pdf']['share'] : '',
      '#size' => 30,
    ];

    $form['samba']['invoice'] = [
      '#type' => 'details',
      '#title' => $this->t('Order invoices'),
      '#description' => $this->t('Configure connection to remote computer to synchronize invoices'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $form['samba']['invoice']['host'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Host (IP address of remote computer)'),
      '#default_value' => isset($samba['invoice']['host']) ? $samba['invoice']['host'] : '',
      '#size' => 30,
    ];

    $form['samba']['invoice']['share'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Shared folder'),
      '#default_value' => isset($samba['invoice']['share']) ? $samba['invoice']['share'] : '',
      '#size' => 30,
    ];

    // Samba connection.
    $form['theme'] = [
      '#type' => 'details',
      '#title' => $this->t('Theme settings'),
      '#description' => $this->t('Configure theme specific variables'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $theme = $config->get('theme');

    $form['theme']['theme_color'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Theme color'),
      '#default_value' => isset($theme['theme_color']) ? $theme['theme_color'] : '',
      '#description' => $this->t('Insert color HEX code'),
      '#size' => 10,
    ];

    /** @var \Drupal\taxonomy\TermStorageInterface $termStorage */
    $termStorage = $this->entityTypeManager->getStorage('taxonomy_term');
    $categoriesTree = $termStorage->loadTree('categories', 0, NULL, TRUE);
    $options = [];

    foreach ($categoriesTree as $category) {
      $options[$category->id()] = $category->label();
    }

    $form['designer_exclude_categories'] = [
      '#type' => 'details',
      '#title' => $this->t('Designer Exclude Categories'),
      '#description' => $this->t('Designer Exclude Categories'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $form['designer_exclude_categories']['exclude'] = [
      '#type' => 'select',
      '#title' => $this->t('Excluded'),
      '#default_value' => $config->get('designer_exclude_categories'),
      '#options' => $options,
      '#multiple' => TRUE,
      '#size' => 120,
      '#attributes' => [
        'style' => 'height: 240px',
      ],
    ];

    $form['designer_query_maps_id'] = [
      '#type' => 'details',
      '#title' => $this->t('Designer Query Maps'),
      '#description' => $this->t('Set the active query maps.'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $form['designer_query_maps_id']['id'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Designer Query Maps'),
      '#description' => Link::createFromRoute(
        $this->t('See more'),
        'graphql.query_maps'
      ),
      '#default_value' => $config->get('designer_query_maps_id'),
    ];

    // Checkout text.
    $form['checkout'] = [
      '#type' => 'details',
      '#title' => $this->t('Checkout'),
      '#open' => FALSE,
      '#tree' => TRUE,
    ];

    $checkout = $config->get('checkout');

    $form['checkout']['enabled'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Enable checkout text'),
      '#default_value' => isset($checkout['enabled']) ? $checkout['enabled'] : '',
    ];

    $form['checkout']['EN'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Checkout text - en'),
      '#format' => 'full_html',
      '#default_value' => isset($checkout['EN']['value']) ? $checkout['EN']['value'] : '',
    ];

    $form['checkout']['DA'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Checkout text - da'),
      '#format' => 'full_html',
      '#default_value' => isset($checkout['DA']['value']) ? $checkout['DA']['value'] : '',
    ];

    $form['checkout']['DE'] = [
      '#type' => 'text_format',
      '#title' => $this->t('Checkout text - de'),
      '#format' => 'full_html',
      '#default_value' => isset($checkout['DE']['value']) ? $checkout['DE']['value'] : '',
    ];

    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    $form_values = $form_state->getValues();

    if (!empty($form_values['exchange_rates'])) {
      $error_msg = $this->t('Exchange rate values must be numeric and decimal points should be used. Commas are not allowed.');

      foreach ($form_values['exchange_rates'] as $key => $value) {
        if (!is_numeric($value)) {
          $form_state->setError($form['exchange_rates'][$key], $error_msg);
        }
      }
    }

    if (!empty($form_values['order_fees']['added_cost'])) {
      $error_msg = $this->t('Added cost price must be numeric and decimal points should be used. Commas are not allowed.');

      if (!is_numeric($form_values['order_fees']['added_cost'])) {
        $form_state->setError($form['order_fees']['added_cost'], $error_msg);
      }
    }

    if (!empty($form_values['order_fees']['administration_fee'])) {
      $error_msg = $this->t('Administration fee values must be numeric and decimal points should be used. Commas are not allowed.');

      foreach ($form_values['order_fees']['administration_fee'] as $currency => $item) {
        foreach ($form_values['order_fees']['administration_fee'][$currency] as $key => $value) {
          if (!is_numeric($value)) {
            $form_state->setError($form['order_fees']['administration_fee'][$currency][$key], $error_msg);
          }
        }
      }
    }

  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $config = $this->config('stormtextil_config.settings');
    $form_values = $form_state->getValues();

    $config->set('promotions_email', $form_values['promotions_email'])
      ->set('stock_notify_email', $form_values['stock_notify_email'])
      ->set('exchange_rates', $form_values['exchange_rates'])
      ->set('balance_is_overdue', $form_values['balance_is_overdue'])
      ->set('administration_fee', $form_values['order_fees']['administration_fee'])
      ->set('edifact', $form_values['edifact'])
      ->set('samba', $form_values['samba'])
      ->set('theme', $form_values['theme'])
      ->set('added_cost', $form_values['order_fees']['added_cost'])
      ->set('vat', $form_values['order_fees']['vat'])
      ->set('designer_exclude_categories', array_values($form_values['designer_exclude_categories']['exclude']))
      ->set('designer_query_maps_id', $form_values['designer_query_maps_id']['id'])
      ->set('checkout', $form_values['checkout'])
      ->save();

    Cache::invalidateTags(['designer_exclude_categories']);

    parent::submitForm($form, $form_state);
  }

}
<?php

namespace Drupal\stormtextil_core\Controller;

use Drupal\commerce_shipping\Entity\Shipment;
use Drupal\commerce_shipping\Entity\ShippingMethod;
use Drupal\commerce_shipping\ShipmentItem;
use Drupal\Core\Controller\ControllerBase;
use Drupal\physical\Weight;
use Drupal\physical\WeightUnit;
use Drupal\profile\Entity\Profile;
use EDI\Parser;
use Drupal\commerce_price\Price;
use Drupal\commerce_order\Entity\OrderItem;
use Drupal\commerce_order\Entity\Order;

class EdifactController extends ControllerBase {

  public function parse() {
    $parser = new Parser();
    $ediFile = file_get_contents('./sites/default/files/1509018E1-000523-1611970.EDI');
    $parsedEdiFile = $parser->loadString($ediFile);

    $lineItems = [];
    $orderItems = [];
    $currency = $parsedEdiFile[18][1][1];

    foreach ($parsedEdiFile as $ediElement) {
      switch($ediElement[0]) {
        case 'NAD':
          if ($ediElement[1] == 'DP') {
            $organization = $ediElement[3][0];
            $address_line1 = $ediElement[3][1];
            $postal_local = explode(" ", $ediElement[3][2]);
            $postal_code = $postal_local[0];
            $locality = $postal_local[1];
            $country_code = $ediElement[3][3];
          } else if ($ediElement[1] == 'BY') {
            $billing_address = $ediElement[5];
            $billing_city = $ediElement[6];
            $billing_company = $ediElement[4];
            $billing_zip_code = $ediElement[8];
          };
          break;
        // Name that we are going to use in profile.
        case 'CTA':
          $name = explode(" ", $ediElement[2][1]);
          $given_name = $name[0];
          $family_name = $name[1];
          break;
        case 'TAX':
          if (!isset($tax)) {
            $tax = $ediElement[5][3] / 100;
            break;
          }
        // Name of shipping method.
        case 'ALC':
          $shipping_method_name = $ediElement[2];
          break;
        case 'MOA':
          if($ediElement[1][0] == '8') {
            $shipping_price = $ediElement[1][1];
          }
        // Line item variation.
        case 'PIA':
          if ($ediElement[1] == '5') {
            $sku = $ediElement[2][0];
            $rawProductVariation = $this->entityTypeManager()
              ->getStorage('commerce_product_variation')
              ->loadByProperties([
                'sku' => $sku,
              ]);
            $productVariation = reset($rawProductVariation);
            $lineItems[$productVariation->getTitle()]['variation'] = $productVariation;
          }
          break;
        // Line item quantity.
        case 'QTY':
          $quantity = $ediElement[1][1];
          $lineItems[$productVariation->getTitle()]['quantity'] = $quantity;
          break;
        // Line item price.
        case 'PRI':
          if ($ediElement[1][0] == 'AAA') {
            $price = $ediElement[1][1];
            $lineItems[$productVariation->getTitle()]['price'] = $price;
          }
          break;
        // Number of line items.
        case 'CNT':
          $numberOfLineItems = $ediElement[1][1];
          break;
      }
    }

    // Creating order item for each line item.
    foreach ($lineItems as $lineItem) {
      $orderItem = OrderItem::create([
        'type' => 'default',
        'purchased_entity' => $lineItem['variation'],
        'quantity' => $lineItem['quantity'],
        'unit_price' => new Price($lineItem['price'], $currency),
        'overridden_unit_price' => TRUE,
      ]);
      $orderItem->save();
      $orderItems[] = $orderItem;
    }

    // Creating order.
    $order = Order::create([
      'type' => 'default',
      'mail' => $this->currentUser()->getEmail(),
      'uid' => $this->currentUser()->id(),
      'store_id' => 1,
      'order_items' => [$orderItems[0], $orderItems[1]],
      'placed' => \Drupal::time()->getCurrentTime(),
    ]);
    $order->save();

    // Creating shipment.
    if ($order->get('shipments')->count() == 0) {
      $first_shipment = Shipment::create([
        'type' => 'default',
        'order_id' => $order->id(),
        'title' => 'Shipment',
        'state' => 'ready'
      ]);
      $first_shipment->save();
    }

    foreach ($orderItems as $order_item) {
      $quantity = $order_item->getQuantity();
      $purchased_entity = $order_item->getPurchasedEntity();

      if ($purchased_entity->get('weight')->isEmpty()) {
        $weight = new Weight(1, WeightUnit::GRAM);
      } else {
        $weight_item = $purchased_entity->get('weight')->first();
        $weight = $weight_item->toMeasurement();
      }

      // Creating shipment item.
      $shipment_item = new ShipmentItem([
        'order_item_id' => $order_item ->id(),
        'title' => $purchased_entity->label(),
        'quantity' => $quantity,
        'weight' => $weight->multiply($quantity),
        'declared_value' => $order_item->getTotalPrice(),
      ]);
      $first_shipment->addItem($shipment_item);
    }
    // Creating shipping method.
    $shipping_method = ShippingMethod::create([
      'stores' => 1,
      'name' => $shipping_method_name,
      'plugin' => [
        'target_plugin_id' => 'flat_rate',
        'target_plugin_configuration' => [
          'rate_label' =>'Shipping GG',
          'rate_amount' => [
            'number' => $shipping_price, //TODO: Zameniti sa varijablom
            'currency_code' => $currency
          ]
        ],
      ],
      'status' => TRUE,
      'weight' => 0,
    ]);
    $shipping_method->save();
    // Adding newly created shipment method to shipment.
    $first_shipment->setShippingMethod($shipping_method);

    // Adding amount to shipment.
    $shipping_method_plugin = $shipping_method->getPlugin();
    $shipping_rates = $shipping_method_plugin->calculateRates($first_shipment);
    $shipping_rate = reset($shipping_rates);
    $shipping_service = $shipping_rate->getService()->getId();
    $amount = reset($shipping_rates)->getAmount();
    $first_shipment->setAmount($amount);
    $first_shipment->save();

    $order->set('shipments', [$first_shipment]);
    $order->save();

    // Creating profile using data from EDI file.
    $profile = Profile::create([
      'uid' => $order->getCustomerId(),
      'type' => 'customer',
    ]);
    $profile->address->given_name = $given_name;
    $profile->set('field_address_1', $name);
    $profile->address->family_name = $family_name;
    $profile->address->organization = $organization;
    $profile->set('field_company', $organization);
    $profile->address->country_code = $country_code;
    $profile->set('field_new_country', $country_code);
    $profile->address->locality = $locality;
    $profile->set('field_city', $locality);
    $profile->address->postal_code = $postal_code;
    $profile->set('field_zip_code', $postal_code);
    $profile->address->address_line1 = $address_line1;
    $profile->set('field_address_1', $address_line1);
    $profile->save();

    // Create a billing profile.
    if(empty($order->getBillingProfile())) {
      $billing_profile = Profile::create([
        'type' => 'customer',
        'uid' => $order->getCustomerId(),
      ]);
      $billing_profile->save();
      $billing_profile->set('field_address_1', $billing_address);
      $billing_profile->set('field_city', $billing_city);
      $billing_profile->set('field_company', $billing_company);
      $billing_profile->set('field_zip_code', $billing_zip_code);
      $billing_profile->save();
      $order->setBillingProfile($billing_profile);
      $order->save();
    }

    //TODO: Add other data to profile.

    $first_shipment->setShippingProfile($profile);
    $first_shipment->setShippingService($shipping_service);
    $first_shipment->save();
    $order->set('shipments', $first_shipment);
    // Including tax into price.
    $priceWithTax = $order->getTotalPrice()->getNumber() + ($order->getTotalPrice()->getNumber() * $tax);
    $order->set('total_price', new Price($priceWithTax, $currency));
    $order->save();

    // Checking the number of line items.
    if ($numberOfLineItems == count($orderItems)) {
      $poruka = 'Provera prošla';
    } else {
      $poruka = 'Provera nije prošla';
    }

    return [
      '#markup' => $poruka,
    ];
  }

}
// register jquery and style on initialization
add_action('init', 'register_script');
function register_script(){
	wp_register_script( 'custom_jquery', plugins_url('/js/custom-jquery.js', __FILE__), array('jquery'), '2.5.1' );

	wp_register_style( 'new_style', plugins_url('/css/new-style.css', __FILE__), false, '1.0.0', 'all');
}

// use the registered jquery and style above
add_action('wp_enqueue_scripts', 'enqueue_style');
function enqueue_style(){
	wp_enqueue_script('custom_jquery');

	wp_enqueue_style( 'new_style' );
}
/**
 * Implements hook_preprocess_HOOK().
 */
function green_deal_core_preprocess_commerce_product__teaser(&$variables) {
  $product = $variables['elements']['#commerce_product'];
  $product_variation = reset($product);
  $price = $product_variation->get('price')->number;
  $list_price = $product_variation->get('list_price')->number;

  if ($list_price != NULL) {
    $percentage = round((($list_price - $price) / $list_price) * 100);
    if ($percentage < 10) {
      $percentage = 10;
    }
    $variables['percentage'] = $percentage . '%';
  }
}

function green_deal_core_preprocess_commerce_product__full(&$variables) {
  $product = $variables['elements']['#commerce_product'];
  $product_variation = reset($product);
  $price = $product_variation->get('price')->number;
  $list_price = $product_variation->get('list_price')->number;

  if ($list_price != NULL) {
    $percentage = round((($list_price - $price) / $list_price) * 100);
    if ($percentage < 10) {
      $percentage = 10;
    }
    $variables['percentage'] = $percentage . '%';
  }
}
green_deal_core.test:
  path: '/product_action'
  defaults:
    _controller: '\Drupal\green_deal_core\Controller\ProductActionController::test'
    _title: 'Product action controller'
  requirements:
    _permission: 'access content'
<?php

namespace Drupal\green_deal_core\Controller;

use Drupal\commerce_price\Price;
use Drupal\Core\Controller\ControllerBase;

class ProductActionController extends ControllerBase {

  public function test() {

    $flag_id = 'promotion_akcija';

    $flag_service = \Drupal::service('flag');
    $flag = $flag_service->getFlagById($flag_id);
    $products = $this->entityTypeManager()
      ->getStorage('commerce_product')
      ->loadByProperties([
        'type' => 'default'
      ]);

    $variation = $this->entityTypeManager()
      ->getStorage('commerce_product_variation')
      ->load(1267);

    foreach ($products as $product) {
      if($flag_service->getEntityFlaggings($flag, $product)) {
        $variation = $product->getVariations();
        $variation = reset($variation);
        $price = $variation->getPrice()->getNumber();
        $nesto[] = $price;
        $list_price = ceil($price / 0.9);
        $variation->setListPrice(new Price($list_price, 'RSD'));
        $variation->save();
        $poruka = 'nesto';
      }
    }

    return ([
      '#markup' => $poruka,
    ]);
  }

}
array_diff_assoc($array, array_unique($a, SORT_REGULAR)));
// First we create order items.
    foreach ($lineItems as $lineItem) {
      $orderItem = OrderItem::create([
        'type' => 'default',
        'purchased_entity' => $lineItem['variation'],
        'quantity' => $lineItem['quantity'],
        'unit_price' => new Price($lineItem['price'], $currency),
        'overridden_unit_price' => TRUE,
      ]);
      $orderItem->save();
      $orderItems[] = $orderItem;
    }

// Than we create order.
    $order = Order::create([
      'type' => 'default',
      'mail' => $this->currentUser()->getEmail(),
      'uid' => $this->currentUser()->id(),
      'store_id' => 1,
      'order_items' => [$orderItems[0], $orderItems[1]],
      'placed' => \Drupal::time()->getCurrentTime(),
    ]);
    $order->save();

// Than we create shipment.
    if ($order->get('shipments')->count() == 0) {
      $first_shipment = Shipment::create([
        'type' => 'default',
        'order_id' => $order->id(),
        'title' => 'Shipment',
        'state' => 'ready'
      ]);
      $first_shipment->save();
    }

// After that we create data for shipment item and shipment items.
    foreach ($orderItems as $order_item) {
      $quantity = $order_item->getQuantity();
      $purchased_entity = $order_item->getPurchasedEntity();

      if ($purchased_entity->get('weight')->isEmpty()) {
        $weight = new Weight(1, WeightUnit::GRAM);
      } else {
        $weight_item = $purchased_entity->get('weight')->first();
        $weight = $weight_item->toMeasurement();
      }

      // Creating shipment item.
      $shipment_item = new ShipmentItem([
        'order_item_id' => $order_item ->id(),
        'title' => $purchased_entity->label(),
        'quantity' => $quantity,
        'weight' => $weight->multiply($quantity),
        'declared_value' => $order_item->getTotalPrice(),
      ]);
      $first_shipment->addItem($shipment_item);
    }

//Than we create shipping methods and add them to shipment.
    $shipping_method = ShippingMethod::create([
      'stores' => 1,
      'name' => $shipping_method_name,
      'plugin' => [
        'target_plugin_id' => 'flat_rate',
        'target_plugin_configuration' => [
          'rate_label' =>'Shipping GG',
          'rate_amount' => [
            'number' => $shipping_price, //TODO: Zameniti sa varijablom
            'currency_code' => $currency
          ]
        ],
      ],
      'status' => TRUE,
      'weight' => 0,
    ]);
    $shipping_method->save();
    // Adding newly created shipment method to shipment.
    $first_shipment->setShippingMethod($shipping_method);

// After that we add amount to shipment.
    $shipping_method_plugin = $shipping_method->getPlugin();
    $shipping_rates = $shipping_method_plugin->calculateRates($first_shipment);
    $shipping_rate = reset($shipping_rates);
    $shipping_service = $shipping_rate->getService()->getId();
    $amount = reset($shipping_rates)->getAmount();
    $first_shipment->setAmount($amount);
    $first_shipment->save();

    $order->set('shipments', [$first_shipment]);
    $order->save();

// And finally we create shipping and billing profile.
    $profile = Profile::create([
      'uid' => $order->getCustomerId(),
      'type' => 'customer',
    ]);
    $profile->address->given_name = $given_name;
    $profile->set('field_address_1', $name);
    $profile->address->family_name = $family_name;
    $profile->address->organization = $organization;
    $profile->set('field_company', $organization);
    $profile->address->country_code = $country_code;
    $profile->set('field_new_country', $country_code);
    $profile->address->locality = $locality;
    $profile->set('field_city', $locality);
    $profile->address->postal_code = $postal_code;
    $profile->set('field_zip_code', $postal_code);
    $profile->address->address_line1 = $address_line1;
    $profile->set('field_address_1', $address_line1);
    $profile->save();

    if(empty($order->getBillingProfile())) {
      $billing_profile = Profile::create([
        'type' => 'customer',
        'uid' => $order->getCustomerId(),
      ]);
      $billing_profile->save();
      $billing_profile->set('field_address_1', $billing_address);
      $billing_profile->set('field_city', $billing_city);
      $billing_profile->set('field_company', $billing_company);
      $billing_profile->set('field_zip_code', $billing_zip_code);
      $billing_profile->save();
      $order->setBillingProfile($billing_profile);
      $order->save();
    }

    //TODO: Add other data to profile.

    $first_shipment->setShippingProfile($profile);
    $first_shipment->setShippingService($shipping_service);
    $first_shipment->save();
    $order->set('shipments', $first_shipment);
    // Including tax into price.
    $priceWithTax = $order->getTotalPrice()->getNumber() + ($order->getTotalPrice()->getNumber() * $tax);
    $order->set('total_price', new Price($priceWithTax, $currency));
    $order->save();

$data=json_decode($json,true);
if ($data === null && json_last_error() !== JSON_ERROR_NONE) { //error }
{#
/**
 * @file
 * Template for the shipment confirmation.
 *
 * Available variables:
 * - order_entity: The order entity.
 * - shipment_entity: The shipment entity.
 * - shipping_profile: The profile associated with a shipment.
 * - tracking_code: The tracking code associated with the shipment.
 *
 * @ingroup themeable
 */
#}
{% set shipmentItemCount = shipment_entity.getItems|length %}
<table style="margin: 15px auto 0 auto; max-width: 768px; font-family: arial,sans-serif">
  <tbody>
  <tr>
    <td>
      <table style="margin-left: auto; margin-right: auto; max-width: 768px; text-align: center;">
        <tbody>
        <tr>
          <td>
            <a href="{{ url('<front>') }}" style="color: #0e69be; text-decoration: none; font-weight: bold; margin-top: 15px;">{{ order_entity.getStore.label }}</a>
          </td>
        </tr>
        </tbody>
      </table>
      <table style="margin-left: auto; margin-right: auto; min-width: 450px; margin: 5px auto 0 auto; border: 1px solid #cccccc; border-radius: 5px; padding: 40px 30px 30px 30px;">
        <tbody>
        <tr>
          <td style="text-align: center; font-weight: bold; padding-top:15px; padding-bottom: 15px; border-top: 1px solid #cccccc; border-bottom: 1px solid #cccccc">
            {% trans %}
              An item in your order #{{ order_entity.getOrderNumber }} has shipped!
            {% plural shipmentItemCount %}
              Items in your order #{{ order_entity.getOrderNumber }} have shipped!
            {% endtrans %}
          </td>
        </tr>
        <tr>
          <td>
            <table style="width: 100%; padding-top:15px; padding-bottom: 15px; text-align: left; border-bottom: 1px solid #cccccc">
              <tbody>
              <tr>
                <td style="font-weight: bold; padding-bottom: 15px; text-align: left; vertical-align: top;">
                  {{ 'Shipped to:'|t }}
                </td>
              </tr>
              <tr>
                <td>
                  {% block shipping_profile %}
                    {{ shipping_profile }}
                  {% endblock %}
                </td>
              </tr>
              </tbody>
            </table>
          </td>
        </tr>
        <tr>
          <td>
            {% block shipment_items %}
              <table style="padding-top: 15px; padding-bottom:15px; width: 100%">
                <tbody style="text-align: left;">
                <tr>
                  <td colspan="2" style="font-weight: bold; padding-bottom: 15px; text-align: left; vertical-align: top;">
                    {% trans %}
                      Item in shipment
                    {% plural shipmentItemCount %}
                      Items in shipment
                    {% endtrans %}
                  </td>
                </tr>
                {% for shipment_item in shipment_entity.getItems() %}
                  <tr>
                    <td>
                      {{ shipment_item.quantity|number_format }} x
                    </td>
                    <td>
                      <span>{{ shipment_item.title }}</span>
                    </td>
                  </tr>
                {% endfor %}
                </tbody>
              </table>
            {% endblock %}
          </td>
        </tr>
        {% if (tracking_code) %}
          {% block tracking_info %}
            <tr>
              <td style="font-weight: bold; padding-top:15px; padding-bottom: 15px; text-align: left; vertical-align: top; border-top: 1px solid #cccccc">
                {{ 'Tracking information:'|t }}
              </td>
            </tr>
            <tr>
              <td style="padding-bottom: 15px;">
                {{ tracking_code }}
              </td>
            </tr>
            <tr>
              <td style="padding-top:15px; padding-bottom: 15px; text-align: center; border-top: 1px solid #cccccc">
                {{ 'Thank you for your order!'|t }}
              </td>
            </tr>
          {% endblock %}
        {% endif %}
        </tbody>
      </table>
    </td>
  </tr>
  </tbody>
</table>
	/**
 * Implements hook_theme().
 */
function commerce_shipping_theme() {
  return [
    'commerce_shipment' => [
      'render element' => 'elements',
    ],
    'commerce_shipment_confirmation' => [
      'variables' => [
        'order_entity' => NULL,
        'shipment_entity' => NULL,
        'shipping_profile' => NULL,
        'tracking_code' => NULL,
      ],
    ],
  ];
}
<?php

namespace Drupal\commerce_shipping\Mail;

use Drupal\commerce\MailHandlerInterface;
use Drupal\commerce_shipping\Entity\ShipmentInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;

class ShipmentConfirmationMail implements ShipmentConfirmationMailInterface {

  use StringTranslationTrait;

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * The mail handler.
   *
   * @var \Drupal\commerce\MailHandlerInterface
   */
  protected $mailHandler;

  /**
   * Constructs a new ShipmentConfirmationMail object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\commerce\MailHandlerInterface $mail_handler
   *   The mail handler.
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager, MailHandlerInterface $mail_handler) {
    $this->entityTypeManager = $entity_type_manager;
    $this->mailHandler = $mail_handler;
  }

  /**
   * {@inheritdoc}
   */
  public function send(ShipmentInterface $shipment, $to = NULL, $bcc = NULL) {
    /** @var \Drupal\commerce_order\Entity\OrderInterface $order */
    $order = $shipment->getOrder();
    $to = isset($to) ? $to : $order->getEmail();
    if (!$to) {
      // The email should not be empty.
      return FALSE;
    }

    $subject = $this->formatPlural(
      $shipment->get('items')->count(),
      'An item for order #@number shipped!',
      'Items for your order #@number shipped!',
      ['@number' => $order->getOrderNumber()]
    );

    $profile_view_builder = $this->entityTypeManager->getViewBuilder('profile');
    $shipment_view_builder = $this->entityTypeManager->getViewBuilder('commerce_shipment');
    $body = [
      '#theme' => 'commerce_shipment_confirmation',
      '#order_entity' => $order,
      '#shipment_entity' => $shipment,
      '#shipping_profile' => $profile_view_builder->view($shipment->getShippingProfile()),
      '#tracking_code' => $shipment_view_builder->viewField($shipment->get('tracking_code'), 'default'),
    ];

    $params = [
      'id' => 'shipment_confirmation',
      'from' => $order->getStore()->getEmail(),
      'bcc' => $bcc,
      'order' => $order,
      'shipment' => $shipment,
    ];
    $customer = $order->getCustomer();
    if ($customer->isAuthenticated()) {
      $params['langcode'] = $customer->getPreferredLangcode();
    }

    return $this->mailHandler->sendMail($to, $subject, $body, $params);
  }

}
$url = "https://jsonplaceholder.typicode.com/posts";
$data = file_get_contents($url);
$characters = json_decode($data);
/**
 * Verifies if passed URL (remote file or any webpage / webresource) exists
 * The check is implemented via method HEAD, so no data is downloaded anyway
 *
 * @param   <string> Remote URL to verify
 * @returns <bool>   Returns true if given URL exists, false otherwise
 */
function file_exists_remote (string $url) : bool
{
    $handle = curl_init();

    curl_setopt_array($handle, [
        CURLOPT_URL => $url,
        CURLOPT_SSL_VERIFYPEER => 0,
        CURLOPT_NOBODY => 1,
        CURLOPT_HEADER => 0,
        CURLOPT_RETURNTRANSFER => 1,
        CURLOPT_FOLLOWLOCATION => 1,
        CURLOPT_AUTOREFERER => 1
    ]);

    curl_exec($handle);

    $responseCode = (int) curl_getinfo($handle, CURLINFO_RESPONSE_CODE);

    curl_close($handle);

    return $responseCode === 200;
}
<?php

$mageRoot = __DIR__;

while (!(file_exists($mageRoot . '/app/Mage.php') || file_exists($mageRoot . '/bin/magento'))) {
    $mageRoot = dirname($mageRoot);
}

return $mageRoot;
<?php

namespace Drupal\stormtextil_synchronization\Controller;

use Drupal\commerce_shipping\Entity\Shipment;
use Drupal\commerce_shipping\Entity\ShippingMethod;
use Drupal\commerce_shipping\ShipmentItem;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\physical\Weight;
use Drupal\physical\WeightUnit;
use Drupal\profile\Entity\Profile;
use EDI\Parser;
use Drupal\commerce_price\Price;
use Drupal\commerce_order\Entity\OrderItem;
use Drupal\commerce_order\Entity\Order;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Class Synchronize Edifact Orders.
 *
 * @package Drupal\stormtextil_synchronization\Controller
 */
class SynchronizeEdifactOrders extends ControllerBase {

  /**
   * The time service.
   *
   * @var \Drupal\Component\Datetime\TimeInterface
   */
  protected $time;

  /**
   * The config factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $config;

  /**
   * Logger interface.
   *
   * @var \Psr\Log\LoggerInterface
   */
  protected $logger;

  /**
   * Constructs Synchronize Edifact Orders.
   *
   * @param \Drupal\Component\Datetime\TimeInterface $time
   *   The Time service.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
   *   The config factory.
   * @param \Psr\Log\LoggerInterface $logger
   *   Logger interface.
   */
  public function __construct(TimeInterface $time, ConfigFactoryInterface $configFactory, LoggerInterface $logger) {
    $this->time = $time;
    $this->config = $configFactory;
    $this->logger = $logger;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('datetime.time'),
      $container->get('config.factory'),
      $container->get('logger.channel.default')
    );
  }

  /**
   * Parse the edi file and create an order.
   *
   * @return string[]|void
   *   Response.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   * @throws \Drupal\Core\Entity\EntityStorageException
   * @throws \Drupal\Core\TypedData\Exception\MissingDataException
   */
  public function parse() {
    // Login information.
    $login_data = $this->config->get('stormtextil_config.settings');
    $ftp_server = $login_data->get('edifact')['server'];
    $ftp_user = $login_data->get('edifact')['username'];
    $ftp_pass = $login_data->get('edifact')['password'];
    // Set up a connection or die.
    $ftp = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
    // Try to login.
    if (ftp_login($ftp, $ftp_user, $ftp_pass)) {
      echo "Connected as $ftp_user@$ftp_server\n";
    }
    else {
      echo "Couldn't connect as $ftp_user\n";
    }
    // Turn passive mode on,
    // e have to use passive mode because the,
    // running docker container is listening on a different port.
    ftp_set_option($ftp, FTP_USEPASVADDRESS, FALSE);
    ftp_pasv($ftp, TRUE);
    // Listing all companies in root folder.
    $companies = ftp_nlist($ftp, '/');
    foreach ($companies as $company) {
      // Check if this is a valid C5 ID.
      if (is_numeric(basename($company))) {
        $company_id = basename($company);
      }
      // Listing all files in stores directory.
      $files = ftp_nlist($ftp, './' . $company_id . '/archive/');
      foreach ($files as $file) {
        if ((preg_match('/^.*\.(edi)$/i', $file))) {
          // Edi file for proceeding the order.
          $ediFile = file_get_contents('ftp://' . $ftp_user . ':' . $ftp_pass . '@' . $ftp_server . '/'
            . $company_id . '/archive/' . basename($file));
          // Parsing the file.
          $parser = new Parser();
          $parsedEdiFile = $parser->loadString($ediFile);

          $lineItems = [];
          $orderItems = [];
          // Looping through all parsed EDI elements and taking
          // data for order information.
          foreach ($parsedEdiFile as $ediElement) {
            switch ($ediElement[0]) {
              // Delivery information.
              case 'NAD':
                if ($ediElement[1] == 'DP') {
                  $organization = $ediElement[3][0];
                  $address_line1 = $ediElement[3][1];
                  $postal_local = explode(" ", $ediElement[3][2]);
                  $postal_code = $postal_local[0];
                  $locality = $postal_local[1];
                  $country_code = $ediElement[3][3];
                }
                elseif ($ediElement[1] == 'BY') {
                  $billing_address = $ediElement[5];
                  $billing_city = $ediElement[6];
                  $billing_company = $ediElement[4];
                  $billing_zip_code = $ediElement[8];
                };
                break;

              // Name that we are going to use in shipment profile.
              case 'CTA':
                $name = explode(" ", $ediElement[2][1]);
                $given_name = $name[0];
                $family_name = $name[1];
                break;

              // Currency code.
              case 'CUX':
                $currency = $ediElement[1][1];
                break;

              // Tax percentage.
              case 'TAX':
                if (!isset($tax)) {
                  $tax = $ediElement[5][3] / 100;
                }
                break;

              // Name of shipping method.
              case 'ALC':
                $shipping_method_name = $ediElement[2];
                break;

              // Shipping price.
              case 'MOA':
                if ($ediElement[1][0] == '8') {
                  $shipping_price = $ediElement[1][1];
                }
                break;

              // Line item variation.
              case 'PIA':
                if ($ediElement[1] == '5') {
                  $sku = $ediElement[2][0];
                  $rawProductVariation = $this->entityTypeManager()
                    ->getStorage('commerce_product_variation')
                    ->loadByProperties([
                      'sku' => $sku,
                    ]);
                  $productVariation = reset($rawProductVariation);
                  $lineItems[$productVariation->getTitle()]['variation'] = $productVariation;
                }
                break;

              // Line item quantity.
              case 'QTY':
                $quantity = $ediElement[1][1];
                $lineItems[$productVariation->getTitle()]['quantity'] = $quantity;
                break;

              // Line item price.
              case 'PRI':
                if ($ediElement[1][0] == 'AAA') {
                  $price = $ediElement[1][1];
                  $lineItems[$productVariation->getTitle()]['price'] = $price;
                }
                break;

              // Number of line items.
              case 'CNT':
                $numberOfLineItems = $ediElement[1][1];
                break;
            }
          }

          // Creating order items.
          foreach ($lineItems as $lineItem) {
            $orderItem = OrderItem::create([
              'type' => 'default',
              'purchased_entity' => $lineItem['variation'],
              'quantity' => $lineItem['quantity'],
              'unit_price' => new Price($lineItem['price'], $currency),
              'overridden_unit_price' => TRUE,
            ]);
            $orderItem->save();
            $orderItems[] = $orderItem;
          }
          // Creating order.
          $order = Order::create([
            'type' => 'default',
            'mail' => $this->currentUser()->getEmail(),
            'uid' => $this->currentUser()->id(),
            'store_id' => 1,
            'order_items' => [$orderItems[0], $orderItems[1]],
            'placed' => $this->time->getCurrentTime(),
          ]);
          $order->save();
          // Creating shipment.
          if ($order->get('shipments')->count() == 0) {
            $first_shipment = Shipment::create([
              'type' => 'default',
              'order_id' => $order->id(),
              'title' => 'Shipment',
              'state' => 'ready',
            ]);
            $first_shipment->save();
          }
          // Caclculating weight for shipment.
          foreach ($orderItems as $order_item) {
            $quantity = $order_item->getQuantity();
            $purchased_entity = $order_item->getPurchasedEntity();

            if ($purchased_entity->get('weight')->isEmpty()) {
              $weight = new Weight(1, WeightUnit::GRAM);
            }
            else {
              $weight_item = $purchased_entity->get('weight')->first();
              $weight = $weight_item->toMeasurement();
            }
            // Creating shipment item.
            $shipment_item = new ShipmentItem([
              'order_item_id' => $order_item->id(),
              'title' => $purchased_entity->label(),
              'quantity' => $quantity,
              'weight' => $weight->multiply($quantity),
              'declared_value' => $order_item->getTotalPrice(),
            ]);
            $first_shipment->addItem($shipment_item);
          }
          // Creating shipping method.
          $shipping_method = ShippingMethod::create([
            'stores' => 1,
            'name' => $shipping_method_name,
            'plugin' => [
              'target_plugin_id' => 'flat_rate',
              'target_plugin_configuration' => [
                'rate_label' => 'Shipping GG',
                'rate_amount' => [
                  'number' => $shipping_price,
                  'currency_code' => $currency,
                ],
              ],
            ],
            'status' => TRUE,
            'weight' => 0,
          ]);
          $shipping_method->save();
          // Adding newly created shipment method to shipment.
          $first_shipment->setShippingMethod($shipping_method);
          // Adding amount to shipment.
          $shipping_method_plugin = $shipping_method->getPlugin();
          $shipping_rates = $shipping_method_plugin->calculateRates($first_shipment);
          $shipping_rate = reset($shipping_rates);
          $shipping_service = $shipping_rate->getService()->getId();
          $amount = reset($shipping_rates)->getAmount();
          $first_shipment->setAmount($amount);
          $first_shipment->save();

          $order->set('shipments', [$first_shipment]);
          $order->save();

          // Creating shipment profile using data from EDI file.
          $shipment_profile = Profile::create([
            'uid' => $order->getCustomerId(),
            'type' => 'customer',
          ]);
          $shipment_profile->address->given_name = $given_name;
          $shipment_profile->set('field_contact_person', implode(" ", $name));
          $shipment_profile->address->family_name = $family_name;
          $shipment_profile->address->organization = $organization;
          $shipment_profile->set('field_company', $organization);
          $shipment_profile->address->country_code = $country_code;
          $shipment_profile->set('field_new_country', $country_code);
          $shipment_profile->address->locality = $locality;
          $shipment_profile->set('field_city', $locality);
          $shipment_profile->address->postal_code = $postal_code;
          $shipment_profile->set('field_zip_code', $postal_code);
          $shipment_profile->address->address_line1 = $address_line1;
          $shipment_profile->set('field_address_1', $address_line1);
          $shipment_profile->save();
          $first_shipment->setShippingProfile($shipment_profile);
          $first_shipment->setShippingService($shipping_service);
          $first_shipment->save();
          $order->set('shipments', $first_shipment);
          // Create a billing profile.
          if (empty($order->getBillingProfile())) {
            $billing_profile = Profile::create([
              'type' => 'customer',
              'uid' => $order->getCustomerId(),
            ]);
            $billing_profile->save();
            $billing_profile->set('field_address_1', $billing_address);
            $billing_profile->set('field_city', $billing_city);
            $billing_profile->set('field_company', $billing_company);
            $billing_profile->set('field_zip_code', $billing_zip_code);
            $billing_profile->save();
            $order->setBillingProfile($billing_profile);
            $order->save();
          }
          // Including tax into price.
          $priceWithTax = $order->getTotalPrice()->getNumber() + ($order->getTotalPrice()->getNumber() * $tax);
          $order->set('total_price', new Price(round($priceWithTax, 2), $currency));
          $order->save();
          // Checking the number of line items.
          if ($numberOfLineItems == count($orderItems)) {
            $poruka = 'Order created.';
          }
          else {
            $poruka = 'Order was not created.';
          }
          // @todo Ovo će trebati da se otkomentariše u nekom momentu.
          // ftp_delete($ftp, $file);.
          return [
            '#markup' => $poruka,
          ];
        }
        else {
          // @todo Create a logic for putting wrong files in the error directory.
          $this->logger->error('Wrong file format');
        }
      }
    }
    // Closing ftp connection.
    ftp_close($ftp);
  }

}
$ediFile = file_get_contents('./sites/default/files/1509018E1-000523-1611970.EDI');
/**
 * Provides My Config Block.
 *
 * @Block(
 *   id = "config_block",
 *   admin_label = @Translation("My Config Block"),
 *   category = @Translation("My Config Block"),
 * )
 */
/**
 * @param  {number} ID
 * @param  {number} type
 * @param  {HTMLElement} $element
 */
//https://www.freecodecamp.org/news/what-is-a-javascript-object/

function thumbs_rating_vote(ID, type) {
	const itemName = `thumbsrating${ID}`; // For the LocalStorage
	const IDS = {
		container: `thumbs-rating-${ID}`
	};
	const CLASSES = {
		alreadyVoted: `thumbs-rating-already-voted`,
		container: `thumbs-rating-container`,
		down: `thumbs-rating-down`,
		up: `thumbs-rating-up`,
		show: `thumbs-rating-show`,
		voted: `thumbs-rating-voted`
	};
	const $container = document.getElementById(IDS.container);

	// Check if the LocalStorage value exist. If do nothing.
	if (!localStorage.getItem(itemName)) {
		// Set the localStorage type as well
		const typeItemName = `${itemName}-${type}`;

		// Set HTML5 LocalStorage so the user can not vote again unless the user clears it.
		localStorage.setItem(itemName, true);
		localStorage.setItem(typeItemName, true);

		// Data for the Ajax Request
		const data = new FormData();

    data.append( 'action', 'thumbs_rating_add_vote' );
    data.append( 'nonce', thumbs_rating_ajax.nonce );
    data.append( 'postid', ID );
    data.append( 'type', type );

    fetch(thumbs_rating_ajax.ajax_url, {
				method: "POST",
				credentials: 'same-origin',
				body: data
			})
			.then((response) => response.text())
			.then((data) => {
				if (data && $container) {
					$container.innerHTML = data;
				}
			})
			.catch((error) => {
				console.log('[Thumbs Rating Plugin - error]');
				console.error(error);
			});

	} else {
		if ($container) {
			const $alreadyVoted = $container.querySelector(`.${CLASSES.alreadyVoted}`);

			// Display message if we detect LocalStorage
			if ($alreadyVoted) {
				$alreadyVoted.classList.add(CLASSES.show);
			}
		}
	}
}
/*Ovaj kod možemo da pišemo u modules/module.module fajlu ili u themes/module.theme fajlu.
Prvo ide naziv modula (green_deal_core), zatim ide preprocess, i onda naziv template-a kojem hoćemo da prosledimo varijablu (commerce_product__teaser, ovaj template najčešće nalazimo u public_html->themes->custom->templates). Izvorni naziv template-a je sa crticama (-) ali mi to u hook moramo promeniti na underline (_).

Zatim upišemo $varibles['test'] i onda varijablu {{ test }} možemo da koristimo u tom template-u (commerce_product__teaser).

OBAVEZNO MORAMO DA FLAŠUJEMO KEŠ NAKON ŠTO NAPRAVIMO HOOK.
*/

function green_deal_core_preprocess_commerce_product__teaser(&$variables) {
  $variables['test'] = '123';
}
<?php
$date = new DateTime("now", new DateTimeZone('America/New_York') );
echo $date->format('Y-m-d H:i:s');
kazan_dizajner.admin_settings:
  path: '/kazan-dizajner/cenovnik'
  defaults:
    _form: '\Drupal\kazan_dizajner\Form\DesignerBlockSettingsForm'
    _title: 'Cenovnik kazana'
  requirements:
    _permission: 'administer kazan dizajner'

kazan_dizajner.send_mail_controller:
  path: '/kreiraj-svoj-kazan/izvestaj'
  defaults:
    _controller: '\Drupal\kazan_dizajner\Controller\SendMailController::sendmail'
    _title: 'Dizajn poslat'
  requirements:
    _role: 'authenticated'

kazan_dizajner.kazani_form:
  path: '/kazani_forma'
  defaults:
    _form: '\Drupal\kazan_dizajner\Form\KazaniForm'
    _title: 'Kazani forma'
  requirements:
    _permission: 'access content'
<?php

namespace Drupal\kazan_dizajner\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class KazaniForm extends FormBase {

  protected $cena;

  public function getFormId(): string
  {
    return 'kazani_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state): array
  {
    $form['kazani_tipovi'] = [
      '#type' => 'radios',
      '#title' => '1. Izaberite model kazana koji želite da kreirate:',
      '#options' => [
        'prevrtac' => 'Kazani prevrtači',
        'praktik' => 'Kazani praktik',
        'profesionalni' => 'Kazani profesionalni',
      ],
    ];
    $form['kazani_prevrtaci_zapremina'] = [
      '#type' => 'radios',
      '#title' => '2. Izaberite zapreminu kotla:',
      '#options' => [
        '_prevrtac_40_litara' => '40 litara',
        '_prevrtac_60_litara' => '60 litara',
        '_prevrtac_80_litara' => '80 litara',
        '_prevrtac_100_litara' => '100 litara'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => ['value' => 'prevrtac']
        ]
      ],
      //TODO: Ne rade conditional fieldovi kada radi ajax
//      '#ajax' => [
//        'callback' => '::myAjaxCallback',
//        'wrapper' => 'edit-output',
//        'progress' => [
//          'type' => 'throbber',
//          'message' => $this->t('Verifying entry...'),
//        ],
//      ]
    ];
    $form['kazani_prevrtaci_debljina_dna'] = [
      '#type' => 'radios',
      '#title' => 'Izaberite debljinu dna kotla:',
      '#options' => [
        '_prevrtac_1_5_mm' => 'Dno kotla - 1.5 mm',
        '_prevrtac_2_mm' => 'Dno kotla - 2 mm',
        '_prevrtac_3_mmm' => 'Dno kotla - 3 mm',
        '_prevrtac_4_mm' => 'Dno kotla - 4 mm'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_prevrtaci_zapremina"]' => [
            ['value' => '_prevrtac_40_litara'],
            ['value' => '_prevrtac_60_litara'],
            ['value' => '_prevrtac_80_litara'],
            ['value' => '_prevrtac_100_litara'],
          ],
          ['input[name="kazani_tipovi"]' => ['value' => 'prevrtac']]
        ]
      ]
    ];
    $form['kazani_prevrtaci_cev'] = [
      '#type' => 'radios',
      '#title' => '3. Izaberite željenu dužinu i prečnik cevi/lule:',
      '#options' => [
        '_prevrtac_fi28x1500mm' => 'Cev/lula - fi 28x1500 mm (STANDARD)',
        '_prevrtac_fi28x2000mm' => 'Cev/lula - fi 28x2000 mm',
        '_prevrtac_fi28x2500mm' => 'Cev/lula - fi 28x2500 mm',
        '_prevrtac_fi28x3000mm' => 'Cev/lula - fi 28x3000 mm',
        '_prevrtac_fi28x3500mm' => 'Cev/lula - fi 28x3500 mm',
        '_prevrtac_fi28x4000mm' => 'Cev/lula - fi 28x4000 mm',
        '_prevrtac_fi40x2000mm' => 'Cev/lula - fi 40x2000 mm',
        '_prevrtac_fi40x2500mm' => 'Cev/lula - fi 40x2500 mm',
        '_prevrtac_fi40x3000mm' => 'Cev/lula - fi 40x3000 mm',
        '_prevrtac_fi40x3500mm' => 'Cev/lula - fi 40x3500 mm',
        '_prevrtac_fi40x4000mm' => 'Cev/lula - fi 40x4000 mm',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => ['value' => 'prevrtac']
        ],
      ]
    ];
    $form['kazani_prevrtaci_hladnjak'] = [
      '#type' => 'radios',
      '#title' => '4. Izaberite zapreminu i model hladnjaka:',
      '#options' => [
        '_prevrtac_pocinkovani_od_330_litara' => 'Pocinkovani hladnjak od 330 litara (STANDARD)',
        '_praktik_prohromski_od_330_litara' => 'Prohromski hladnjak od 330 litara',
        '_prevrtac_pocinkovani_od_470_litara' => 'Pocinkovani hladnjak od 470 litara',
        '_prevrtac_prohromski_od_470_litara' => 'Prohromski hladnjak od 470 litara'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'prevrtac'],
          ]
        ],
      ]
    ];
    $form['hladnjak_prevrtaci_izmenjivac'] = [
      '#type' => 'radios',
      '#title' => 'Izmenjivač toplote u hladnjaku',
      '#options' => [
        '_prevrtac_spirala_5_navoja' => 'Spirala 5 navoja (STANDARD)',
        '_prevrtac_cilindar_kiler' => 'Doplata za cilindar/kiler'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'prevrtac'],
          ]
        ],
      ]
    ];
    $form['kazani_prevrtaci_mesalica'] = [
      '#type' => 'radios',
      '#title' => '5. Izaberite jednu od varijanti mešalice:',
      '#options' => [
        '_prevrtac_rucna' => 'Ručna mešalica (STANDARD)',
        '_prevrtac_elektricna' => 'Električna mešalica'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'prevrtac'],
          ]
        ],
      ]
    ];
    $form['dodatna_prevrtaci_oprema'] = [
      '#type' => 'checkboxes',
      '#title' => '6. Izaberite potrebnu dodatnu opremu:',
      '#options' => [
        '_prevrtac_alkoholmetar' => 'Alkoholmetar',
        '_prevrtac_sirometar' => 'Sirometar',
        '_prevrtac_plamenik' => 'Plamenik',
        '_prevrtac_levak' => 'Levak',
        '_prevrtac_menzura' => 'Menzura',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'prevrtac'],
          ]
        ],
      ]
    ];
    // Kazani praktik.
    $form['kazani_praktik_zapremina'] = [
      '#type' => 'radios',
      '#title' => '2. Izaberite zapreminu kotla:',
      '#options' => [
        '_praktik_60_litara' => '60 litara',
        '_praktik_80_litara' => '80 litara',
        '_praktik_100_litara' => '100 litara'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => ['value' => 'praktik']
        ]
      ]
    ];
    $form['kazani_praktik_debljina_dna'] = [
      '#type' => 'radios',
      '#title' => 'Izaberite debljinu dna kotla:',
      '#options' => [
        '_praktik_1_5_mm' => 'Dno kotla - 1.5 mm',
        '_praktik_2_mm' => 'Dno kotla - 2 mm',
        '_praktik_3_mmm' => 'Dno kotla - 3 mm',
        '_praktik_4_mm' => 'Dno kotla - 4 mm'
      ],
      '#states' => [
        'visible' => [
          ':input[name="kazani_praktik_zapremina"]' => [
            ['value' => '_praktik_60_litara'],
            ['value' => '_praktik_80_litara'],
            ['value' => '_praktik_100_litara']
          ],
          [':input[name="kazani_tipovi"]' => ['value' => 'praktik']]
        ]
      ]
    ];
    $form['kazani_praktik_cev'] = [
      '#type' => 'radios',
      '#title' => '3. Izaberite željenu dužinu i prečnik cevi/lule:',
      '#options' => [
        '_praktik_fi40x2000mm' => 'Cev/lula - fi 40x2000 mm (STANDARD)',
        '_praktik_fi40x2500mm' => 'Cev/lula - fi 40x2500 mm',
        '_praktik_fi40x3000mm' => 'Cev/lula - fi 40x3000 mm',
        '_praktik_fi40x3500mm' => 'Cev/lula - fi 40x3500 mm',
        '_praktik_fi40x4000mm' => 'Cev/lula - fi 40x4000 mm',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => ['value' => 'praktik']
        ],
      ]
    ];
    $form['kazani_praktik_hladnjak'] = [
      '#type' => 'radios',
      '#title' => '4. Izaberite zapreminu i model hladnjaka:',
      '#options' => [
        '_praktik_pocinkovani_od_330_litara' => 'Pocinkovani hladnjak od 330 litara (STANDARD)',
        '_praktik_prohromski_od_330_litara' => 'Prohromski hladnjak od 330 litara',
        '_praktik_pocinkovani_od_470_litara' => 'Pocinkovani hladnjak od 470 litara',
        '_praktik_prohromski_od_470_litara' => 'Prohromski hladnjak od 470 litara'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'praktik'],
          ]
        ],
      ]
    ];
    $form['hladnjak_praktik_izmenjivac'] = [
      '#type' => 'radios',
      '#title' => 'Izmenjivač toplote u hladnjaku',
      '#options' => [
        '_praktik_spirala_5_navoja' => 'Spirala 5 navoja (STANDARD)',
        '_praktik_cilindar_kiler' => 'Doplata za cilindar/kiler'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'praktik'],
          ]
        ],
      ]
    ];
    $form['kazani_praktik_mesalica'] = [
      '#type' => 'radios',
      '#title' => '5. Izaberite jednu od varijanti mešalice:',
      '#options' => [
        '_praktik_rucna' => 'Ručna mešalica (STANDARD)',
        '_praktik_elektricna' => 'Električna mešalica'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'praktik'],
          ]
        ],
      ]
    ];
    $form['dodatna_praktik_oprema'] = [
      '#type' => 'checkboxes',
      '#title' => '6. Izaberite potrebnu dodatnu opremu:',
      '#options' => [
        '_praktik_alkoholmetar' => 'Alkoholmetar',
        '_praktik_sirometar' => 'Sirometar',
        '_praktik_plamenik' => 'Plamenik',
        '_praktik_levak' => 'Levak',
        '_praktik_menzura' => 'Menzura',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'praktik'],
          ]
        ],
      ]
    ];
    // Kazani profesionalni.
    $form['kazani_profesionalni_zapremina'] = [
      '#type' => 'radios',
      '#title' => '2. Izaberite zapreminu kotla:',
      '#options' => [
        '_profi_80_litara' => '80 litara',
        '_profi_100_litara' => '100 litara',
        '_profi_120_litara' => '120 litara',
        '_profi_160_litara' => '160 litara',
        '_profi_200_litara' => '200 litara',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => ['value' => 'profesionalni']
        ]
      ]
    ];
    $form['kazani_profesionalni_debljina_dna'] = [
      '#type' => 'radios',
      '#title' => 'Izaberite debljinu dna kotla:',
      '#options' => [
        '_profi_1_5_mm' => 'Dno kotla - 1.5 mm (STANDARD)',
        '_profi_2_mm' => 'Dno kotla - 2 mm',
        '_profi_3_mmm' => 'Dno kotla - 3 mm',
        '_profi_4_mm' => 'Dno kotla - 4 mm',
        '_profi_5_mm' => 'Dno kotla - 5 mm',
      ],
      '#states' => [
        'visible' => [
          ':input[name="kazani_profesionalni_zapremina"]' => [
            ['value' => '_profi_80_litara'],
            ['value' => '_profi_100_litara'],
            ['value' => '_profi_120_litara'],
            ['value' => '_profi_160_litara'],
            ['value' => '_profi_200_litara'],
          ],
          [':input[name="kazani_tipovi"]' => ['value' => 'profesionalni']]
        ],
      ]
    ];
    $form['kazani_profesionalni_cev'] = [
      '#type' => 'radios',
      '#title' => '3. Izaberite željenu dužinu i prečnik cevi/lule:',
      '#options' => [
        '_profi_fi40x2000mm' => 'Cev/lula - fi 40x2000 mm (STANDARD)',
        '_profi_fi40x2500mm' => 'Cev/lula - fi 40x2500 mm',
        '_profi_fi40x3000mm' => 'Cev/lula - fi 40x3000 mm',
        '_profi_fi40x3500mm' => 'Cev/lula - fi 40x3500 mm',
        '_profi_fi40x4000mm' => 'Cev/lula - fi 40x4000 mm',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => ['value' => 'profesionalni']
        ],
      ]
    ];
    $form['kazani_profesionalni_hladnjak'] = [
      '#type' => 'radios',
      '#title' => '4. Izaberite zapreminu i model hladnjaka:',
      '#options' => [
        '_profi_pocinkovani_od_330_litara' => 'Pocinkovani hladnjak od 330 litara (STANDARD)',
        '_profi_prohromski_od_330_litara' => 'Prohromski hladnjak od 330 litara',
        '_profi_pocinkovani_od_470_litara' => 'Pocinkovani hladnjak od 470 litara',
        '_profi_prohromski_od_470_litara' => 'Prohromski hladnjak od 470 litara'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'profesionalni']
          ]
        ],
      ]
    ];
    $form['hladnjak_profesionalni_izmenjivac'] = [
      '#type' => 'radios',
      '#title' => 'Izmenjivač toplote u hladnjaku',
      '#options' => [
        '_profi_spirala_5_navoja' => 'Spirala 5 navoja (STANDARD)',
        '_profi_cilindar_kiler' => 'Doplata za cilindar/kiler'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'profesionalni']
          ]
        ],
      ]
    ];
    $form['kazani_profesionalni_mesalica'] = [
      '#type' => 'radios',
      '#title' => '5. Izaberite jednu od varijanti mešalice:',
      '#options' => [
        '_profi_rucna' => 'Ručna mešalica (STANDARD)',
        '_profi_elektricna' => 'Električna mešalica'
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'profesionalni']
          ]
        ],
      ]
    ];
    $form['dodatna_profesionalni_oprema'] = [
      '#type' => 'checkboxes',
      '#title' => '6. Izaberite potrebnu dodatnu opremu:',
      '#options' => [
        '_profi_alkoholmetar' => 'Alkoholmetar',
        '_profi_sirometar' => 'Sirometar',
        '_profi_plamenik' => 'Plamenik',
        '_profi_levak' => 'Levak',
        '_profi_menzura' => 'Menzura',
      ],
      '#states' => [
        'visible' => [
          'input[name="kazani_tipovi"]' => [
            ['value' => 'profesionalni']
          ]
        ],
      ]
    ];
    $form['izracunaj_cenu'] = [
      '#type' => 'button',
      '#value' => 'Izracunaj cenu',
      '#ajax' => [
        'callback' => '::cene',
        'wrapper' => 'edit-output',
        'progress' => [
          'type' => 'throbber',
          'message' => $this->t('Verifying entry...'),
        ]
      ]
    ];
    // Order price.
    $form['cena'] = [
      '#type' => 'label',
      '#attributes' => ['id' => 'edit-output'],
      '#title' => 'Cena',
    ];
    // User information.
    $form['emailaddress'] = [
      '#type' => 'email',
      '#title' => 'E-mail (dobićete kopiju gore kreiranog kazana)*'
    ];
    $form['phone'] = [
      '#type' => 'tel',
      '#title' => 'Broj telefona*'
    ];
    $form['message'] = [
      '#type' => 'textarea',
      '#title' => 'Poruka*'
    ];
    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save'),
      '#button_type' => 'primary'
    ];

    return $form;
  }

  public static function cene(array &$form, FormStateInterface $form_state) {
    $config = \Drupal::config('kazan_dizajner.settings');
    $cena = '';
    $oprema_cena = '';
    // Fetching users input for acquiring each item price.
    if ($form_state->getUserInput()['kazani_tipovi'] == 'prevrtac') {
      $zapremina = $form_state->getUserInput()['kazani_prevrtaci_zapremina'];
      ($zapremina) ? $form_state->getUserInput()['kazani_prevrtaci_zapremina'] : '';
      $dno = $form_state->getUserInput()['kazani_prevrtaci_debljina_dna'];
      ($dno) ? $form_state->getUserInput()['kazani_prevrtaci_debljina_dna'] : '';
      $cev = $form_state->getUserInput()['kazani_prevrtaci_cev'];
      ($cev) ? $form_state->getUserInput()['kazani_prevrtaci_cev'] : '';
      $hladnjak = $form_state->getUserInput()['kazani_prevrtaci_hladnjak'];
      ($hladnjak) ? $form_state->getUserInput()['kazani_prevrtaci_hladnjak'] : '';
      $izmenjivac = $form_state->getUserInput()['hladnjak_prevrtaci_izmenjivac'];
      ($izmenjivac) ? $form_state->getUserInput()['hladnjak_prevrtaci_izmenjivac'] : '';
      $mesalica = $form_state->getUserInput()['kazani_prevrtaci_mesalica'];
      ($mesalica) ? $form_state->getUserInput()['kazani_prevrtaci_mesalica'] : '';
      $dodaci = $form_state->getUserInput()['dodatna_prevrtaci_oprema'];
      foreach ($dodaci as $dodatak) {
        if ($dodatak != NULL) {
          $oprema_cena += $config->get($dodatak);
        }
      }
    } else if ($form_state->getUserInput()['kazani_tipovi'] == 'praktik') {
      $zapremina = $form_state->getUserInput()['kazani_praktik_zapremina'];
      ($zapremina) ? $form_state->getUserInput()['kazani_prevrtaci_zapremina'] : '';
      $dno = $form_state->getUserInput()['kazani_praktik_debljina_dna'];
      ($dno) ? $form_state->getUserInput()['kazani_praktik_debljina_dna'] : '';
      $cev = $form_state->getUserInput()['kazani_praktik_cev'];
      ($cev) ? $form_state->getUserInput()['kazani_praktik_cev'] : '';
      $hladnjak = $form_state->getUserInput()['kazani_praktik_hladnjak'];
      ($hladnjak) ? $form_state->getUserInput()['kazani_praktik_hladnjak'] : '';
      $izmenjivac = $form_state->getUserInput()['hladnjak_praktik_izmenjivac'];
      ($izmenjivac) ? $form_state->getUserInput()['hladnjak_praktik_izmenjivac'] : '';
      $mesalica = $form_state->getUserInput()['kazani_praktik_mesalica'];
      ($mesalica) ? $form_state->getUserInput()['kazani_praktik_mesalica'] : '';
      $dodaci = $form_state->getUserInput()['dodatna_praktik_oprema'];
      foreach ($dodaci as $dodatak) {
        if ($dodatak != NULL) {
          $oprema_cena += $config->get($dodatak);
        }
      }
    } else {
      $zapremina = $form_state->getUserInput()['kazani_profesionalni_zapremina'];
      ($zapremina) ? $form_state->getUserInput()['kazani_profesionalni_zapremina'] : '';
      $dno = $form_state->getUserInput()['kazani_profesionalni_debljina_dna'];
      ($dno) ? $form_state->getUserInput()['kazani_profesionalni_debljina_dna'] : '';
      $cev = $form_state->getUserInput()['kazani_profesionalni_cev'];
      ($cev) ? $form_state->getUserInput()['kazani_profesionalni_cev'] : '';
      $hladnjak = $form_state->getUserInput()['kazani_profesionalni_hladnjak'];
      ($hladnjak) ? $form_state->getUserInput()['kazani_profesionalni_hladnjak'] : '';
      $izmenjivac = $form_state->getUserInput()['hladnjak_profesionalni_izmenjivac'];
      ($izmenjivac) ? $form_state->getUserInput()['hladnjak_profesionalni_izmenjivac'] : '';
      $mesalica = $form_state->getUserInput()['kazani_profesionalni_mesalica'];
      ($mesalica) ? $form_state->getUserInput()['kazani_profesionalni_mesalica'] : '';
      $dodaci = $form_state->getUserInput()['dodatna_profesionalni_oprema'];
      foreach ($dodaci as $dodatak) {
        if ($dodatak != NULL) {
          $oprema_cena += $config->get($dodatak);
        }
      }
    }
    //Calculating total order price.
    $artikli = [];
    array_push($artikli, $zapremina, $dno, $cev, $hladnjak, $izmenjivac, $mesalica);
    foreach($artikli as $artikal) {
      if ($artikal != NULL) {
        $cena += $config->get($artikal);
      }
    }
    $cena += $oprema_cena;

    $form['cena']['#title'] = 'Cena ovog kazana bi iznosila ' . $cena . ' RSD.';
    return $form['cena'];
  }

  public function submitForm(array &$form, FormStateInterface $form_state)
  {
    if ($form_state->getValue)

    $message =
      'Specifikacija kazana' . PHP_EOL . PHP_EOL
    . 'Email: ' . $form_state->getValue('emailaddress') . PHP_EOL
    . 'Telefon: ' . $form_state->getValue('phone') . PHP_EOL
    . 'Poruka: ' . $form_state->getValue('message') . PHP_EOL
    . 'Tip: ' . $form_state->getValue('kazani_tipovi') . PHP_EOL
    . 'Zapremina: ' . $form_state->getValue('');
    $mailManager = \Drupal::service('plugin.manager.mail');
    $module = 'kazan_dizajner';
    $key = 'mail_order';
    $to = $form_state->getValue('emailaddress');
    dsm($form_state->getValue('kazani_tipovi'));

  }
}
<?php

namespace Drupal\musin_core\Service;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountInterface;

class UserHelperService {


  /**
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $currentUser;

  /**
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  public function __construct(AccountInterface $current_user, EntityTypeManagerInterface $entity_type_manager) {
    $this->currentUser = $current_user;
    $this->entityTypeManager = $entity_type_manager;
  }

  public static function getProfileCompleteness($user) {
    $field_weightings = [
      'field_first_name' => 10,
      'field_last_name' => 10,
      'field_city' => 10,
      'field_age' => 10,
      'user_picture' => 10,
      'field_cover_image' => 10,
      'field_genres' => 5,
      'field_instruments' => 5,
      'field_sample_tracks' => 5,
      'field_short_biography' => 5,
      'field_social_media_soundcloud' => 5,
      'field_social_media_spotify' => 5,
      'field_social_media_tiktok' => 5,
      'field_social_media_youtube' => 5,
    ];

    $completeness = 0;

    foreach ($field_weightings as $key => $value) {
      if ($user->hasField($key) && $user->get($key)->isEmpty() === FALSE) {
        $completeness = $completeness + $value;
      }
    }
    return $completeness;
  }
}
<?php

namespace Drupal\musin_core\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\musin_core\Service\UserHelperService;

class CompletenessController extends ControllerBase {

  protected $entityTypeManager;

  public function populateCompleteness()
  {
    $query = \Drupal::entityQuery('user');
    $uids = $query->execute();

    foreach ($uids as $key => $id) {
      $user = \Drupal::entityTypeManager()->getStorage('user')->load($id);
      $result = UserHelperService::getProfileCompleteness($user);
      $user->set('field_completeness', $result);
      $user->save();
    }
    return [];
  }
}
/**
 * Implements hook_entity_presave.
 */
function musin_core_entity_presave(EntityInterface $entity) {
  if ($entity instanceof \Drupal\user\UserInterface) {
    $completeness = \Drupal\musin_core\Service\UserHelperService::getProfileCompleteness($entity);
    $entity->set('field_completeness', $completeness);
    $entity->save();
  }
}
$today = date("Y-m-d");
$expire = $row->expireDate; //from database

$today_time = strtotime($today);
$expire_time = strtotime($expire);

if ($expire_time < $today_time) { /* do Something */ }
function check_attempted_login( $user, $username, $password ) {
    if ( get_transient( 'attempted_login' ) ) {
        $datas = get_transient( 'attempted_login' );

        if ( $datas['tried'] >= 3 ) {
            $until = get_option( '_transient_timeout_' . 'attempted_login' );
            $time = time_to_go( $until );

            return new WP_Error( 'too_many_tried',  sprintf( __( '<strong>ERROR</strong>: You have reached authentication limit, you will be able to try again in %1$s.' ) , $time ) );
        }
    }

    return $user;
}
add_filter( 'authenticate', 'check_attempted_login', 30, 3 );
function login_failed( $username ) {
    if ( get_transient( 'attempted_login' ) ) {
        $datas = get_transient( 'attempted_login' );
        $datas['tried']++;

        if ( $datas['tried'] <= 3 )
            set_transient( 'attempted_login', $datas , 300 );
    } else {
        $datas = array(
            'tried'     => 1
        );
        set_transient( 'attempted_login', $datas , 300 );
    }
}
add_action( 'wp_login_failed', 'login_failed', 10, 1 );

function time_to_go($timestamp)
{

    // converting the mysql timestamp to php time
    $periods = array(
        "second",
        "minute",
        "hour",
        "day",
        "week",
        "month",
        "year"
    );
    $lengths = array(
        "60",
        "60",
        "24",
        "7",
        "4.35",
        "12"
    );
    $current_timestamp = time();
    $difference = abs($current_timestamp - $timestamp);
    for ($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i ++) {
        $difference /= $lengths[$i];
    }
    $difference = round($difference);
    if (isset($difference)) {
        if ($difference != 1)
            $periods[$i] .= "s";
            $output = "$difference $periods[$i]";
            return $output;
    }
}
<!--la ruta absoluta-->
<img src="<?php echo get_bloginfo('wpurl');?>/wp-content/themes/temacreado/img/w.logo.png" alt="">
<!--
<?php echo get_bloginfo('wpurl');?> nos da la ruta de: http://localhost/cliente/  la ruta del archivo que tiene todo el wordpress dentro.
-->   
  
<!--La ruta relativa-->
<img src="wp-content/themes/temacreado/img/w.logo.png" alt="">
<!--
solo es la ruta relativa que es segun la ubicación del archivo
pero como los dos archivos se crean con page.php solo la portada es direccionada adecuadamente con esa direción relativa. lo que las paginas(no portada)  no lo reconocen; por eso la nececidad de dar la pocición absoluta.
-->

  <!-- Nos dimos cuenta que -->
  
$media = \Drupal\file\Entity\File::load(2); //2 je target_id iz field_image (iz noda npr.).
dsm($media);
$user->set('field_mailchimp_subscription', ['subscribe' => "1"]);
$current_path = $this->request->getCurrentRequest()->headers->get('referer');
$path = explode('8000', $current_path);  
//8000 is just a part of a string, from where we are breaking the string.
$route_name = Url::fromUserInput($path[1])->getRouteName();
return $this->redirect($route_name, ['user' => $user->id()]);
if ( ! function_exists( 'is_shop' ) ) :
    function is_shop() {
        //your codes goes here. 
    }
endif; 
<?php 
/*
 ==================
 Ajax Search
======================	 
*/
// add the ajax fetch js
add_action( 'wp_footer', 'ajax_fetch' );
function ajax_fetch() {
?>
<script type="text/javascript">
function fetch(){

    jQuery.ajax({
        url: '<?php echo admin_url('admin-ajax.php'); ?>',
        type: 'post',
        data: { action: 'data_fetch', keyword: jQuery('#keyword').val() },
        success: function(data) {
            jQuery('#datafetch').html( data );
        }
    });

}
</script>

add_action( 'wp_footer', 'ajax_fetch' );
function ajax_fetch() {
?>
<script type="text/javascript">
	
	function khFunction(){ // on focusout rest inpput field value
	            jQuery('#datafetch').html( " " );
       }
	
    function fetch(){

	//test if there is at least to caracters on the input field 
      if(jQuery('#keyword').val().length > 2){
			
		
    jQuery.ajax({
        url: '<?php echo admin_url('admin-ajax.php'); ?>',
        type: 'post',
        data: { action: 'data_fetch', keyword: jQuery('#keyword').val() },
        success: function(data) {
            jQuery('#datafetch').html( data );
        }
    }); }

}
</script>

<?php
}

// the ajax function
add_action('wp_ajax_data_fetch' , 'data_fetch');
add_action('wp_ajax_nopriv_data_fetch','data_fetch');
function data_fetch(){

    $the_query = new WP_Query( array( 
		'posts_per_page' => -1, 
		's' => esc_attr( $_POST['keyword'] ),
		'category_name' => 'top-apps', 'post_type' => array('post') ) );
	
    if( $the_query->have_posts() ) :
        echo '<ul>';
        while( $the_query->have_posts() ): $the_query->the_post(); ?>

            <li><a href="<?php echo esc_url( post_permalink() ); ?>"><?php the_title();?></a></li>

        <?php endwhile;
       echo '</ul>';
        wp_reset_postdata();  
    endif;

    die();
}


$timestamp = '2014-02-06 16:34:00';
$date = Carbon::createFromFormat('Y-m-d H:i:s', $timestamp, 'Europe/Stockholm');
$date->setTimezone('UTC');
name: Subscribe block
type: module
description: Define a custom block for applying for subscription.
core_version_requirement: ^8 || ^9
package: Custom
dependencies:
  - block
<?php

namespace Drupal\bacademy_core\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Url;
use Drupal\user\Entity\User;

class SubscribeController extends ControllerBase {

  public function __construct(EntityTypeManager $entityTypeManager) {
    $this->entityTypeManager = $entityTypeManager;
  }

  public function subscribe(int $id) {
    $user = $this->entityTypeManager->getStorage('user')->load($id);
    /** @var User $user */
    $subscribed = $user->get('field_mailchimp_subscription')[0]->get('subscribe')->getValue();
    if ($subscribed != "1") {
      $user->set('field_mailchimp_subscription', ['subscribe' => "1"] );
      $user->save();
      return Url::fromRoute('entity.user.canonical', ['user' => $user->id()])->toString();
    } else {
      return Url::fromRoute('entity.user.canonical', ['user' => $user->id()])->toString();
    }
  }
}
<?php

namespace Drupal\bacademy_core\Plugin\Block;

use Drupal\bacademy_core\Controller\SubscribeController;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
 * Provides a 'Subscribe' block.
 *
 * @Block(
 *   id = "subscribe_block",
 *   admin_label= @Translation("Subscribe"),
 *   category= @Translation("Subscribe"),
 * )
 */
class SubscribeBlock extends BlockBase implements ContainerFactoryPluginInterface {

  /**
   * The current user.
   *
   * @var \Drupal\Core\Session\AccountProxyInterface
   */
  protected $currentUser;

  /**
   * Entity type manager.
   *
   * @var EntityTypeManager
   */
  protected $entityTypeManager;

  public function __construct(array $configuration, $plugin_id, $plugin_definition, AccountProxyInterface $current_user, EntityTypeManager $entityTypeManager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->currentUser = $current_user;
    $this->entityTypeManager = $entityTypeManager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition){
    return new static (
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('current_user'),
      $container->get('entity_type.manager')
    );
  }

  /**
   * {@inheritDoc}
   */
  public function build() {
    // Check if current user is subscribed.
    $user = $this->entityTypeManager
      ->getStorage('user')
      ->loadByProperties([
        'uid' => $this->currentUser->id(),
      ]);
    $user = reset($user);
    $subscribed = 0;
    if ($user->hasField('field_mailchimp_subscription')) {
      $subscribed = $user->get('field_mailchimp_subscription')[0]->get('subscribe')->getValue();
    }
    if ($subscribed == "1") {
      return [];
    } else {
      return [
        '#type' => 'inline_template',
        '#template' => "<div>
                        <p>Opt in and don't miss out on the latest from the Academy.</p>
                        <a href='{{ controller_link }}'>YES PLEASE</a>
                        <a href='#'>NO THANKS</a>
                      </div>",
        '#context' => [
          'controller_link' => Url::fromRoute('bacademy_core.subscription', ['id' => $this->currentUser->id()])->toString(),
        ],
      ];
    }
  }
}
//If we don't want to cache anonymus user choices or content
//than we add next line of code in mymodule.routing.yml file
//for the specified page

no_cache: 'TRUE'
$totalPayment = collect($billingData['payment_not_distirbute'])->sum('balance');
// clear that cache
composer create-project drupal/recommended-project myproject -n
cd myproject
lando init --source cwd --recipe drupal8 --webroot web --name myproject
lando start


composer require drush/drush drupal/admin_toolbar
drush si --db-url=mysql://drupal8:drupal8@database/drupal8 --account-pass=content -y
drush en admin_toolbar admin_toolbar_tools
drush uli -l http://myproject.lndo.site
$filterStudents = $search !== null ? [
    'filter[entry_year]' => $entry_year,
    'filter[search]' => $search,
    'relation[student_group]' => 1,
    'page' => (int)$page,
    'per_page' => 20,
] : [
    'filter[entry_year]' => $entry_year,
    'relation[student_group]' => 1,
    'page' => (int)$page,
    'per_page' => 20,
];
function mytheme_preprocess_node(&$variables) {
  switch ($variables['node']->getType()) {
    case "video":
      // ...
    break;
    case "something_else":
      // ...
    break;
  }
}			
function events_preprocess_node(&$variables) {
  // Get route name.
  $routeName = \Drupal::routeMatch()->getRouteName();
  // Get entity.
  $node = &$variables['node'];
  // Check if it's an event.
  if ($node->getType() === 'event' && $node->hasField('field_place')) {
    // Get the place.
    $place = $node->get('field_place')->entity;
    // Check if place is NULL.
    if ($place) {
      if ($node->get('field_teaser_media')->isEmpty()) {
        // Get teaser.
        $variables['place_teaser_media'] = $place
          ->get('field_teaser_media')
          ->view($routeName === 'entity.node.canonical' ? 'default' : 'small_teaser_square');
      }
      // Get organization name from place.
      $variables['place_organization'] = $place
        ->get('field_address')[0]
        ->get('organization')->getValue();
    }
  }
}
$this->assertSame('FooBar', Str::reverse('raBooF'));
$this->assertSame('Teniszütő', Str::reverse('őtüzsineT'));
$this->assertSame('❤MultiByte☆', Str::reverse('☆etyBitluM❤'));
//original
$dotted = [
    'user.name' => 'foo',
    'user.occupation' => 'bar',
];
 
// Converts it back to the original form
Arr::undot($dotted);

// Results in...
$resultArray = [
    'user' => [
        'name' => 'foo',
        'occupation' => 'bar',
    ]
];
$original = [
    'user' => [
        'name' => 'foo',
        'occupation' => 'bar',
    ]
];
 
$dotted = Arr::dot($original);
 
// Results in...
$dotted = [
    'user.name' => 'foo',
    'user.occupation' => 'bar',
];
Event::fakeExcept([
    NonImportantEvent::class,
    'non-fake-event',
]);
$schedule->command('model:prune', [
    '--exclude' => [Test::class, Example::class],
])->daily();
<?php
/* Execute a prepared statement by passing an array of values */
$sql = 'SELECT name, colour, calories
    FROM fruit
    WHERE calories < :calories AND colour = :colour';
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':calories' => 150, ':colour' => 'red'));
$red = $sth->fetchAll();
$sth->execute(array(':calories' => 175, ':colour' => 'yellow'));
$yellow = $sth->fetchAll();
?>
<?php
/* Connect to a MySQL database using driver invocation */
$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';

$dbh = new PDO($dsn, $user, $password);

?>
export $(sudo cat /opt/elasticbeanstalk/deployment/env) && sudo -E -u webapp php artisan tinker
docker run --rm -v `pwd`:/var/www/html pimcore/pimcore:PHP7.4-fpm composer create-project pimcore/skeleton pm6 "2.8.16"

cd pm6

docker-compose up -d

docker-compose run --rm php vendor/bin/pimcore-install --mysql-host-socket=db --mysql-username=pimcore --mysql-password=pimcore --mysql-database=pimcore

docker-compose run --rm php chown -R www-data:www-data var/*
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
add_filter( 'use_widgets_block_editor', '__return_false' );
remove_theme_support( 'widgets-block-editor' );
remove_theme_support(  'block-templates' );
php artisan cache:clear
php artisan route:clear
php artisan config:clear 
php artisan view:clear 
Update your /app/Providers/AppServiceProvider.php to contain:

use Illuminate\Support\Facades\Schema;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Schema::defaultStringLength(191);
}
## Dockerfile
FROM php:7.4-fpm

# Arguments defined in docker-compose.yml
ARG user
ARG uid

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    curl \
    libpng-dev \
    libonig-dev \
    libxml2-dev \
    zip \
    unzip

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Create system user to run Composer and Artisan Commands
RUN useradd -G www-data,root -u $uid -d /home/$user $user
RUN mkdir -p /home/$user/.composer && \
    chown -R $user:$user /home/$user

# Set working directory
WORKDIR /var/www

USER $user

## EOF Dockerfile

## docker-compose.yaml
# Docker compose for PHP, Composer and nginx
# Check Dockerfile to create app image, PHP 7.4 and Composer
# Run: docker-compose up
# After mounted, open container cli 
# 
# Update laravel packages:
##### composer update
# Restart container to apply nginx configuration
##### docker compose restart 

version: "3.7"
services:
  app:
    build:
      args:
        user: sammy
        uid: 1000
      context: ./
      dockerfile: Dockerfile
    image: my-app
    container_name: myapp-php
    restart: always
    working_dir: /var/www/
    volumes:
      - ./:/var/www
    networks:
      - webdev

  nginx:
    image: nginx:alpine
    container_name: myapp-nginx
    restart: unless-stopped
    ports:
      - 8000:80
    volumes:
      - ./:/var/www
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - webdev

networks:
  webdev:
    driver: bridge
    
## EOF docker-compose.yml

## create a nginx.conf file in the root of your app
## nginx.conf

server {
    listen 80;
    index index.php index.html;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    root /var/www/public;
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass app:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
    location / {
        try_files $uri $uri/ /index.php?$query_string;
        gzip_static on;
    }
}

## EOF nginx.conf


Run: 
docker-compose up

When container is up open container console (cli)
composer update
docker compose restart

<? $event_cats_args = array(
            'orderby' => 'name',
            'order' => 'ASC',
            'fields' => 'all'
        ); 
$event_cats = wp_get_object_terms( $event_id, array( 'tribe_events_cat' ), $event_cats_args );
if ( empty( $event_cats ) ) {
  return;
}
if ( is_wp_error( $event_cats ) || ! is_array( $event_cats ) ) {
  return;
} ?>
  
<div class="event-categories">
    <? foreach( $event_cats as $cat ) { 
    	$catid = $cat->term_id;
    	$catname = $cat->name;
    	$catslug = $cat->slug;
    	$catcolor = get_field('category_color', 'tribe_events_cat_' . $catid);
    ?>
      
      <a href="/events/category/<?= $catslug; ?>" rel="tag" style="background-color: <?= $catcolor; ?>;"><?= esc_html( $catname ); ?></a>

    <? } ?>
</div>
<? $event_cats_args = array(
            'orderby' => 'name',
            'order' => 'ASC',
            'fields' => 'all'
        ); 
$event_cats = wp_get_object_terms( $event_id, array( 'tribe_events_cat' ), $event_cats_args );
if ( empty( $event_cats ) ) {
  return;
}
if ( is_wp_error( $event_cats ) || ! is_array( $event_cats ) ) {
  return;
} ?>
  
<div class="event-categories">
    <? foreach( $event_cats as $cat ) { 
    	$catid = $cat->term_id;
    	$catname = $cat->name;
    	$catslug = $cat->slug;
    	$catcolor = get_field('category_color', 'tribe_events_cat_' . $catid);
    ?>
      
      <a href="/events/category/<?= $catslug; ?>" rel="tag" style="background-color: <?= $catcolor; ?>;"><?= esc_html( $catname ); ?></a>

    <? } ?>
</div>
                function doSomething(el) {
                    $.post("sendHtml.php", {
                        "username": "v_username"
                    }, function (data) {
                        $(el).next().append(data);
                    }, "html");
                }

<?php 

$html = '<div class="submenu show-submenu" [class]="(level_1_0 ? \'submenu show-submenu\' : \'submenu show-submenu\') + \' \' + (hideSecondary ? \'hide-parent\' : \'\')" role="menu" aria-label="New">';
$html .= '    <div class="controls" [class]="hideSecondary ? \'controls hide-parent\' : \'controls\'" aria-label="New controls">';
$html .= '        <a tabindex="0" role="button" on="tap:AMP.setState({level_1_0: !level_1_0, hidePrimary: !hidePrimary})" aria-label="Return to Menu"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">';
$html .= '                <path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z" />';
$html .= '            </svg> </a>';
$html .= '        <span class="truncate">New</span>';
$html .= '        <a tabindex="0" role="button" on=\'tap:header-sidebar.toggle\' aria-label="Close New"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">';
$html .= '                <path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z" />';
$html .= '            </svg> </a>';
$html .= '    </div>';
$html .= '    <button class="link-container view-all truncate" title="New">';
$html .= '        View All News';
$html .= '    </button>';
$html .= '</div>';

echo $html;

?>
            /* Database connection start */
            $servername = "localhost";
            $username = "root";
            $password = "";
            $dbname = "test";
            $conn = mysqli_connect($servername, $username, $password, $dbname) or die("Connection failed: " . mysqli_connect_error());
            if (mysqli_connect_errno()) {
                printf("Connect failed: %s\n", mysqli_connect_error());
                exit();
            }

            function get_categories($parent = 0, $conn)
            {
                $html = '<ul>';
                //$str1 = "SELECT * FROM test.tree_struct WHERE pid=" . $parent;

                $str1 = "SELECT test.tree_data.id, nm AS 'text', pid  FROM test.tree_data
                        INNER JOIN test.tree_struct
                            ON test.tree_data.id = test.tree_struct.id WHERE pid=" . $parent;


                $query = mysqli_query($conn, $str1);

                while ($row = mysqli_fetch_assoc($query)) {
                    $current_id = $row['id'];
                    $html .= '<li>' . $row['text'];
                    $has_sub = NULL;
                    $str = "SELECT COUNT('pid') FROM test.tree_struct WHERE pid=" . $parent;

                    $has_sub = mysqli_num_rows(mysqli_query($conn, $str));
                    if ($has_sub) {
                        $html .= get_categories($current_id, $conn);
                    }
                    $html .= '</li>';
                }
                $html .= '</ul>';

                return $html;
            }

            print get_categories(0, $conn);
            $sql = "SELECT test.tree_data.id, nm AS 'text', pid  FROM test.tree_data
                        INNER JOIN test.tree_struct
                            ON test.tree_data.id = test.tree_struct.id; 
                            ";

            $res = mysqli_query($conn, $sql) or die("database error:" . mysqli_error($conn));
            //iterate on results row and create new index array of data
            while ($row = mysqli_fetch_assoc($res)) {
                $data[] = $row;
            }
            $itemsByReference = array();

            // Build array of item references:
            foreach ($data as $key => &$item) {
                $itemsByReference[$item['id']] = &$item;
                // Children array:
                $itemsByReference[$item['id']]['children'] = array();
                // Empty data class (so that json_encode adds "data: {}" )
                $itemsByReference[$item['id']]['data'] = new StdClass();
            }

            // Set items as children of the relevant parent item.
            foreach ($data as $key => &$item)
                if ($item['pid'] && isset($itemsByReference[$item['pid']]))
                    $itemsByReference [$item['pid']]['children'][] = &$item;

            // Remove items that were added to parents elsewhere:
            foreach ($data as $key => &$item) {
                if ($item['pid'] && isset($itemsByReference[$item['pid']]))
                    unset($data[$key]);
            }

            // Encode:
            echo json_encode($data);
mysql -u root -p -h 127.0.0.1 -P 3306
// DO NOT USE THIS CODE, IT DOES NOT WORK - TESTING ONLY FOR thiscodeWorks.

public function index() {
  return inertia::render('Home/Index', [
    $user => User(map.all);
    'id' -> $user=>id,
    'user' -> $user=>user,
  ]);
};
// Remove Shipping Information on Virtual Products
//============================
add_filter( 'woocommerce_checkout_fields' , 'virtual_products_less_fields' );

function virtual_products_less_fields( $fields ) {

    $virtual_products = true;

    foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

        if ( ! $cart_item['data']->is_virtual() ) $virtual_products = false;
    }

    if( $virtual_products===true) {
        unset($fields['billing']['billing_company']);
        unset($fields['billing']['billing_address_1']);
        unset($fields['billing']['billing_address_2']);
        unset($fields['billing']['billing_city']);
        unset($fields['billing']['billing_postcode']);
        unset($fields['billing']['billing_country']);
        unset($fields['billing']['billing_state']);
        unset($fields['billing']['billing_phone']);

        add_filter( 'woocommerce_enable_order_notes_field', '__return_false',9999 );
    }

    return $fields;
}
// in terminal, php artisan to create middleware
php artisan make:middleware VerifyIsAdmin

// in VerifyIsAdmin middleware file
public function handle(Request $request, Closure $next)
{
  if (!auth()->user()->isAdmin()) {
    return redirect()->back();
  }
  return $next($request);
}

// must register in kernel.php
protected $routeMiddleware = [
  'auth' => \App\Http\Middleware\Authenticate::class,
  'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
  'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
  'can' => \Illuminate\Auth\Middleware\Authorize::class,
  'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
  'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
  'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
  'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
  'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
  'verifyCategoryCount' => VerifyCategoriesCount::class,
  'admin' => VerifyIsAdmin::class,
];

// use in Route to ensure user is authenticated and admin
Route::middleware(['auth', 'admin'])->group(function () {
    Route::get('users', [UsersController::class, 'index'])->name('users.index');
});
if ( ! defined( 'WPINC' ) ) {
	die;
}

add_action( 'wp_enqueue_scripts', 'custom_enqueue_files' );
/**
 * Loads <list assets here>.
 */
function custom_enqueue_files() {
	// if this is not the front page, abort.
	// if ( ! is_front_page() ) {
	// 	return;
	// }

	// loads a CSS file in the head.
	// wp_enqueue_style( 'highlightjs-css', plugin_dir_url( __FILE__ ) . 'assets/css/style.css' );

	/**
	 * loads JS files in the footer.
	 */
	// wp_enqueue_script( 'highlightjs', plugin_dir_url( __FILE__ ) . 'assets/js/highlight.pack.js', '', '9.9.0', true );

	// wp_enqueue_script( 'highlightjs-init', plugin_dir_url( __FILE__ ) . 'assets/js/highlight-init.js', '', '1.0.0', true );
}
//set up load.php inside /wp-content/mu-plugins, then add:
require(WPMU_PLUGIN_DIR . '/myplugin/myplugin.php');

//OR –– use below for multiple mu-plugins inside a subdirectory
//
// Opens the must-use plugins directory
$wpmu_plugin_dir = opendir(WPMU_PLUGIN_DIR);

// Lists all the entries in this directory
while (false !== ($entry = readdir($wpmu_plugin_dir))) {
$path = WPMU_PLUGIN_DIR . '/' . $entry;

// Is the current entry a subdirectory?
if ($entry != '.' && $entry != '..' && is_dir($path)) {
// Includes the corresponding plugin
require($path . '/' . $entry . '.php');
}
}

// Closes the directory
closedir($wpmu_plugin_dir);
//disable post revisions
//define('WP_POST_REVISIONS', false );

//limit post revisions
define('WP_POST_REVISIONS', 3);

//enable debug log
//define( 'WP_DEBUG_LOG', true );

//output debug log
//define( 'WP_DEBUG_DISPLAY', true );
// Place in wp-config
// removing the edit_themes, edit_plugins, and edit_files capabilities for all users
define('DISALLOW_FILE_EDIT', true);

// disable theme updates and new plugins 
// define('DISALLOW_FILE_MODS', true);
<?php

/**
 * Add required plugins to WDS_Required_Plugins.
 *
 * @param  array $required Array of required plugins in `plugin_dir/plugin_file.php` form.
 *
 * @return array           Modified array of required plugins.
 */
function wds_required_plugins_add( $required ) {

	$required = array_merge( $required, array(
		'jetpack/jetpack.php',
		'sample-plugin/sample-plugin.php',
	) );

	return $required;
}
add_filter( 'wds_required_plugins', 'wds_required_plugins_add' );

// for network activated plugins
// add_filter( 'wds_network_required_plugins', 'wds_required_plugins_add' );


/**
 * Modify the required-plugin label.
 *
 * @param  string  $label Label markup.
 *
 * @return string         (modified) label markup.
 */
function change_wds_required_plugins_text( $label ) {

	$label_text = __( 'Required Plugin for ACME', 'acme-prefix' );
	$label = sprintf( '<span style="color: #888">%s</span>', $label_text );

	return $label;
}
add_filter( 'wds_required_plugins_text', 'change_wds_required_plugins_text' );

// To hide required plugins
// add_filter( 'wds_required_plugins_remove_from_list', '__return_true' );

/**
 * Make standard form fields to make read-only
 * To apply, add CSS class 'wpf-disable-field' (no quotes) to field in form builder
 *
 * @link https://wpforms.com/developers/disable-a-form-field-to-prevent-user-input/
 *
 */
function wpf_dev_disable_field() {
    ?>
    <script type="text/javascript">
 
    jQuery(function($) {
            $('.wpf-disable-field input, .wpf-disable-field textarea').attr('readonly','readonly');
 
    });
 
    </script>
    <?php
}
add_action( 'wpforms_wp_footer_end', 'wpf_dev_disable_field', 30 );

css

input#wpforms-2228-field_14 {
    background-color: beige;
    color: gainsboro;
}
table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  table-layout: fixed;
  width: 100%;  border-radius: 5px 5px 0 0;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}

table tr {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: .35em;
}

table th,
table td {
  padding: .625em;
  text-align: center;
}

@media screen and (max-width: 600px) {
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
  }
  
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    text-align: right;
  }
  
  table td::before {
    content: attr(data-label);
    float: left;
  }
}

th.one {
  
width: 80px;
    
   
}
th.two{
  
width: 100px;
   
}
th.three{
  
width: 130px;
   
}th.four{
  
width: 300px;
   
}
th.five{
  
width: 150px;
   
}th.five{
  
width: 110px;
  
}th.six{
  
width: 90px;
  
}
table { 
  width: 100%; 
  border-collapse: collapse; 
}
/* Zebra striping */
tr:nth-of-type(odd) { 
  background: #eee; 
}
th { 
  background: #333; 
  color: white; 
  font-weight: bold; 
}
td, th { 
  padding: 5px; 
  border: 1px solid #ccc; 
  text-align: left; 
}
/* 
Max width before this PARTICULAR table gets nasty
This query will take effect for any screen smaller than 760px
and also iPads specifically.
*/
@media 
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px)  {

	/* Force table to not be like tables anymore */
	table, thead, tbody, th, td, tr { 
		display: block; 
	}
	
	/* Hide table headers (but not display: none;, for accessibility) */
	thead tr { 
		position: absolute;
		top: -9999px;
		left: -9999px;
	}
	
	tr { border: 1px solid #ccc; }
	
	td { 
		/* Behave  like a "row" */
		border: none;
		border-bottom: 1px solid #eee; 
		position: relative;
		padding-left: 50%; 
	}
	
	td:before { 
		/* Now like a table header */
		position: absolute;
		/* Top/left values mimic padding */
		top: 6px;
		left: 6px;
		width: 45%; 
		padding-right: 10px; 
		white-space: nowrap;
	}
	
	
}
functions.php
/**
 * Esta función agrega los parámetros "async" y "defer" a recursos de Javascript.
 * Solo se debe agregar "async" o "defer" en cualquier parte del nombre del 
 * recurso (atributo "handle" de la función wp_register_script).
 *
 * @param $tag
 * @param $handle
 *
 * @return mixed
 */
function mg_add_async_defer_attributes( $tag, $handle ) {

	// Busco el valor "async"
	if( strpos( $handle, "async" ) ):
		$tag = str_replace(' src', ' async="async" src', $tag);
	endif;

	// Busco el valor "defer"
	if( strpos( $handle, "defer" ) ):
		$tag = str_replace(' src', ' defer="defer" src', $tag);
	endif;

	return $tag;
}
add_filter('script_loader_tag', 'mg_add_async_defer_attributes', 10, 2);



// Ejemplo con "async".
wp_register_script( 'fichero-js-async', get_stylesheet_directory_uri() . '/js/fichero.js', [], false, true );
wp_enqueue_script( 'fichero-js-async' );


// Ejemplo con "defer".
wp_register_script( 'fichero-js-defer', get_stylesheet_directory_uri() . '/js/fichero.js', [], false, true );
wp_enqueue_script( 'fichero-js-defer' );

<?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);
?>
{print_r(debug_backtrace(), true)}
a#mylink {
    color: #FFFFFF!important;
    display: block;
    margin: 0 auto;
    width: 179px;
    text-align: center;
    padding: 20px;
    font-weight: bold;
    border-width: 0px!important;
    border-color: #0C71C3;
    border-radius: 50px;
    font-family: 'Poppins',Helvetica,Arial,Lucida,sans-serif!important;
    text-transform: uppercase!important;
    background-color: #E09900;
}
<script>
jQuery(document).ready(function($) {
  
  $.urlParam = function (name) {
    var results = new RegExp('[?&]' + name + '=([^&#]*)')
                      .exec(window.location.search);

    return (results !== null) ? results[1] || 0 : false;
}

console.log($.urlParam('id')); //registration
console.log($.urlParam('email')); //bobo@example.com
    var email = decodeURI($.urlParam('email'));
var replaced = email.replace("%40", "@"); 
  var type = decodeURI($.urlParam('type'));

  var replaced2 = type.replace("+", " ");  

  $("#wpforms-2228-field_0").val($.urlParam('id'));
    $("#wpforms-1770-field_4").val(replaced);
    $("#wpforms-1770-field_6").val("Suite a votre demande de devis  nous vous prions de trouver ci joint notre proposition de tarif pour   '" + replaced2 +  "'.... ");


  })
</script>
if (is_page( 'tablefirrstpagenolimit' ) ):
$limit = 20; 
else : $limit = 8;
endif;
// Setup
$post_objects = get_field('acf_post_object_field');
$slug_array = array();

// Loop
if($post_objects) {
  foreach($post_objects as $post_object):
  
  	// Get slug and place into the array
  	$slug_array[] = $post_object->post_name;
  
  endforeach;
}

// Echo
<?= implode(' ', $slug_array); ?>
if ($user->wasRecentlyCreated) {
    // user just created in the database; it didn't exist before.
} else {
    // user already existed and was pulled from database.
}
 array_multisort(array_column($array, 'datetime'), SORT_DESC, $array);
// THE HTML/PHP

// Categories Nav START
<? $terms = get_terms( array(
    'taxonomy' => 'category-name', // <-- update this
    'orderby' => 'ID',
  )); 
  if ( $terms && !is_wp_error( $terms ) ){ ?>
   <ul class="CHANGEME-categories-nav">
      <? foreach( $terms as $term ) { ?>
        <li id="cat-<?php echo $term->term_id; ?>">
           <a href="#" class="<?= $term->slug; ?> ajax" data-term-number="<?= $term->term_id; ?>" title="<?= $term->name;?>"><?= $term->name; ?></a>
        </li>
      <? } ?>
   </ul>
<? } ?>
// Categories Nav END
                                       
// Results Container START
<div id="CHANGEME-results-container" class="CHANGEME-filter-result">
   <? // post query
     $query = new WP_Query( array(
        'post_type' => 'post-name', // <-- update this
        'posts_per_page' => -1,
      ) ); 
   if( $query->have_posts() ): while( $query->have_posts()): $query->the_post(); ?>
    
      // POST TEMPLATE HERE
    
   <? endwhile; endif; wp_reset_query(); ?>
</div>                      
// Results Container END

// The onpage JS for the page template
<script>
(function($) {
        'use strict';
        function cat_ajax_get(catID) {
            jQuery.ajax({
                type: 'POST',
                url: raindrop_localize.ajaxurl,
                data: {"action": "filter", cat: catID },
                success: function(response) {
                    jQuery("#CHANGEME-results-container").html(response);
                    return false;
                }
            });
        }
        $( ".CHANGEME-categories-nav a.ajax" ).click(function(e) {
            e.preventDefault();
            $("a.ajax").removeClass("current");
            $(this).addClass("current"); //adds class current to the category menu item being displayed so you can style it with css
            var catnumber = $(this).attr('data-term-number');
            cat_ajax_get(catnumber);
        });

    })(jQuery);
</script>
                                       
// Callback function for functions.php or some other functions specific php file like theme.php
// Aside from the inital add actions and a few other things, the actual query and post template should be the same as what is on the page.
                                       
add_action( 'wp_ajax_nopriv_filter', 'CHANGEME_cat_posts' );
add_action( 'wp_ajax_filter', 'CHANGEME_cat_posts' );
                                       
function CHANGEME_cat_posts () {
    $cat_id = $_POST[ 'cat' ];
    $args = array (
	  'tax_query' => array(
		    array(
		      'taxonomy' => 'category-name', // <-- update this
		      'field' => 'term_id',
		      'terms' => array( $cat_id )
		    )
		  ),
	    'post_type' => 'post-name', // <-- update this
	    'posts_per_page' => -1,
	  );
	global $post;
    $posts = get_posts( $args );
    ob_start ();
    foreach ( $posts as $post ) { 
	    setup_postdata($post); ?>

	    // POST TEMPLATE HERE

   <?php } wp_reset_postdata();
   $response = ob_get_contents();
   ob_end_clean();
   echo $response;
   die(1);
}
add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'filter_dropdown_option_html', 12, 2 );
function filter_dropdown_option_html( $html, $args ) {
    $show_option_none_text = $args['show_option_none'] ? $args['show_option_none'] : __( 'Choose an option', 'woocommerce' );
    $show_option_none_html = '<option value="">' . esc_html( $show_option_none_text ) . '</option>';

    $html = str_replace($show_option_none_html, '', $html);

    return $html;
}
postgres-# ( terminal commands)
- list all databases : \l
- list of all tables : \d
- list only the tables : \dt
- list all fields in a table : \d person (name of the table)
- import from external file : \i c:/postgrescourse/person.sql
Ex. \i /home/forge/forge33-5-16-23.sql


- connect to database psql and import .sql file
> psql -h localhost -U postgres -d forgeprod -f C:\forgeprod.sql
https://kb.objectrocket.com/postgresql/how-to-run-an-sql-file-in-postgres-846

- access to database to query 
> psql -U postgres -d forgeprod

- datatypes info:
bigserial : increment int in sequence
date : year,month,day



- create database : create database test;
- drop database : drop database test;
- drop table : drop table person;
- connect to a database ( two forms ) :  
\c test (or) -h localhost -p 5432 -U postgres test
- create table sintax : create table table_name ( column name + data type + constraints if any ) 

- create table : 
create table person ( 
	id int,
	first_name varchar(50),
  	last_name varchar(50),
    gender varchar(6),
    date_of_birth date
    );
- create table w/constraints ( need to satisfied rules): 
create table person (
 	id bigserial not null primary key,
 	first_name varchar(50) not null,
 	last_name varchar(50) not null,
    gender varchar(6) not null, 
    date_of_birth date not null
	);

- create table : 
insert into person ( first_name, last_name, gender, date_of_birth) values ('Anne','Smith','Female',date '1988-01-09');

- Using OFFSET and LIMIT : select * from person OFFSET 5 LIMIT 5;
- Using OFFSET and FETCH : select * from person OFFSET 5 FETCH 5 ROW ONLY;
- Using BETWEEN : select * from person where date_of_birth BETWEEN DATE '2000-01-01' and '2015-01-01';
- Diferences between LIKE and ILIKE : ILIKE is case insensitive. 

- Using Group By : select country_of_birth, count(*) from person group by country_of_birth; ( will count how many people are from that country )
- Using Having with Group By : select country_of_birth, count(*) from person having count(*) > 5 group by country_of_birth; ( must have above 5 to show )





function load_animate_css() {
  // Load Boostrap CSS
  wp_enqueue_style( 'animate-css', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css' );

  // Load Css
  wp_enqueue_style( 'style', get_stylesheet_uri() );

}
add_action( 'wp_enqueue_scripts', 'load_animate_css' );
/**
     * Query Public schema and return any req'd settings.
     */
    public static function getSettingsFromPublic()
    {
        if (Schema::connection('public')->hasTable('pubs')) {
            DB::table('public.pubs_settings')->select('ps.id, LOWER(ps.name) AS name, ps.description, ps.value, ps.resolve_include_path, ps.set_as_null, psc.name AS category, cst.name AS type, cse.name AS element')->join('components_settings_types_elements cste', 'cste.id', 'ps.components_settings_types_elements_id')->where('psc.name', 'css')->orderBy('ps.name', 'ASC')->get();
            $statement = "SELECT ps.id, LOWER(ps.name) AS name, ps.description, ps.value, ps.resolve_include_path, ps.set_as_null, psc.name AS category, cst.name AS type, cse.name AS element FROM pubs_settings ps JOIN pubs_settings_categories psc ON (psc.id = ps.pubs_settings_categories_id) JOIN components_settings_types_elements cste ON (cste.id = ps.components_settings_types_elements_id) JOIN components_settings_types cst ON (cst.id = cste.components_settings_types_id) JOIN components_settings_elements cse ON (cse.id = cste.components_settings_elements_id) WHERE psc.name = 'css' ORDER BY ps.name ASC";
            $data = DB::connection('public')->statement($statement);
        }
    }
update_option( 'wp-content-pilot-pro_license_key','license_key' );
update_option( 'wp-content-pilot-pro_license_status','valid' );
$response = $response->withHeader('x-joey-test', 'myvalue');

return $response->withStatus(404)->getBody()->write('not found');
return $response->getBody()->write('hello world');
if(count(array_filter($array)) == 0)
{
	// All values are empty
	...
}
$values = array(array(88868), array(88867), array(88869), array(88870));
foreach ($values as &$value) $value = $value[0];
array_multisort(array_map(function($element) {
  return $element['key'];
}, $result), SORT_ASC, $result);
$user = User::select("users.*","items.id as itemId","jobs.id as jobId")

            ->join("items","items.user_id","=","users.id")

            ->join("jobs",function($join){

                $join->on("jobs.user_id","=","users.id")

                    ->on("jobs.item_id","=","items.id");

            })

            ->get();

print_r($user);
// add clear cache option to shop owner
function wp_rocket_add_purge_cache_to_shop_owner() {
	// gets the shop owner role object
	$role = get_role('shop_manager');
 
	// add a new capability
	$role->add_cap('rocket_purge_cache', true);
}
add_action('init', 'wp_rocket_add_purge_cache_to_shop_owner', 12);
try {
    MFUser::create(array(
        'user_reference' => $this->userReference,
        'first_name' => $this->firstName,
        'last_name' => $this->lastName,
        'user_type_id' => $this->userTypeId,
        'email' => $this->email,
        'password' => $this->password
    ));
} catch (\Illuminate\Database\QueryException $exception) {
    // You can check get the details of the error using `errorInfo`:
    $errorInfo = $exception->errorInfo;

    // Return the response to the client..
}
<?php 

class User {
    public $name;
    public $age;
    public static $minPassLength = 6;

    public static function  validatePass($pass){
        if(strlen($pass) >= self::$minPassLength) { //self because it's static
            return true;
        } else {
            return false;
        }

    }
}
$password = 'hello';
if(User::validatePass($password)) {
    echo 'Password valid';

} else {
    echo 'Password not valid';
}
<?php 

Class User {
    protected $name;
    protected $age;

    public function __construct($name,$age){
        $this->name = $name;
        $this->age = $age;
    }
}

class Customer extends User {
    private $balance;

    public function __construct($name,$age,$balance) {
        $this->balance = $balance;
        parent::__construct($name,$age);
    }

    public function getBalance() {
        return $this->balance;
    }

    public function pay($amount) {
        return $this->name . ' paid $'. $amount;
    }
}

$customer1 = new Customer('John',33, 500);

echo $customer1->getBalance();
global $wpdb;
$wpdb->query("ALTER TABLE wp_atom_comments MODIFY parent_comment_id varchar(25) DEFAULT NULL");
php artisan make:migration create_users_table --create=users

php artisan make:migration add_votes_to_users_table --table=users
// Örnek Query
<?php
	$custom_args = array(
		'post_type' => 'oneri-fikir',
		'posts_per_page' => 1230,
		'meta_key' => 'wpcf-begeni-sayisi',
		'orderby' => 'meta_value_num',
		'order' => 'DESC',
		'oneri-donem' => '2021-1-donem',
	);
	$custom_query = new WP_Query( $custom_args );
	if ( $custom_query->have_posts() ) :
		while ( $custom_query->have_posts() ) : $custom_query->the_post(); 
		$postid = get_the_id();
		$fotopath = site_url() . '/wp-content/uploads/profil';
		$author_name = get_the_author_meta('display_name', $author_id);
		$author_foto = $fotopath.'/'. get_the_author_meta('user_login', $author_id).'.jpg';
?>
		<div></div>
<?php 
		endwhile;
		wp_reset_postdata();
	else:
?>
		<div>Data yok</div>
<?php
	endif;
?>
// Show Total Savings on Cart and Checkout Page
//============================
function wc_discount_total() {
   global $woocommerce;
    $discount_total = 0;
      
    foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values) {
          
    $_product = $values['data'];
  
        if ( $_product->is_on_sale() ) {
        $regular_price = $_product->get_regular_price();
        $sale_price = $_product->get_sale_price();
        $discount = ($regular_price - $sale_price) * $values['quantity'];
        $discount_total += $discount;
        }
    }        
    if ( $discount_total > 0 ) {
    echo '<tr class="cart-discount">
    <th>'. __( 'Your Savings', 'woocommerce' ) .'</th>
    <td data-title=" '. __( 'You Saved', 'woocommerce' ) .' ">'
    . wc_price( $discount_total + $woocommerce->cart->discount_cart ) .'</td>
    </tr>';
    }
}
add_action( 'woocommerce_cart_totals_after_order_total', 'wc_discount_total', 99);
add_action( 'woocommerce_review_order_after_order_total', 'wc_discount_total', 99);
$query = DB::table('node');

if ($published == true)
    $query->where('published', '=', 1);

if (isset($year))
    $query->where('year', '>', $year);

$result = $query->get();
$insert_data = collect();

foreach ($json['value'] as $value) {
    $posting_date = Carbon::parse($value['Posting_Date']);

    $posting_date = $posting_date->format('Y-m-d');

    $insert_data->push([
        'item_no'                   => $value['Item_No'],
        'entry_no'                  => $value['Entry_No'], 
        'document_no'               => $value['Document_No'],
        'posting_date'              => $posting_date,
        ....
    ]);
}

foreach ($insert_data->chunk(500) as $chunk)
{
   \DB::table('items_details')->insert($chunk->toArray());
}
add_filter( 'woocommerce_ajax_variation_threshold', 'ww_ajax_variation_threshold', 10, 2 );

function ww_ajax_variation_threshold( $default, $product ) {
	return 150; //Permite el manejo de 150 variaciones
}
// Adds image to WooCommerce order emails
function w3p_add_image_to_wc_emails( $args ) {
    $args['show_image'] = true;
    $args['image_size'] = array( 100, 50 );
    return $args;
}
add_filter( 'woocommerce_email_order_items_args', 'w3p_add_image_to_wc_emails' );
// convention is to make table name singular and in alphabetical order
php artisan make:migration create_post_tag_table

// create_post_tag_table.php
// if 1 post has 5 tags, then 5 records will exist with same post_id and different tag_ids
public function up()
{
  Schema::create('post_tag', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->integer('post_id');
    $table->integer('tag_id');
    $table->timestamps();
  });
}

// Post.php
// define relationship in Post model
public function tags()
{
  return $this->belongsToMany(Tag::class);
}
// prevents hackers from getting your username by using ?author=1 at the end of your domain url 
// ==============================================================================
add_action('template_redirect', computec_template_redirect);
function computec_template_redirect() {
    if (is_author()) {
        wp_redirect( home_url() ); exit;
    }
}
// Connect to admin error massage
//============================
function no_wordpress_errors(){
  return 'הנתונים שהקלדת שגויים, אנא נסו שנית';
}
add_filter( 'login_errors', 'no_wordpress_errors' );
// remove wp version number from scripts and styles
// ==========================================
function remove_css_js_version( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'remove_css_js_version', 9999 );
add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );


// remove wp version number from head and rss
function artisansweb_remove_version() {
    return '';
}
add_filter('the_generator', 'artisansweb_remove_version');
// Post Views in Wordpress Dashboard
//===============================

// Add this to Quary in elementor: order_by_posts_views
function getPostViews($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "0 View";
    }
    return $count.' צפיות';
}
function setPostViews($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_post_meta($postID, $count_key, $count);
    }
}
// Add ID's to posts & pages overviews
//===============================
add_filter('manage_posts_columns', 'posts_columns_id', 5);
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2);
add_filter('manage_pages_columns', 'posts_columns_id', 5);
add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2);
 
function posts_columns_id($defaults){
    $defaults['wps_post_id'] = __('ID');
    return $defaults;
}
function posts_custom_id_columns($column_name, $id){
        if($column_name === 'wps_post_id'){
                echo $id;
    }
}
// Fix Qout in WP + Elementor - Disable wptexturize 
//============================================
add_filter( 'run_wptexturize', '__return_false' );
// Shortcode for Site URL - Use [site_url] for Shortcode 
//=================================================
add_action( 'init', function() { 	
	add_shortcode( 'site_url', function( $atts = null, $content = null ) {
 	return site_url(); 	
} ); } );
// Shortcode for Current Page URL - Use [geturl] for Shortcode 
//=================================================
add_shortcode ('geturl', 'get_current_page_url');
function get_current_page_url() {
	$pageURL = 'https://';
	$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	return $pageURL;
}
// Same as above, but for multiple pages (from wpsnipp.com)
// Load CF7 scripts & CSS only on page id's mentioned in array
add_action( 'wp_print_scripts', 'deregister_cf7_javascript', 100 );
function deregister_cf7_javascript() {
    if ( !is_page(array(8,10)) ) {
        wp_deregister_script( 'contact-form-7' );
    }
}
add_action( 'wp_print_styles', 'deregister_cf7_styles', 100 );
function deregister_cf7_styles() {
    if ( !is_page(array(8,10)) ) {
        wp_deregister_style( 'contact-form-7' );
    }
}
// Load ContactForm7 scripts & CSS only on page called "Contact"
add_action( 'wp_print_scripts', 'my_deregister_CF7_javascript', 100 );
function my_deregister_CF7_javascript() {
  if ( !is_page('CONTACT') ) {
    wp_deregister_script( 'contact-form-7' );
  }
}

add_action( 'wp_print_styles', 'my_deregister_CF7_styles', 100 );
function my_deregister_CF7_styles() {
  if ( !is_page('CONTACT') ) {
    wp_deregister_style( 'contact-form-7' );
  }
}
/**
 * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
 */
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
 
function child_manage_woocommerce_styles() {
  //remove generator meta tag
  remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
 
  //first check that woo exists to prevent fatal errors
  if ( function_exists( 'is_woocommerce' ) ) {
    //dequeue scripts and styles
    if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
      wp_dequeue_style( 'woocommerce_frontend_styles' );
      wp_dequeue_style( 'woocommerce_fancybox_styles' );
      wp_dequeue_style( 'woocommerce_chosen_styles' );
      wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
      wp_dequeue_script( 'wc_price_slider' );
      wp_dequeue_script( 'wc-single-product' );
      wp_dequeue_script( 'wc-add-to-cart' );
      wp_dequeue_script( 'wc-cart-fragments' );
      wp_dequeue_script( 'wc-checkout' );
      wp_dequeue_script( 'wc-add-to-cart-variation' );
      wp_dequeue_script( 'wc-single-product' );
      wp_dequeue_script( 'wc-cart' );
      wp_dequeue_script( 'wc-chosen' );
      wp_dequeue_script( 'woocommerce' );
      wp_dequeue_script( 'prettyPhoto' );
      wp_dequeue_script( 'prettyPhoto-init' );
      wp_dequeue_script( 'jquery-blockui' );
      wp_dequeue_script( 'jquery-placeholder' );
      wp_dequeue_script( 'fancybox' );
      wp_dequeue_script( 'jqueryui' );
    }
  }
}
// Social media sharing buttons
function crunchify_social_sharing_buttons($content) {
    global $post;
    if(is_singular() || is_home()){
    
        // Get current page URL 
        $crunchifyURL = urlencode(get_permalink());
 
        // Get current page title
        $crunchifyTitle = str_replace( ' ', '%20', get_the_title());
        
        // Get Post Thumbnail for pinterest
        $crunchifyThumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
 
        // Construct sharing URL without using any script
        $twitterURL = 'https://twitter.com/intent/tweet?text='.$crunchifyTitle.'&amp;url='.$crunchifyURL.'&amp;via=Crunchify';
        $facebookURL = 'https://www.facebook.com/sharer/sharer.php?u='.$crunchifyURL;
        $googleURL = 'https://plus.google.com/share?url='.$crunchifyURL;
        $whatsappURL = 'whatsapp://send?text='.$crunchifyTitle . ' ' . $crunchifyURL;
        $linkedInURL = 'https://www.linkedin.com/shareArticle?mini=true&url='.$crunchifyURL.'&amp;title='.$crunchifyTitle;
 
        // Based on popular demand added Pinterest too
        $pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$crunchifyURL.'&amp;media='.$crunchifyThumbnail[0].'&amp;description='.$crunchifyTitle;
 
        // Add sharing button at the end of page/page content
        $content .= '<!-- Crunchify.com social sharing. Get your copy here: http://crunchify.me/1VIxAsz -->';
        $content .= '<div class="crunchify-social">';
        $content .= '<a class="crunchify-link crunchify-facebook icon-Facebook-2" href="'.$facebookURL.'" target="_blank" title="Share on Facebook"></a>';
        $content .= '<a class="crunchify-link crunchify-linkedin icon-Linkedin" href="'.$linkedInURL.'" target="_blank" title="Share on LinkedIn"></a>';        
        $content .= '<a class="crunchify-link crunchify-twitter icon-Twitter" href="'. $twitterURL .'" target="_blank" title="Share on Twitter"></a>';
        $content .= '<a class="crunchify-link crunchify-googleplus icon-Google-Plus" href="'.$googleURL.'" target="_blank" title="Share on Google+"></a>';
        $content .= '<a class="crunchify-link crunchify-whatsapp icon-whatsapp" href="'.$whatsappURL.'" target="_blank" title="Share with Whatsapp"></a>';
        $content .= '<a class="crunchify-link crunchify-pinterest icon-Pinterest" href="'.$pinterestURL.'" data-pin-custom="true" target="_blank" title="Pin it!"></a>';
        $content .= '</div>';
        
        return $content;
    }else{
        // if not a post/page then don't include sharing button
        return $content;
    }
};
add_filter( 'the_content', 'crunchify_social_sharing_buttons');
// Add Google webfonts
function load_fonts() {
        wp_register_style('googleFonts', 'https://fonts.googleapis.com/css?family=Comfortaa:400|Fredericka+the+Great|Work+Sans:400,700');
        wp_enqueue_style( 'googleFonts');
    }

add_action('wp_print_styles', 'load_fonts');
// redirect to homepage after logout
add_action('wp_logout',create_function('','wp_redirect(home_url());exit();'));
// Redirect users to previous page upon login
if ( (isset($_GET['action']) && $_GET['action'] != 'logout') || (isset($_POST['login_location']) && !empty($_POST['login_location'])) ) {
        add_filter('login_redirect', 'my_login_redirect', 10, 3);
        function my_login_redirect() {
                $location = $_SERVER['HTTP_REFERER'];
                wp_safe_redirect($location);
                exit();
        }
}
// Hide email address from the markup on your site.
// use by putting each email address in shortcode: [email]dude@example.com[/email]
function encode_email_shortcode($atts, $content = null) {
    for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';';
    return '<a class="encoded-email" href="mailto:' . $encodedmail . '">' . $encodedmail . '</a>';
}
add_shortcode('email', 'encode_email_shortcode');
// Show full URL in media library overview
function muc_column( $cols ) {
        $cols["media_url"] = "URL";
        return $cols;
}
function muc_value( $column_name, $id ) {
        if ( $column_name == "media_url" ) echo '<input type="text" width="100%" onclick="jQuery(this).select();" value="'. wp_get_attachment_url( $id ). '" />';
}
add_filter( 'manage_media_columns', 'muc_column' );
add_action( 'manage_media_custom_column', 'muc_value', 10, 2 );
// Show image dimensions in media library overview
function wh_column( $cols ) {
        $cols["dimensions"] = "Dimensions (w, h)";
        return $cols;
}
add_filter( 'manage_media_columns', 'wh_column' );
function wh_value( $column_name, $id ) {
    if ( $column_name == "dimensions" ):
    $meta = wp_get_attachment_metadata($id);
           if(isset($meta['width']))
           echo $meta['width'].' x '.$meta['height'];
    endif;
}
add_action( 'manage_media_custom_column', 'wh_value', 11, 3 );
// Show media ID in media library overview
function column_id($columns) {
    $columns['colID'] = __('ID');
    return $columns;
}
add_filter( 'manage_media_columns', 'column_id' );
function column_id_row($columnName, $columnID){
    if($columnName == 'colID'){
       echo $columnID;
    }
}
add_filter( 'manage_media_custom_column', 'column_id_row', 10, 2 );
// Determine ID column width
add_action('admin_head', 'custom_admin_styling');
function custom_admin_styling() {
echo '<style type="text/css">';
echo 'th#wps_post_id{width:50px;}';
echo '</style>';
}
// Add ID to categories overview
function categoriesColumnsHeader($columns) {
        $columns['catID'] = __('ID');
        return $columns;
}

add_filter( 'manage_categories_columns', 'categoriesColumnsHeader' );

function categoriesColumnsRow($argument, $columnName, $categoryID){
        if($columnName == 'catID'){
                return $categoryID;
        }
}

add_filter( 'manage_categories_custom_column', 'categoriesColumnsRow', 10, 3);
// set different colors for pages/posts in different statuses
add_action('admin_footer','posts_status_color');
function posts_status_color(){
	?>
	<style>
	    .status-draft{background: #FCE3F2 !important;}
	    .status-pending{background: #87C5D6 !important;}
	    .status-publish{/* no background keep wp alternating colors */}
	    .status-future{background: #C6EBF5 !important;}
	    .status-private{background:#F2D46F;}
	</style>
	<?php
}
// Add custom dashboard logo
add_action('admin_head', 'my_custom_logo');
  
function my_custom_logo() {
echo '
<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/img/logo.jpg) !important; }
</style>
';
}
/*
 * Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
 */
function rd_duplicate_post_as_draft(){
  global $wpdb;
  if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
    wp_die('No post to duplicate has been supplied!');
  }
 
  /*
   * Nonce verification
   */
  if ( !isset( $GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE_ ) ) )
    return;
 
  /*
   * get the original post id
   */
  $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
  /*
   * and all the original post data then
   */
  $post = get_post( $post_id );
 
  /*
   * if you don't want current user to be the new post author,
   * then change next couple of lines to this: $new_post_author = $post->post_author;
   */
  $current_user = wp_get_current_user();
  $new_post_author = $current_user->ID;
 
  /*
   * if post data exists, create the post duplicate
   */
  if (isset( $post ) && $post != null) {
 
    /*
     * new post data array
     */
    $args = array(
      'comment_status' => $post->comment_status,
      'ping_status'    => $post->ping_status,
      'post_author'    => $new_post_author,
      'post_content'   => $post->post_content,
      'post_excerpt'   => $post->post_excerpt,
      'post_name'      => $post->post_name,
      'post_parent'    => $post->post_parent,
      'post_password'  => $post->post_password,
      'post_status'    => 'draft',
      'post_title'     => $post->post_title,
      'post_type'      => $post->post_type,
      'to_ping'        => $post->to_ping,
      'menu_order'     => $post->menu_order
    );
 
    /*
     * insert the post by wp_insert_post() function
     */
    $new_post_id = wp_insert_post( $args );
 
    /*
     * get all current post terms ad set them to the new post draft
     */
    $taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
    foreach ($taxonomies as $taxonomy) {
      $post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
      wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
    }
 
    /*
     * duplicate all post meta just in two SQL queries
     */
    $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
    if (count($post_meta_infos)!=0) {
      $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
      foreach ($post_meta_infos as $meta_info) {
        $meta_key = $meta_info->meta_key;
        if( $meta_key == '_wp_old_slug' ) continue;
        $meta_value = addslashes($meta_info->meta_value);
        $sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
      }
      $sql_query.= implode(" UNION ALL ", $sql_query_sel);
      $wpdb->query($sql_query);
    }
 
 
    /*
     * finally, redirect to the edit post screen for the new draft
     */
    wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
    exit;
  } else {
    wp_die('Post creation failed, could not find original post: ' . $post_id);
  }
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
 
/*
 * Add the duplicate link to action list for post_row_actions
 */
function rd_duplicate_post_link( $actions, $post ) {
  if (current_user_can('edit_posts')) {
    $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID, basename(_FILE_), 'duplicate_nonce' ) . '" title="שכפל דף/פוסט זה" rel="permalink">שכפל דף/פוסט</a>';
  }
  return $actions;
}
 
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );

add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);
/*** Adds SKUs and product images to WooCommerce order emails */ 
function sww_add_sku_to_wc_emails( $args ) { $args['show_sku'] = true; return $args; } add_filter( 'woocommerce_email_order_items_args', 'sww_add_sku_to_wc_emails' );
/*** Adds product images to WooCommerce order emails */
function sww_add_photos_to_wc_emails( $args ) { $args['show_image'] = true; return $args; } add_filter( 'woocommerce_email_order_items_args', 'sww_add_photos_to_wc_emails' );
/*
* Creating a function to create our CPT
*/


function custom_post_type() {

	// Set UI labels for Custom Post Type
	$labels = array(
		'name'                => _x( 'Recipes', 'Post Type General Name', 'twentythirteen' ),
		'singular_name'       => _x( 'Recipe', 'Post Type Singular Name', 'twentythirteen' ),
		'menu_name'           => __( 'Recipes', 'twentythirteen' ),
		'parent_item_colon'   => __( 'Parent Recipe', 'twentythirteen' ),
		'all_items'           => __( 'All Recipes', 'twentythirteen' ),
		'view_item'           => __( 'View Recipe', 'twentythirteen' ),
		'add_new_item'        => __( 'Add New Recipe', 'twentythirteen' ),
		'add_new'             => __( 'Add New', 'twentythirteen' ),
		'edit_item'           => __( 'Edit Recipe', 'twentythirteen' ),
		'update_item'         => __( 'Update Recipe', 'twentythirteen' ),
		'search_items'        => __( 'Search Recipe', 'twentythirteen' ),
		'not_found'           => __( 'Not Found', 'twentythirteen' ),
		'not_found_in_trash'  => __( 'Not found in Trash', 'twentythirteen' ),
	);

	// Set other options for Custom Post Type

	$args = array(
		'label'               => __( 'Recipes', 'twentythirteen' ),
		'description'         => __( 'Recipe news and reviews', 'twentythirteen' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
		'hierarchical'        => false,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'show_in_nav_menus'   => true,
		'show_in_admin_bar'   => true,
		'menu_position'       => 5,
		'can_export'          => true,
		'has_archive'         => true,
		'exclude_from_search' => false,
		'publicly_queryable'  => true,
		'capability_type'     => 'page',
		'show_in_rest'        => true,
		'yarpp_support' 	  => true,

		// // This is where we add taxonomies to our CPT
		// 'taxonomies'          => array( 'category' ),
	);

	// Registering your Custom Post Type
	register_post_type( 'Recipes', $args );
}

/* Hook into the 'init' action so that the function
* Containing our post type registration is not 
* unnecessarily executed. 
*/

add_action( 'init', 'custom_post_type', 0 );






/**
 * Create a taxonomy
 *
 * @uses  Inserts new taxonomy object into the list
 * @uses  Adds query vars
 *
 * @param string  Name of taxonomy object
 * @param array|string  Name of the object type for the taxonomy object.
 * @param array|string  Taxonomy arguments
 * @return null|WP_Error WP_Error if errors, otherwise null.
 */
function cs_recipe_taxonomy() {

	$labels = array(
		'name'					=> _x( 'Categories', 'Taxonomy Categories', 'text-domain' ),
		'singular_name'			=> _x( 'Category', 'Taxonomy Category', 'text-domain' ),
		'search_items'			=> __( 'Search Categories', 'text-domain' ),
		'popular_items'			=> __( 'Popular Categories', 'text-domain' ),
		'all_items'				=> __( 'All Categories', 'text-domain' ),
		'parent_item'			=> __( 'Parent Category', 'text-domain' ),
		'parent_item_colon'		=> __( 'Parent Category', 'text-domain' ),
		'edit_item'				=> __( 'Edit Category', 'text-domain' ),
		'update_item'			=> __( 'Update Category', 'text-domain' ),
		'add_new_item'			=> __( 'Add New Category', 'text-domain' ),
		'new_item_name'			=> __( 'New Category Name', 'text-domain' ),
		'add_or_remove_items'	=> __( 'Add or remove Categories', 'text-domain' ),
		'choose_from_most_used'	=> __( 'Choose from most used text-domain', 'text-domain' ),
		'menu_name'				=> __( 'Category', 'text-domain' ),
	);

	$args = array(
		'labels'            => $labels,
		'public'            => true,
		'show_in_nav_menus' => true,
		'show_admin_column' => false,
		'hierarchical'      => true,
		'show_tagcloud'     => true,
		'show_ui'           => true,
		'query_var'         => true,
		'rewrite'           => true,
		'query_var'         => true,
		'capabilities'      => array(),
		'yarpp_support' 	=> true,
	);

	register_taxonomy( 'recipes-category', array( 'recipes' ), $args );
}

add_action( 'init', 'cs_recipe_taxonomy' );



add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
	if( is_category() ) {
		$post_type = get_query_var('post_type');
		if($post_type)
			$post_type = $post_type;
		else
			$post_type = array('nav_menu_item', 'post', 'recipes'); // don't forget nav_menu_item to allow menus to work!
		$query->set('post_type',$post_type);
		return $query;
	}
}
public function readAction($request, $response, $userId, GetTicketsService $getTicketsService)
    {
        try {
            $role = $this->container->has('jwt') ?  $this->container->get('jwt')->role : 'admin';
            $status = $request->getParam('status') ? $request->getParam('status') : null;
            $serviceRequest = new GetTicketsRequest([
                'userId' => $userId,
                'role' => $role,
                'status' => $status,
            ]);
            /*
             * Tickets are already an array
             */
            $tickets = $getTicketsService->execute($serviceRequest);
            return $response->withJson($tickets);
        } catch (\Exception $e) {
            $code = (int) $e->getCode() > 200 && (int) $e->getCode() <= 500 ? (int) $e->getCode() : 500;
            return $response->withStatus($code)->withJson(ErrorResponse::createFromException($e));
        }
    }
<?php

namespace App\Console\Commands;

use App\Models\User;
use App\Support\DripEmailer;
use Illuminate\Console\Command;

class SendEmails extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'mail:send {user}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send a marketing email to a user';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @param  \App\Support\DripEmailer  $drip
     * @return mixed
     */
    public function handle(DripEmailer $drip)
    {
        $drip->send(User::find($this->argument('user')));
    }
}
/**
 * Disable out of stock variations
 *
 * @param bool $active
 * @param WC_Product_Variation $variation
 *
 * @return Boolean
 */
function iconic_variation_is_active( $active, $variation ) {
	if( ! $variation->is_in_stock() ) {
		return false;
	}

	return $active;
}

add_filter( 'woocommerce_variation_is_active', 'iconic_variation_is_active', 10, 2 );
//Multiple relationships:
$books = Book::with('author', 'publisher')->get();

//Nested relationships:
$books = Book::with('author.contacts')->get();
<!-- use enctype -->
<form  action="/route" method="POST" enctype="multipart/form-data">
class="{{ Request::is('products.index') ? 'active' : '' }}"
// url : https://www.example.com/param1/param2/param3
$request()->segment(3); // param3
// config/app.php
'locale' => 'fr',
'fallback_locale' => 'fr',
// replace get()
$products = Product::where('active', 1)->get();

// by paginate()
$products = Product::where('active', 1)->paginate(10);
// config\database.php
'connections' => [
    'mysql' => [
      (...)
      'strict' => true,
    ],
],
number_format((float)$number, 2, '.', '')
$this->validate($request, [
	"field_nullable" => "nullable"
]
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
use App\Http\Controllers\OtherController;

class TestController extends Controller
{
    public function index()
    {
        //Calling a method that is from the OtherController
        $result = (new OtherController)->method();
    }
}

2) Second way

app('App\Http\Controllers\OtherController')->method();

Both way you can get another controller function.
app('App\Http\Controllers\PrintReportController')->getPrintReport();
// Exclude certain pages from WordPress search results
//======================================
function jp_search_filter( $query ) {
  if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
    $query->set( 'post__not_in', array( 827,851 ) );
  }
}
add_action( 'pre_get_posts', 'jp_search_filter' );
{}({}({}()) {}()) - [a] r1, 1.1{} 1.2{} | r2, 2.1 2.2 [1.1] r1.1.1, 1.1.1.1{} 1.1.1.2{} [2.1] r2.2.1, 2.1.1.1{} 2.1.1.2{} cate-trans |/
$date = Carbon::parse('2016-09-17 11:00:00');
$now = Carbon::now();

$diff = $date->diffInDays($now);
public class Main {
  int x = 5;

  public static void main(String[] args) {
    Main myObj = new Main();
    System.out.println(myObj.x);
  }
}
class Person:
  def __init__(self, name, age):
    self.name = name
    self.age = age

p1 = Person("John", 36)

print(p1.name)
print(p1.age)
//add allowable file types to wordpress media uploader
function custom_mime_types( $mimes ){
	$mimes['vcf'] = 'text/vcard'; //allowing .cvf filetypes
//additional filetypes can go here
	return $mimes;
}
add_filter( 'upload_mimes', 'custom_mime_types' );
add_action( 'woocommerce_after_add_to_cart_quantity', 'ts_quantity_plus_sign' );

function ts_quantity_plus_sign() {
echo '<button type="button" class="plus" >+</button>';
}

add_action( 'woocommerce_before_add_to_cart_quantity', 'ts_quantity_minus_sign' );

function ts_quantity_minus_sign() {
echo '<button type="button" class="minus" >-</button>';
}

add_action( 'wp_footer', 'ts_quantity_plus_minus' );

function ts_quantity_plus_minus() {
// To run this on the single product page
if ( ! is_product() ) return;
?>
<script type="text/javascript">

jQuery(document).ready(function($){

$('form.cart').on( 'click', 'button.plus, button.minus', function() {

// Get current quantity values
var qty = $( this ).closest( 'form.cart' ).find( '.qty' );
var val = parseFloat(qty.val());
var max = parseFloat(qty.attr( 'max' ));
var min = parseFloat(qty.attr( 'min' ));
var step = parseFloat(qty.attr( 'step' ));

// Change the value if plus or minus
if ( $( this ).is( '.plus' ) ) {
if ( max && ( max <= val ) ) {
qty.val( max );
}
else {
qty.val( val + step );
}
}
else {
if ( min && ( min >= val ) ) {
qty.val( min );
}
else if ( val > 1 ) {
qty.val( val - step );
}
}

});

});

</script>
<?php
}
if (str_contains(url()->current(), '/api')) {

            $finalProperty = [];
            $properties = PropertyListing::orderBy('id', 'DESC')->get(["id","user_id","listing_for","images","address","price","property_type","furnishing_status","facilities"]);
            foreach ($properties as $key => $property){
                // $finalImage['id'] = $property->id;
                // $finalImage['user_id'] = $property->user_id;
                // $finalImage['listing_for'] = $property->listing_for;
                $img_array = explode(',',$property->images);

                $properties[$key]->images = $img_array;

            }
         
            return response()->json(['properties' => $properties, 'success' => 200]);
            
        } else {
            $sliderImages = PropertyListing::all();
            return view('admin.imageslider.index', compact('sliderImages'));
        }
// remove wp version number from head and rss
function artisansweb_remove_version() {
    return '';
}
add_filter('the_generator', 'artisansweb_remove_version');
// remove wp version number from scripts and styles
function remove_css_js_version( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'remove_css_js_version', 9999 );
add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );
//*****---   Remove Gutenberg Block Library CSS from loading on the frontend  ---*****
//===================================================================
function smartwp_remove_wp_block_library_css(){
 wp_dequeue_style( 'wp-block-library' );
 wp_dequeue_style( 'wp-block-library-theme' );
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
//*****---  Remove Eicons:  ---*****
//==========================
add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 ); 
function remove_default_stylesheet() { 
	wp_deregister_style( 'elementor-icons' ); 
}
//******--- Remove Font Awesome ---*****
//===============================
add_action( 'elementor/frontend/after_register_styles',function() {
	foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
		wp_deregister_style( 'elementor-icons-fa-' . $style );
	}
}, 20 );
******--- Remove Google Fonts ---******
//===============================
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
<?php
$the_query = new WP_Query(
	array(
		'post_type' => 'post',
		'posts_per_page' => -1,
		'post_status' => array( 'publish' ),
	)
);
if ( $the_query->have_posts() ) {
    while ( $the_query->have_posts() ) {
        $the_query->the_post();
?>

<div class="container">
	<article id="post-<?php the_ID(); ?>" <?php post_class('blog-item'); ?>>
		<div class="blog-item__info">
			<div class="blog-item__author">
				<?php if (get_field('single_author')) { ?>
					<?php echo get_field('single_author'); ?>
				<?php } else { ?>
					<?php the_author(); ?>
				<?php } ?>
			</div>
			<div class="blog-item__date">
				<?php the_date('F j, Y'); ?>
			</div>
		</div>
		<div class="blog-item__category">
			<?php
			$categories = get_the_category();
			if ( ! empty( $categories ) ) {
				foreach( $categories as $category ) {
			?>
				<a href="<?php echo esc_url( get_category_link( $category->term_id ) )?>">
					<?php echo esc_html( $category->name );?>
				</a>
			<?php
				}
			}
			?>
		</div>
		<h2 class="blog-item__title">
			<a href="<?php the_permalink(); ?>" class="link link--underline-left link link--underline-left--invert">
				<?php the_title(); ?>
			</a>
		</h2>
		<div class="blog-item__thumb">
			<a href="<?php the_permalink(); ?>">
				<?php if (has_post_thumbnail() ): ?>
					<?php the_post_thumbnail(); ?>
				<?php endif; ?>
			</a>
		</div>
		<?php if (has_excerpt()) { ?>
			<div class="blog-item__excerpt">
				<?php the_excerpt(); ?>
			</div>
		<?php } ?>
		<div class="blog-item__more">
			<div class="btn-round-invert">
				<a href="<?php the_permalink(); ?>">
					<?php _e('Read more', 'theme'); ?>
				</a>
			</div>
		</div>
	</article>
</div>

<?php
}
} else {
    // no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
?>
$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2)  ? "2" : "other");
echo $bar;
/***** Allow SVG *****/
//===================
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {

  global $wp_version;
  if ( $wp_version !== '4.7.1' ) {
     return $data;
  }

  $filetype = wp_check_filetype( $filename, $mimes );

  return [
      'ext'             => $filetype['ext'],
      'type'            => $filetype['type'],
      'proper_filename' => $data['proper_filename']
  ];

}, 10, 4 );

function cc_mime_types( $mimes ){
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );

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' );
/***** Shorten Post/Page link  *****/
//============================
add_filter( 'get_shortlink', function ( $shortlink ) {
    return $shortlink;
});
// disable gutenberg  for posts
//========================
add_filter('use_block_editor_for_post', '__return_false', 10);

// disable gutenberg  for post types
//===========================
add_filter('use_block_editor_for_post_type', '__return_false', 10);
// Set WooCommerce Virtual Order Status to Complete After Payment
add_filter( 'woocommerce_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 );
function virtual_order_payment_complete_order_status( $order_status, $order_id ) {
  $order = new WC_Order( $order_id );
  if ( 'processing' == $order_status &&
       ( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) {
    $virtual_order = null;
    if ( count( $order->get_items() ) > 0 ) {
      foreach( $order->get_items() as $item ) {
        if ( 'line_item' == $item['type'] ) {
          $_product = $order->get_product_from_item( $item );
          if ( ! $_product->is_virtual() ) {
            // once we've found one non-virtual product we know we're done, break out of the loop
            $virtual_order = false;
            break;
          } else {
            $virtual_order = true;
          }
        }
      }
    }
    // virtual order, mark as completed
    if ( $virtual_order ) {
      return 'completed';
    }
  }
  // non-virtual order, return original status
  return $order_status;
}
add_filter( 'woocommerce_default_address_fields' , 'custom_override_postcode_validation' );
 
function custom_override_postcode_validation( $address_fields ) {
  $address_fields['postcode']['required'] = false;
  return $address_fields;
}
function search_by_sku( $search, &$query_vars ) {
    global $wpdb;
    if(isset($query_vars->query['s']) && !empty($query_vars->query['s'])){
        $args = array(
            'posts_per_page'  => -1,
            'post_type'       => 'product',
            'meta_query' => array(
                array(
                    'key' => '_sku',
                    'value' => $query_vars->query['s'],
                    'compare' => 'LIKE'
                )
            )
        );
        $posts = get_posts($args);
        if(empty($posts)) return $search;
        $get_post_ids = array();
        foreach($posts as $post){
            $get_post_ids[] = $post->ID;
        }
        if(sizeof( $get_post_ids ) > 0 ) {
                $search = str_replace( 'AND (((', "AND ((({$wpdb->posts}.ID IN (" . implode( ',', $get_post_ids ) . ")) OR (", $search);
        }
    }
    return $search;
    
}
    add_filter( 'posts_search', 'search_by_sku', 999, 2 );
add_filter( 'woocommerce_default_address_fields' , 'QuadLayers_optional_postcode_checkout' );
function QuadLayers_optional_postcode_checkout( $p_fields ) {
$p_fields['postcode']['required'] = false;
return $p_fields;
}
// Disable support for comments and trackbacks in post types
function sv_disable_comments_post_types_support() {
	$post_types = get_post_types();
	foreach ($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');
		}
	}
}
add_action('admin_init', 'sv_disable_comments_post_types_support');



// Close comments on the front-end
function sv_disable_comments_status() {
	return false;
}
add_filter('comments_open', 'sv_disable_comments_status', 20, 2);
add_filter('pings_open', 'sv_disable_comments_status', 20, 2);



// Hide existing comments
function sv_disable_comments_hide_existing_comments($comments) {
	$comments = array();
	return $comments;
}
add_filter('comments_array', 'sv_disable_comments_hide_existing_comments', 10, 2);



// Remove comments page in menu
function sv_disable_comments_admin_menu() {
	remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'sv_disable_comments_admin_menu');



// Redirect any user trying to access comments page
function sv_disable_comments_admin_menu_redirect() {
	global $pagenow;
	if ($pagenow === 'edit-comments.php') {
		wp_redirect(admin_url()); exit;
	}
}
add_action('admin_init', 'sv_disable_comments_admin_menu_redirect');



// Remove comments metabox from dashboard
function sv_disable_comments_dashboard() {
	remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}
add_action('admin_init', 'sv_disable_comments_dashboard');



// Remove comments links from admin bar
function sv_disable_comments_admin_bar() {
	if (is_admin_bar_showing()) {
		remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
	}
}
add_action('init', 'sv_disable_comments_admin_bar');
// Automatically set the image Title, Alt-Text, Caption & Description upon upload
add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' );
function my_set_image_meta_upon_image_upload( $post_ID ) {
 
    // Check if uploaded file is an image, else do nothing
 
    if ( wp_attachment_is_image( $post_ID ) ) {
 
        $my_image_title = get_post( $post_ID )->post_title;
 
        // Sanitize the title:  remove hyphens, underscores & extra spaces:
        $my_image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ',  $my_image_title );
 
        // Sanitize the title:  capitalize first letter of every word (other letters lower case):
        $my_image_title = ucwords( strtolower( $my_image_title ) );
 
        // Create an array with the image meta (Title, Caption, Description) to be updated
        // Note:  comment out the Excerpt/Caption or Content/Description lines if not needed
        $my_image_meta = array(
            'ID'        => $post_ID,            // Specify the image (ID) to be updated
            'post_title'    => $my_image_title,     // Set image Title to sanitized title
            'post_excerpt'  => $my_image_title,     // Set image Caption (Excerpt) to sanitized title
            'post_content'  => $my_image_title,     // Set image Description (Content) to sanitized title
        );
 
        // Set the image Alt-Text
        update_post_meta( $post_ID, '_wp_attachment_image_alt', $my_image_title );
 
        // Set the image meta (e.g. Title, Excerpt, Content)
        wp_update_post( $my_image_meta );
 
    } 
}
//// Validate if Email field is spam
add_action( 'elementor_pro/forms/validation/email', function( $field, $record, $ajax_handler ) {
    // Looking if email found in spam array, you can add to the array
  $spamemails = array("ericjonesonline@outlook.com", "eric@talkwithwebvisitor.com");
    if ( in_array( $field['value'] , $spamemails) ) {
        $ajax_handler->add_error( $field['id'], 'אנחנו לא אוהבים ספאם, נסו מייל אחר' );
    }
}, 10, 3 );
<?php

$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);

echo $comma_separated; // lastname,email,phone

// Empty string when using an empty array:
var_dump(implode('hello', array())); // string(0) ""

?>
$orders = DB::table('orders')
                ->select('department', DB::raw('SUM(price) as total_sales'))
                ->groupBy('department')
                ->havingRaw('SUM(price) > ?', [2500])
                ->get();
( function ($){
    jQuery (window).on ('load', function (){
        /* Global - Auto run animation for elements with data-animationcss - engine.js */
        animationCSS ();
    });

    /* Auto run animation for elements with data-animationcss */
    function animationCSS(){
        if ( !is_touch_device ()) {
            jQuery ('*[data-animationcss]').addClass (" animated ");

            /* ================ ANIMATED CONTENT ================ */
            if (jQuery (".animated")[ 0 ]) {
                jQuery ('.animated').css ('opacity', '0');
            }

            /* use scrollmagic */
            var animator = new ScrollMagic.Controller ();

            jQuery ('*[data-animationcss]').each (function (){
                var animation = jQuery (this).attr ('data-animationcss');

                var scene = new ScrollMagic.Scene ({
                    triggerElement: this,
                    triggerHook: 'onEnter',
                    offset: 50,
                    reverse: false
                }).on ('start', function (element){

                    jQuery (this.triggerElement ()).css ('opacity', 1);
                    jQuery (this.triggerElement ()).addClass (" animated " + animation);

                })
                .addTo (animator);
            });
        }
    }

} ) (jQuery);
{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}
//HTML
// getVimeoId($vleft['video']) = url do filmu vimeo

<div class="bottom__img">
	<iframe src="https://player.vimeo.com/video/<?php echo getVimeoId($vleft['video']); ?>?&autoplay=0&loop=0&muted=1&title=0&byline=0&portrait=0&fun=0&background=1" frameborder="0" allowfullscreen></iframe>
  <button class="play btn btn-transparent btn-rounded-inverse-mini" data-scrollinit="click">
      <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M12 7L3.01142e-07 13.9282L9.06825e-07 0.0717964L12 7Z" fill="#F2FF00"/>
      </svg>
  </button>
  <button class="stop btn btn-transparent btn-rounded-inverse-mini">
      <svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M0.000244141 0.714355H2.28607V13.8572H0.000244141V0.714355Z" fill="#F2FF00"/>
          <path d="M5.71413 0.714111H7.99995V13.8572H5.71413V0.714111Z" fill="#F2FF00"/>
      </svg>
  </button>
</div>


//SCSS
.bottom__img {
	height: 0;
	width: 100%;
	padding-top: 74%;
	position: relative;

	iframe,
	img {
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.play,
	.stop {
		position: absolute;
		right: 26px;
		bottom: calc(17.75% + 26px);

		&:hover {
			svg {
				path {
					fill: #000000;
				}
			}
		}

		&.stop {
			//display: none;
		}

		&.play {
			display: none;

			svg {
				margin-left: 2px;
			}
		}
	}
}

//JS
//need magicscroll

(function ($) {
	jQuery(window).on('load', function () {
		var localization = $('.bottom__img');
		var moduleIframe = $(localization).find('iframe');
		if (moduleIframe.length) {
			var player = new Vimeo.Player($(localization).find('iframe'));
			var playBtn = $(localization).find('.play');
			var stopBtn = $(localization).find('.stop');
			console.log(stopBtn);

			/* controls */
			playBtn.on('click', function (e) {
				e.stopPropagation();
				player.play();
			})
			stopBtn.on('click', function () {
				player.pause();
			})

			player.on('play', function () {
				stopBtn.show();
				playBtn.hide();
			});
			player.on('pause', function () {
				stopBtn.hide();
				playBtn.show();
			});
		}

		var autoPlay = new ScrollMagic.Controller();

		jQuery('.bottom__img *[data-scrollinit]').each(function () {
			var animation = jQuery(this).attr('data-scrollinit');

			var scene = new ScrollMagic.Scene({
				triggerElement: this,
				triggerHook: 'onEnter',
				offset: 100,
				reverse: false
			}).on('start', function (element) {
				player.play();

			})
				.addTo(autoPlay);
		});
	});
})(jQuery);



//if you have 2 videos you can play 2nd after finished first:
//playerLeft.on('ended', function () {
//	playerRight.play();
//});
// ex. zmorph3d - page product i500
function roundrect($im, $x1, $y1, $x2, $y2, $rad, $col) {
    
    imageline($im, ($x1 + $rad), $y1, ($x2 - $rad), $y1, $col);
    imageline($im, ($x1 + $rad), $y2, ($x2 - $rad), $y2, $col);
    imageline($im, $x1, ($y1 + $rad), $x1, ($y2 - $rad), $col);
    imageline($im, $x2, ($y1 + $rad), $x2, ($y2 - $rad), $col);
    imagearc($im, ($x1 + $rad), ($y1 + $rad), (2 * $rad), (2 * $rad), 180, 270, $col);
    imagearc($im, ($x2 - $rad), ($y1 + $rad), (2 * $rad), (2 * $rad), 270, 360, $col);
    imagearc($im, ($x2 - $rad), ($y2 - $rad), (2 * $rad), (2 * $rad), 0, 90, $col);
    imagearc($im, ($x1 + $rad), ($y2 - $rad), (2 * $rad), (2 * $rad), 90, 180, $col);
}


$myImage = imagecreate(200,100);
$myGrey  = imagecolorallocate($myImage,204,204,204);
$myBlack = imagecolorallocate($myImage,0,0,0);
roundrect($myImage, 20, 10, 180, 90, 20, $myBlack);
header("Content-type: image/png");
imagepng($myImage);
imagedestroy($myImage);
#this file outputs a grey version of specified image
#use of this file:
#  in the image tag, <img border=0 src=greyimage.php3?src=imagesrc&col=colno >
# where imagesrc is the source of the original colour version
# where colno is 0 for grey, 1 for red, 2 green, 3 blue

function MakeColoursGrey($im,$col){
 $total=ImageColorsTotal($im);
 for($i=0;$i<$total;$i++){
   $old=ImageColorsForIndex($im,$i);

   #trying to keep proper saturation when converting
   $commongrey=(int)($old['red']+$old['green']+$old['blue'])/3;
   if(!$col){
    ImageColorSet($im,$i,$commongrey,$commongrey,$commongrey);
   }elseif($col==1){
    ImageColorSet($im,$i,$commongrey,0,0);
   }elseif($col==2){
    ImageColorSet($im,$i,0,$commongrey,0);
   }elseif($col==3){
    ImageColorSet($im,$i,0,0,$commongrey);
   }
 }
}

$img=imagecreatefromgif($src);

#change the colours to grey
MakeColoursGrey($img,$col);

#send the http header, this outputs an image of type gif
Header("Content-Type: image/gif");

#send the image
ImageGif($img);
// w szablonie miejsce od którego nawigujemy scrollem
<?php
		if($instance['anchor']['active']){
	?>
		<div id="<?php echo url_slug($instance['anchor']['name']); ?>" class="anchor-local-element position-relative" data-anchor-local="<?php echo $instance['anchor']['name']; ?>"></div>
	<?php
		}
?>
  
  
  //JS
  function localAnchorMenu() {
	// create menu items
	jQuery(jQuery('article .anchor-local-element').get().reverse()).each(function () {
		var anchorName = jQuery(this).data('anchor-local');
		var anchorID = jQuery(this).attr('id');
		console.log(anchorName);
		jQuery(document).find('.anchor-local-menu-items').prepend('<a data-scroll class="anchor-local-menu-item" href="#' + anchorID + '">' + anchorName + '</a>');
		jQuery(document).find('#header').addClass('anchor-local-active');
	});


	// scroll to element
	jQuery(document).find('.anchor-local-menu-item').on('click', '[data-scroll]', scrollToSection);

	function scrollToSection(event) {
		event.preventDefault();
		var $section = $($(this).attr('href'));
		jQuery('html, body').animate({
			scrollTop: $section.offset().top
		}, 500);
	}

}

//Wykrywa miejsce do którego nawigujemy i wpisaną w niego nazwę nazwę, na podstwie tego tworzy menu
$arr = [300, 600, 900, 1200];
$number = 920;
$deltas = array_reduce(
    $arr, 
    function($t, $v) use ($number) { 
        $t[$v] = abs($v - $number); 
        return $t; 
    },
    []
);
asort($deltas);
echo array_keys($deltas)[0];
# Adds instruction text after the post title input
function emersonthis_edit_form_after_title() {
    $tip = '<strong>TIP:</strong> To create a single line break use SHIFT+RETURN. By default, RETURN creates a new paragraph.';
    echo '<p style="margin-bottom:0;">'.$tip.'</p>';
}
add_action(
    'edit_form_after_title',
    'emersonthis_edit_form_after_title'
);
<?php 
    // DP style
    $rules_delete_exception = array();
    $rules_delete_exception[] = 'booker_name {
        required: true
    }';

    $this->formhelper->setupJsFormValidation('confirm_form', '{'.implode(', ', $rules_delete_exception).'}', $messages='{}', $submit_handler='default');
?>

<!-- action button -->
<button type="button" class="btn bg-danger" data-toggle="modal" data-target="#confirm_modal">Confirm</button>

<!-- Modal to confirm action initially hidden -->
<div id="confirm_modal" class="modal fade" tabindex="-1">
    <?php echo form_open('controller/method', array('id' => 'confirm_form')); ?>
        <input type="text" name="booker_name">
            <button type="button" data-dismiss="modal">Close</button>
            <button type="submit">Yes, delete exception</button>
        </div>
    </form>
</div>

<script>
    // Jquery style
    const fv = FormValidation.formValidation(confirm_form, {
        rules: {
            'booker_name', {required: true }
        },

    });
</script>
function LogIt($arr, $text)
{
  $html=$text."\n";
  foreach($arr as $k=>$v)
  {
    if(is_array($v)){ LogIt($v,'Sub array'); }else{ $html.=$k."=>".$v."\n"; }
  }
  $html.=date("d.m.Y H:i:s")."\n##########################################\n\n\n";
  $file=$_SERVER["DOCUMENT_ROOT"]."/custom_logs.txt";
  file_put_contents($file, $html, FILE_APPEND | LOCK_EX);
}
let count = 0;
let counttxt = document.querySelector("#count");

window.addEventListener("DOMContentLoaded", (e) => {
  getView();
});

// handle posting data to db
function getView() {
  $.ajax({
    url: "insert.php",
    method: "POST",
    dataType: "text",
    data: {
      count: count,
    },
    success: (data, status) => {
      console.log(data);
    },
  });
}

setInterval(() => {
  getData();
}, 1000);

// handle getting dada from database

function getData(data) {
  $.ajax({
    url: "fetch.php",
    method: "POST",
    dataType: "text",
    data: {
      fetch: true,
    },
    success: (data, status) => {
      counttxt.textContent = data;
    },
  });
}

async function userLocation() {
    const API_KEY = "7c0a8d3613ed43a7adeb63a2884f59b4";

  let locationcont = document.querySelector(".v-loc");
  let url =
    `https://ipgeolocation.abstractapi.com/v1/?api_key=${API_KEY}`;

  let fetchdata = await fetch(url);
  let data = await fetchdata.json();
  const { city, country, ip_address, latitude, longitude } = data;

  let loader = document.querySelector(".loader-cont");
  if (location.innerHTML = "") {
    loader.style.display = "flex";
    locationcont.innerHTML = "";
  } else {
    setTimeout(() => {
        loader.style.display = "none";
    }, 2000);
    locationcont.innerHTML = `
    <div class="location">
    <div class="box">
        <div class="icon"><ion-icon name="location-outline"></ion-icon></div>
        <b><p>${country}</p></b>
    </div>
    <div class="box">
        <div class="icon"><ion-icon name="locate-outline"></ion-icon></div>
        <b><p>${city}</p></b>
    </div>
  </div>
  <div class="geo">
    <div class="box">
        <div class="box-1">
            <span class="icon"><ion-icon name="compass-outline"></ion-icon></span> <i>lat</i>
            <br>
            <small>${latitude}</small>
        </div>
        <div class="box-1">
            <span class="icon"><ion-icon name="compass-outline"></ion-icon></span> <i>lng</i>
            <br>
            <small>${longitude}</small>
        </div>
    </div>
    <div class="ip">
        <span class="icon"><ion-icon name="navigate-outline"></ion-icon></span>
        <small>IP ADDRESS</small>
        <h3><i>${ip_address}</i></h3>
    </div>
  </div>
    `;
  }
}
userLocation();
<?php 
require("db.php");


if(isset($_POST['fetch'])){
    $sql = mysqli_query($conn, "SELECT * FROM views");
    $data = mysqli_fetch_assoc($sql);
    $count = $data['count'];

    if(mysqli_num_rows($sql) > 0){
        echo $count;
    }else{
        echo "0";
    }
}else{
    return false;
}


?>
<?php 
require("db.php");


$count = 0;
if(isset($_POST['count'])){
        $sql = mysqli_query($conn, "SELECT * FROM views");
        $data = mysqli_fetch_assoc($sql);
    
        $newcount = $data['count'];
    
        if(mysqli_num_rows($sql) > 0){
            $newcount+=1;
            $sql = mysqli_query( $conn, "UPDATE views SET count='$newcount'");
    
            if($sql){
                echo "Success";
            }
        }
    }else{
        echo "Something went wrong";
        die;
    }
    // getCount();
}else{
    return false;
}

?>
<?php 

$conn = mysqli_connect("localhost", "root", null, "views");

echo $conn ? "" : "Error connecting ".mysqli_error($conn);


?>
body{
    width: 100%;
    height: 100vh;
    margin:0px;
    padding:0px;
    overflow-x: hidden;
    background: #0c0c18 !important;
}
*{
    list-style: none;
    box-sizing: border-box;
}

.container{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.container .card{
    width:400px;
    height:350px;
    margin: 50px auto !important;
    background: #131320 !important;
    color:#fff;
    border:none;
    outline:none;
    box-shadow: 0px 0px 4px #000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.container .v-loc{
    width: 500px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: 
    "location"
    "geo"
    ;
}

.container .v-loc .location{
    width:100%;
    display:flex;
    flex-wrap:wrap;
    grid-area: location;
    flex-wrap:wrap;
}
.container .v-loc .icon{
    color:#ffff00;
    font-size:30px;
    padding:5px;
    float:left;
}
.container .v-loc .location .box{
    width:245px;
    padding:15px 45px;
    background: #131320 !important;
    color:#fff;
    border:none;
    outline:none;
    box-shadow: 0px 0px 4px #000;
    margin-right:2px;
    border-radius: 2px;
    display:flex;
    text-align: start;
}
.container .v-loc .location .box h5{
    padding:8px;
    font-size:28px;
}
.container .v-loc .geo{
    margin:10px auto;
    display:flex;
    flex-wrap:wrap;
    grid-area: geo;
    background: #131320 !important;
    color:#fff;
    border:none;
    outline:none;
    box-shadow: 0px 0px 4px #000;
    width:100%;
    padding:12px;
}
.container .v-loc .geo .box{
    display:flex;
    flex-wrap:wrap;
    padding:12px;
}
.container .v-loc .geo .box .box-1{
    width:195px;
    padding:10px 45px;
    margin:5px;
}
.container .v-loc .geo .box .box-1 i{
    padding:12px;
}
.container .v-loc .geo .ip{
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction: column;
    width:100%;
    text-align: center;
}

.loader-cont{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    width:100%;
    height:100vh;
    position:fixed;
    background:#000000e3;
    top:0px;
    left:0px;
    /* display:none; */
}
.loader-cont .icon{
    font-size:55px;
    color:#ffff00;
    animation: spin linear infinite;
}

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

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <title>Views Counts</title>
    <script src="https://unpkg.com/ionicons@5.4.0/dist/ionicons.js"></script>
</head>

<body>
    <br>
    <br>
    <h1 class="display-4 text-center text-white">Site Tracker</h1>
    <div class="container">
        <div class="card">
            <div class="container">
                <div class="card-header">
                    <h3>Visitor Views</h3>
                    <p>Last 30min</p>
                </div>
                <div class="card-body">
                    <h1 id="count">0</h1>
                </div>
            </div>
        </div>
        <div class="v-loc"></div>
    </div>

    <div class="loader-cont">
        <h3 class="text-white">Loading.......</h3>
        <div class="icon">
            <ion-icon name="cog-outline" class="ion"></ion-icon>
        </div>
    </div>

    <script src="view.js"></script>
    <script src="jquery.js"></script>
</body>

</html>
<?php
# BEKZOD NAJMIDDINOV bekturk333@gmail.com 
# custom in_array function in PHP
function c_in_array($n,$arr)
{
    foreach($arr as $item)
    {
        if(is_array($item)) return c_in_array($n,$item);
        
        if($n == $item) return true;
    }
    return false;
}
// merge arrays and sort by datetime
$arr = array_merge($arr1, $arr2);
usort($arr, function($a, $b) {
  $date1 = strtotime($a->datetime);
  $date2 = strtotime($b->datetime);
  return $date1 - $date2;     // ascending order, swop around for descending order
});
<?php 
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require_once "vendor/autoload.php";


if(isset($_POST['submit'])){
    $name = htmlspecialchars($_POST['name']);
    $email = htmlspecialchars($_POST['email']);
    $msg = htmlspecialchars($_POST['msg']);

    $error = "";
    $pass = "";
    // check if fields are empty

    if(empty($name) || empty($email) || empty($msg)){
        $error .= str_replace(" ", "-", "Fields cannot be empty");
        header("location: index.php?err=$error");
        die;
    }
    else if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
        $error .= str_replace(" ", "-", "Email given is invalid");
        header("location: index.php?err=$error");
        die;
    }
    else {
        // if no error occur send mail
        $to = "alumonabenaiah71@gmail.com";
        $mail = new PHPMailer(true); 
        $mail->IsSMTP();
        $mail->Mailer = "smtp";
        $mail->SMTPDebug  = 1;  
        $mail->SMTPAuth   = TRUE;
        $mail->SMTPSecure = "tls";
        $mail->Port       = 587;
        $mail->Host       = "smtp.gmail.com";
        $mail->Username   = "your-gmail-account-address";
        $mail->Password   = "your-password";
        $mail->From = $email;
        $mail->FromName = $name;
        $mail->addAddress($to);
        $mail->Subject = "Contact Form Request";
        $mail->Body = $msg;
        if($mail->send()){
            $pass .= str_replace(" ", "-", "Message sent Successfully!!");
            header("location: index.php?pass=$pass");
            die;
        }else{
            $error .= str_replace(" ", "-", "An error occur while sending message, please try later ".$mail->ErrorInfo);
            header("location: index.php?err=$error");
            die;
        }
    }
}
else{
    header("location: index.php");
    die;
}

?>
body{
    width: 100%;
    height: 100vh;
    margin:0px;
    padding:0px;
    overflow-x: hidden;
    background:url("https://images.unsplash.com/photo-1530893609608-32a9af3aa95c?ixid=MXwxMjA3fDB8MHxzZWFyY2h8MTJ8fHRlY2h8ZW58MHx8MHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60") !important;
    background-size:cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}
*{
    list-style: none;
    box-sizing: border-box;
}

.container{
    display:flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width:100%;
    height:100vh;
}
.container .form-cont{
    width:450px;
    padding:12px;
    background:rgba(0,0,0,.8);
    color:#fff;
}

.container .form-cont form textarea{
    height:100px;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Send Mail</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/bootstrap.css">
</head>
<body>
    <div class="container">
        <div class="form-cont">
            <h3>Contact Form</h3>
            <br>
            <div class="err-cont">
                <?php if(isset($_GET['err'])){?>
                <div class="alert alert-danger"><small><?php echo $_GET['err'];?></small></div>
                <?php }else if(isset($_GET['pass'])){?>
                <div class="alert alert-success"><small><?php echo $_GET['pass'];?></small></div>
                <?php }?>
            </div>
            <form action="sendmail.php" class="form-group" method="POST">
                <label for="fname">Fullname</label>
                <input type="text" name="name" placeholder="Your name.." class="form-control">
                
                <label for="fname">Email</label>
                <input type="email" name="email" placeholder="Your Email Address.." class="form-control">
                
                <label for="subject">Message</label>
                <textarea name="msg" placeholder="Write something.." class="form-control"></textarea>
            
                <input type="submit" name="submit" value="Send Message" class="btn btn-block btn-primary mt-2">
            
              </form>
        </div>
    </div>
</body>
</html>
/* Add the below to functions.php */

/**
 * Footer Widget
 */

 function custom_footer_widget_one() {
	 $args = array(
		 'id'				=> 'footer-widget-col-1',
		 'name'				=> __('Footer Column One', 'text_domain'),
		 'description' 		=> __('Column One', 'text_domain'),
		 'before_title'		=> '<h3>',
		 'after_title'		=> '</h3>',
		 'before_widget'	=> '<div id="%1$s" class="widget %2$s">',
		 'after_widget'		=> '</div>'
	 );
	 register_sidebar( $args );
 }

 add_action( 'widgets_init', 'custom_footer_widget_one' );

/* To use in the template, copy the below into a template file */

<?php dynamic_sidebar( 'footer-widget-col-1' ); ?>
// Check if menu exists
if ( $menu_items = wp_get_nav_menu_items( 'menu' ) ) {
   
   // Loop over menu items
   foreach ( $menu_items as $menu_item ) {

      // Compare menu item url with server request uri path
      $current = ( $_SERVER['REQUEST_URI'] == parse_url( $menu_item->url, PHP_URL_PATH ) ) ? 'current' : '';

      // Print menu item
      echo '<li class="' . $current . '"><a href="' . $menu_item->url . '">' . $menu_item->title . '</a></li>';
   }
}
// Check if menu exists
if ( $menu_items = wp_get_nav_menu_items( 'menu' ) ) {
   
   // Loop over menu items
   foreach ( $menu_items as $menu_item ) {

      // Compare menu object with current page menu object
      $current = ( $menu_item->object_id == get_queried_object_id() ) ? 'current' : '';
      
      // Print menu item
      echo '<li class="' . $current . '"><a href="' . $menu_item->url . '">' . $menu_item->title . '</a></li>';
   }
}
<?php
    $dates = array
    (
        '0' => "2013-02-18 05:14:54",
        '1' => "2013-02-12 01:44:03",
        '2' => "2013-02-05 16:25:07",
        '3' => "2013-01-29 02:00:15",
        '4' => "2013-01-27 18:33:45"
    );

    function closest($dates, $findate)
    {
        $newDates = array();

        foreach($dates as $date)
        {
            $newDates[] = strtotime($date);
        }

        echo "<pre>";
        print_r($newDates);
        echo "</pre>";

        sort($newDates);
        foreach ($newDates as $a)
        {
            if ($a >= strtotime($findate))
                return $a;
        }
        return end($newDates);
    }

    $values = closest($dates, date('2013-02-04 14:11:16'));
    echo date('Y-m-d h:i:s', $values);
?>
<?php

use Drupal\comment\CommentInterface;

function custom_drupal_overrides_field_widget_form_alter(&$element, &$form_state, $context) {
    if ($context['widget']->getPluginId() == 'entity_reference_autocomplete') {
      if ($element['target_id']['#maxlength'] == 1024) {
        $element['target_id']['#maxlength'] = 3072;
      }
    }
  if ($context['widget']->getPluginId() == 'entity_reference_tree') {
    if ($element['target_id']['#maxlength'] == 1024) {
      $element['target_id']['#maxlength'] = 3072;
    }
  }
}
php artisan migrate:refresh --path=/database/migrations/my_migration.php
class MyController extends Controller

{

  public function get(Request $request)

  {

    // Something here

  }

  

  public function callAction($method, $parameters)

    {

        return parent::callAction($method, array_values($parameters));

    }

}
// GRID to List For Mobile Start //
/* if( isset($_GET['s'])){ */
function product_grid_list_mod()
{  ?>
<style>
	Your styles here
</style>
<?php /* } */
add_action('wp_head', 'product_grid_list_mod', 100);
}
// GRID to List For Mobile End //
<?php
  // Create database connection
  $db = mysqli_connect("localhost", "root", "", "spm");

  // Initialize message variable
  $msg = "";

  // If upload button is clicked ...
  if (isset($_POST['upload'])) {
  	// Get image name
  	$image = $_FILES['image']['name'];
  	// Get text
  	$image_text = mysqli_real_escape_string($db, $_POST['image_text']);

  	// image file directory
  	$target = "D:/wamp64/www/ALLProjects/all/images/".basename($image);//change to the SERVER'S absolute path

  	$sql = "INSERT INTO images (image, image_text) VALUES ('$image', '$image_text')";
  	// execute query
  	mysqli_query($db, $sql);

  	if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
  		$msg = "Image uploaded successfully";
  	}else{
  		$msg = "Failed to upload image";
  	}
  }
  $result = mysqli_query($db, "SELECT * FROM images");
?>
<!DOCTYPE html>
<html>
<head>
<title>Image Upload</title>
<style type="text/css">
   #content{
   	width: 50%;
   	margin: 20px auto;
   	border: 1px solid #cbcbcb;
   }
   form{
   	width: 50%;
   	margin: 20px auto;
   }
   form div{
   	margin-top: 5px;
   }
   #img_div{
   	width: 80%;
   	padding: 5px;
   	margin: 15px auto;
   	border: 1px solid #cbcbcb;
   }
   #img_div:after{
   	content: "";
   	display: block;
   	clear: both;
   }
   img{
   	float: left;
   	margin: 5px;
   	width: 300px;
   	height: 140px;
   }
</style>
</head>
<body>
<div id="content">
  <?php
    while ($row = mysqli_fetch_array($result)) {
      echo "<div id='img_div'>";
      	echo "<img src='/all/images/".$row['image']."' >";
      	echo "<p>".$row['image_text']."</p>";
      echo "</div>";
    }
  ?>
  <form method="POST" action="index.php" enctype="multipart/form-data">
  	<input type="hidden" name="size" value="1000000">
  	<div>
  	  <input type="file" name="image">
  	</div>
  	<div>
      <textarea
      	id="text"
      	cols="40"
      	rows="4"
      	name="image_text"
      	placeholder="Say something about this image..."></textarea>
  	</div>
  	<div>
  		<button type="submit" name="upload">POST</button>
  	</div>
  </form>
</div>
</body>
</html>
<a href="mailto:username@domain@@com" onclick="this.href=this.href.replace('@@','.')"> username<code>@</code>domain.com</a>
<hr style="border: 1px solid #000000;" />
@media all and (min-width:801px) {
.fusion-content-boxes .fusion-column .col.content-box-wrapper .fusion-read-more-button {
    padding: 10px;
    width: 100%;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size:1.3vw !important;
    line-height: normal;
}}
preg_match('/(.)\\1{4,}/', $text)
img {
  width: 250px;
  height: 250px;
  object-fit: cover;
  margin-right: 3%;
}
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 );
remove_action( 'woocommerce_register_form', 'wc_registration_privacy_policy_text', 20 );

add_action( 'woocommerce_checkout_terms_and_conditions', 'add_custom_privacy_checkbox', 20 );
add_action( 'woocommerce_register_form', 'add_custom_privacy_checkbox_register', 20 );

function add_custom_privacy_checkbox() {
	
	$privacy_policy_text = wp_kses_post( wc_replace_policy_page_link_placeholders( wc_get_privacy_policy_text( 'checkout' ) ) );
	
woocommerce_form_field( 'privacy_policy', array(
'type' => 'checkbox',
'class' => array('form-row privacy'),
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
'required' => true,
'label' => '<span>' . $privacy_policy_text . '</span>',
));

}
function add_custom_privacy_checkbox_register() {
	
	$privacy_policy_text = wp_kses_post( wc_replace_policy_page_link_placeholders( wc_get_privacy_policy_text( 'registration' ) ) );
	
woocommerce_form_field( 'privacy_policy', array(
'type' => 'checkbox',
'class' => array('form-row privacy'),
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
'required' => true,
'label' => '<span>' . $privacy_policy_text . '</span>',
));

}

add_action( 'woocommerce_checkout_process', 'privacy_checkbox_error_message' );
add_action( 'woocommerce_register_post', 'privacy_checkbox_error_message_registration', 10, 3 );

function privacy_checkbox_error_message() {
	if ( ! (int) isset( $_POST['privacy_policy'] ) ) {
	wc_add_notice( __( 'Veuillez lire et accepter notre politique de confidentialité pour poursuivre votre commande.' ), 'error' );
	}
}
function privacy_checkbox_error_message_registration($username, $email, $validation_errors) {
	if ( ! (int) isset( $_POST['privacy_policy'] ) ) {
			$validation_errors->add( 'privacy_policy_error', __( 'Veuillez lire et accepter notre politique de confidentialité pour pouvoir vous enregistrer.', 'woocommerce' ), 'error');
	}
}
if (have_rows('your-repeater')) {
  ?>
    <select>
      <?php 
        while (have_rows('your-repeater')) {
          the_row();
          ?><option value="<?php the_sub_field('your-sub-field'); ?>"><?php the_sub_field('your-sub-field'); ?></option><?php 
        }
      ?>
    </select>
  <?php 
}
composer create-project "laravel/laravel=5.1.*" sampleproject
function send_form_feedback()
{
    if ($_POST) {
        // Set wp_mail html content type
        add_filter('wp_mail_content_type', 'set_html_content_type');
        $name = isset($_POST['name']) ? $_POST['name'] : '';
        $email = isset($_POST['email']) ? $_POST['email'] : '';
        $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
        $message = isset($_POST['message']) ? $_POST['message'] : '';
        $to = get_option('admin_email');
        $subject = 'Новое сообщение';
        $content = '<p><b>Имя:</b> ' . $name . '</p>';
        $content .= '<p><b>E-mail:</b> ' . $email . '</p>';
        $content .= '<p><b>Телефон:</b> ' . $phone . '</p>';
        $content .= '<p><b>Сообщение:</b></p>';
        $content .= '<p>' . $message . '</p>';
        $content .= '<br /><br />';
        $content .= 'Это сообщение отправлено с сайта <a href="' . get_site_url() . '">' . get_site_url() . '</a>';
        if (wp_mail($to, $subject, $content)) {
            $json = array('status' => 'success', 'message' => '<b>Поздравляем!</b><br />Сообщение успешно отправлено');
        } else {
            $json = array('status' => 'error', 'message' => '<b>Ошибка!</b><br />Попробуйте позже или свяжитесь с администрацией сайта');
        }
        // Reset wp_mail html content type
        remove_filter('wp_mail_content_type', 'set_html_content_type');
        die(json_encode($json));
    }
    die(json_encode(array('status' => 'error', 'message' => '<b>Что-то пошло не так!</b><br />Попробуйте позже или свяжитесь с администрацией сайта')));
}
function get_string_between($string, $start, $end){
    $string = ' ' . $string;
    $ini = strpos($string, $start);
    if ($ini == 0) return '';
    $ini += strlen($start);
    $len = strpos($string, $end, $ini) - $ini;
    return substr($string, $ini, $len);
}
add_filter( 'style_loader_src',  'sdt_remove_ver_css_js', 9999, 2 );
add_filter( 'script_loader_src', 'sdt_remove_ver_css_js', 9999, 2 );

function sdt_remove_ver_css_js( $src, $handle ) 
{
    $handles_with_version = [ 'style','general' ]; // <-- Adjust to your needs!
    if ( strpos( $src, 'ver=' ) && ! in_array( $handle, $handles_with_version, true ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'), false);
$entities = $user->entities;
$entityIds = $entities->map( function($entity) {
    return [$entity['id']];
});
Entity::whereIn('id', $entityIds)->deleted();
sanitize_email()
sanitize_file_name()
sanitize_html_class()
sanitize_key()
sanitize_mime_type()
sanitize_option()
sanitize_sql_orderby()
sanitize_text_field()
sanitize_title_for_query()
sanitize_title_with_dashes()
sanitize_user()
sanitize_meta()
sanitize_term()
sanitize_term_field()
add_action( 'cmb2_admin_init', 'cmb2_sample_metaboxes' );
/**
 * Define the metabox and field configurations.
 */
function cmb2_sample_metaboxes() {

	/**
	 * Initiate the metabox
	 */
	$cmb = new_cmb2_box( array(
		'id'            => 'test_metabox',
		'title'         => __( 'Test Metabox', 'cmb2' ),
		'object_types'  => array( 'page', ), // Post type
		'context'       => 'normal',
		'priority'      => 'high',
		'show_names'    => true, // Show field names on the left
		// 'cmb_styles' => false, // false to disable the CMB stylesheet
		// 'closed'     => true, // Keep the metabox closed by default
	) );

	// Regular text field
	$cmb->add_field( array(
		'name'       => __( 'Test Text', 'cmb2' ),
		'desc'       => __( 'field description (optional)', 'cmb2' ),
		'id'         => 'yourprefix_text',
		'type'       => 'text',
		'show_on_cb' => 'cmb2_hide_if_no_cats', // function should return a bool value
		// 'sanitization_cb' => 'my_custom_sanitization', // custom sanitization callback parameter
		// 'escape_cb'       => 'my_custom_escaping',  // custom escaping callback parameter
		// 'on_front'        => false, // Optionally designate a field to wp-admin only
		// 'repeatable'      => true,
	) );

	// URL text field
	$cmb->add_field( array(
		'name' => __( 'Website URL', 'cmb2' ),
		'desc' => __( 'field description (optional)', 'cmb2' ),
		'id'   => 'yourprefix_url',
		'type' => 'text_url',
		// 'protocols' => array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'), // Array of allowed protocols
		// 'repeatable' => true,
	) );

	// Email text field
	$cmb->add_field( array(
		'name' => __( 'Test Text Email', 'cmb2' ),
		'desc' => __( 'field description (optional)', 'cmb2' ),
		'id'   => 'yourprefix_email',
		'type' => 'text_email',
		// 'repeatable' => true,
	) );

	// Add other metaboxes as needed

}
<?php
// Grab the metadata from the database
$text = get_post_meta( get_the_ID(), 'yourprefix_text', true );

// Echo the metadata
echo esc_html( $text );
?>
if (strpos($a, 'are') !== false)
{
    echo 'true';
}
echo apiError("An unkwnown error occurred.\n".mysql_error()."\nError code t-m-107-ep.");
date("j"); //day of month 1 to 31
date("l"); //day of week
date("F"); //month
date("M"); //month abbrev
date("n"); //month number
date("Y"); //year
date("M. j, Y"); //Mar. 8, 1985
date("F j, Y"); //March 8, 1985
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$validatedData = $request->validate([
    'name' => 'required',
    'gender' => 'required',
    'country' => 'required',
    'bod'=>'required',
    'description'=>'required',
]);

Profile::where('user_id',$user_id)->fill([
        'name'=>'name',
        'gender'=>'gender',
        'country'=>'country',
        'bod'=>'bod',
        'description'=>'description',
    ])->save();
add_action( 'plugins_loaded', 'apple_pay_verification_file' );
function apple_pay_verification_file() {
   
    if ( $_SERVER["REQUEST_URI"] == "/.well-known/apple-developer-merchantid-domain-association.txt" ) {
      readfile( dirname( __FILE__ ) . "/apple-developer-merchantid-domain-association");
      exit();
    }
  }
// intval() - http://php.net/manual/en/function.intval.php

$seconds_ago = (time() - strtotime('2014-01-06 15:25:08'));

if ($seconds_ago >= 31536000) {
    echo "Seen " . intval($seconds_ago / 31536000) . " years ago";
} elseif ($seconds_ago >= 2419200) {
    echo "Seen " . intval($seconds_ago / 2419200) . " months ago";
} elseif ($seconds_ago >= 86400) {
    echo "Seen " . intval($seconds_ago / 86400) . " days ago";
} elseif ($seconds_ago >= 3600) {
    echo "Seen " . intval($seconds_ago / 3600) . " hours ago";
} elseif ($seconds_ago >= 60) {
    echo "Seen " . intval($seconds_ago / 60) . " minutes ago";
} else {
    echo "Seen less than a minute ago";
}
add_filter('manage_events_posts_columns', 'filter_events_custom_columns');
function filter_events_custom_columns($columns) {
    $columns['event_date'] = 'Event Date';
	unset($columns['date']);
    return $columns;
}
add_action('manage_events_posts_custom_column',  'action_events_custom_columns');
function action_events_custom_columns($column) {
	global $post;
	if($column == 'event_date') {
		echo(get_field('event_date', $post->ID));
	}
}
add_filter( 'manage_edit-events_sortable_columns', 'sortable_events_custom_columns' );
function sortable_events_custom_columns( $columns ) {
    $columns['event_date'] = 'Event Date';
    //To make a column 'un-sortable' remove it from the array
    //unset($columns['date']);
    return $columns;
}
<?php
// Array representing a possible record set returned from a database
$records = array(
    array(
        'id' => 2135,
        'first_name' => 'John',
        'last_name' => 'Doe',
    ),
    array(
        'id' => 3245,
        'first_name' => 'Sally',
        'last_name' => 'Smith',
    ),
    array(
        'id' => 5342,
        'first_name' => 'Jane',
        'last_name' => 'Jones',
    ),
    array(
        'id' => 5623,
        'first_name' => 'Peter',
        'last_name' => 'Doe',
    )
);
 
$first_names = array_column($records, 'first_name');
print_r($first_names);
?>
$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get();
$users = DB::table('users')
                 ->select(DB::raw('count(*) as user_count, status'))
                 ->where('status', '<>', 1)
                 ->groupBy('status')
                 ->get();


Model::select(DB::raw('query'))
     ->whereNull('deleted_at')
     ->orderBy('id')
     ->get();
function getVarName(){

  //  https://github.com/gaffling/PHP-Get-Variable-Name-as-a-String/blob/master/function.php
  //  echo get_var_name($FooBar).' - '.$FooBar;

    // read backtrace
    $bt   = debug_backtrace();
    // read file
    $file = file($bt[0]['file']);
    // select exact print_var_name($varname) line
    $src  = $file[$bt[0]['line']-1];
    // search pattern
    $pat = '#(.*)'.__FUNCTION__.' *?\( *?(.*) *?\)(.*)#i';
    // extract $varname from match no 2
    $var  = preg_replace($pat, '$2', $src);
    // return the var name
    return trim($var);
}


function debugServer($input, $input_name = "")
{
    $temp = print_r($input, true);
    
    error_log(  $input_name . " : "  . $temp);
}
function geocode($address){
 
    // url encode the address
    $address = urlencode($address);
     
    // google map geocode api url
    $url = "https://maps.googleapis.com/maps/api/geocode/json?address={$address}&key=YOUR_API_KEY";
 
    // get the json response
    $resp_json = file_get_contents($url);
     
    // decode the json
    $resp = json_decode($resp_json, true);
 
    // response status will be 'OK', if able to geocode given address 
    if($resp['status']=='OK'){
 
        // get the important data
        $lati = isset($resp['results'][0]['geometry']['location']['lat']) ? $resp['results'][0]['geometry']['location']['lat'] : "";
        $longi = isset($resp['results'][0]['geometry']['location']['lng']) ? $resp['results'][0]['geometry']['location']['lng'] : "";
        $formatted_address = isset($resp['results'][0]['formatted_address']) ? $resp['results'][0]['formatted_address'] : "";
         
        // verify if data is complete
        if($lati && $longi && $formatted_address){
         
            // put the data in the array
            $data_arr = array();            
             
            array_push(
                $data_arr, 
                    $lati, 
                    $longi, 
                    $formatted_address
                );
             
            return $data_arr;
             
        }else{
            return false;
        }
         
    }
 
    else{
        echo "<strong>ERROR: {$resp['status']}</strong>";
        return false;
    }
}
function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
php artisan config:cache
Hello, As I read in your description that your company has many php- laravel, javascript projects, I am very interested in working with you. As you can see my profile, I have worked in core PHP, php and wordpress and javascript many times. I can work in this domain.
I know MVCs very well and have experience with them. I have worked with MVC CRUD, routing, integrating frontend technologies like vue.js and angular.js with the MVCs.
I have spent time in Integrating payment gateways in php and laravel.
I am also quiet good in architecturing databases like MySQL.
So overall I feel I will be a great fit t your system if selected once for a project.
If any thing is new for me that has to be implemented in the project then I find it to be a great opportunity of learning and implementation. So you can trust me and keep me as your working partner. You wil find me as a basic need of your development team after I have spent some time working with youl.
I will be waiting for your response.
Thank you.
Kind Regards.
// json data
;[
  {
    name: 'Aragorn',
    race: 'Human',
  },
  {
    name: 'Legolas',
    race: 'Elf',
  },
  {
    name: 'Gimli',
    race: 'Dwarf',
  },
]

$url = 'data.json'; // path to your JSON file
$data = file_get_contents($url); // put the contents of the file into a variable
$characters = json_decode($data); // decode the JSON feed
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
function stripStyleTags($html='')
{
  $dom = new DOMDocument;                
	
  $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
	
  $xpath = new DOMXPath($dom); 
	
  // Find any element with the style attribute
  $nodes = $xpath->query('//*[@style]');  
	
  // Loop the elements
  foreach ($nodes as $node)               
  {             
    // Remove style attribute
    $node->removeAttribute('style');
  }
  $html = $dom->saveHTML(); 
	
  return $html;
}
<span>
   <a href="" routerLink="create-indicator" routerLinkActive="active"><i class="fas fa-plus-circle ml-3"></i></a>
</span>
// This is a case of a thick line. Without the transform property, the top and not the actual center of the line is in the middle of the div.
.progress {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: -1;
    transition: .4s ease;
}
.progress-container {
    display: flex;
    justify-content: space-between;
}
// Changes the transition of a selected CSS property. That is, it takes effect when the property changes.
// cssProperty lengthOfTransition typeOfTransition delay (optional)
// General note: Don't separate the classes when chaining
.panel.active h3 {
    opacity: 1;
    transition: opacity 0.3s ease-in 0.4s;
}

// Changes the transition of a selected CSS property. That is, it takes effect when the property changes.
// cssProperty lengthOfTransition typeOfTransition delay (optional)
// General note: Don't separate the classes when chaining
.panel.active h3 {
    opacity: 1;
    transition: opacity 0.3s ease-in 0.4s;
}

// There are 5 divs of class panel
@media(max-width: 480px) {
    .panel:nth-of-type(4),
    .panel:nth-of-type(5) {
        display: none;
    }
}
// Importing Google font
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;1,700&display=swap');

// Any margins or padding added to any element won't affect its width
* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
  // This is the easiest way to center align content vertically
    display: flex;
  // The default direction elements are stacked is side by side (horizontally). This changes it to top to bottom (vertially)
    flex-direction: column;
  // Horizontally center
    align-items: center;
  // Vertically center - must have a height to work
    justify-content: center;
    height: 100vh;
  // Scroll bars are hidden by default
    overflow: hidden;
}
function modulo11 ($barcode)  {
  $sum = 0;
  for  ( $i=0; $i<=8; $i++ )  {
   $add = $barcode{$i} * ($i+1);
   $sum = $sum + $add; 
  }
  $modulo = $sum % 11;
  if ( $modulo == 10 )  { $modulo = "x"; }
  if ( $barcode{9} == $modulo ) {
   return true;
  } else {
   return false;
  }
} 
 <a class="coco_circle_button et_pb_button_0_tb_header et_pb_button" style="margin-top: 100px;" href="# ">Get Your Glow</a></p>
export PATH=$PATH:~/.composer/vendor/bin
//~/.composer/vendor/bin is the path
$email = test_input($_POST["email"]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  $emailErr = "Invalid email format";
}
<?php

$valid = true;
$errors = array();

$contact = array(
    'name' => null,
    'email' => null,
    'message' => null
);

// Check if the form has been posted
if (isset($_POST['name'], $_POST['email'], $_POST['message'])) {
    $contact = filter_input_array(INPUT_POST, array(
        'name'   => FILTER_SANITIZE_STRING,
        'email'   => FILTER_SANITIZE_STRING,
        'message'   => FILTER_SANITIZE_STRING,
    ), true);
    if (empty($contact['name'])) {
        $valid = false;
        $errors['name'] = "You must enter your name.";
    }
    if (empty($contact['email'])) {
        $valid = false;
        $errors['email'] = "You must enter your email address.";
    } elseif (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)) {
        $valid = false;
        $errors['email'] = "You must enter a valid email address.";
    }
    if (empty($contact['message'])) {
        $valid = false;
        $errors['message'] = "You must enter a message.";
    }
    if ($valid) {
        // The email address the email will be sent to
        $to = "business@example.com";
        // The email subject
        $subject = "Contact Form Submission";
        // Set the from and reply-to address for the email
        $headers = "From: website@example.com\r\n"
                 . "Reply-To: " . $contact['email'] . "\r\n"
                 . "X-Mailer: PHP/" . phpversion();
        // Build the body of the email
        $mailbody = "The contact form has been filled out.\n\n"
                  . "Name: " . $contact['name'] . "\n"
                  . "Email: " . $contact['email'] . "\n"
                  . "Message:\n" . $contact['message'];
        // Send the email
        mail($to, $subject, $mailbody, $headers);
        // Go to the thank you page
        header("location: thankyou.html");
        exit;
    }
}

?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Contact Us</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <form action="contact.php" method="post" accept-charset="utf-8">
        <fieldset>
            <legend>Contact Us</legend>
            <?php if (!$valid): ?>
                <div class="error">
                    <?php foreach($errors as $message):?>
                        <div><?php echo htmlspecialchars($message); ?></div>
                    <?php endforeach; ?>
                </div>
            <?php endif; ?>
            <div class="row">
                <label for="name">Name: </label>
                <input id="name" type="text" name="name" value="<?php echo htmlspecialchars($contact['name']);?>">
            </div>
            <div class="row">
                <label for="email">Email Address: </label>
                <input id="email" type="text" name="email" value="<?php echo htmlspecialchars($contact['email']);?>">
            </div>
            <div class="row">
                <label for="message">Message:</label>
                <textarea id="message" name="message"><?php echo htmlspecialchars($contact['message']);?></textarea>
            </div>
            <div class="row">
                <input type="submit" value="Submit">
            </div>
        </fieldset>
    </form>
</body>
</html>
define("MAX_GEN",5);

function detail($number) {
    $d = mysql_query("select * from table where number = '$number'");
    if(mysql_num_rows($d) == 0) {
        $p[name] = "N/A";
        $p[number] = "N/A";
        $p[m_number] = "N/A";
        $p[f_number] = "N/A";
    }
    else $p = mysql_fetch_assoc($d);
    return $p;
}

function gen($number, $generation = 0, $out) {

    if ($generation >= MAX_GEN) {
        return false;
    }

    $record = detail($number);

    if ($generation == 0) $out[0][] = $record; // first man

    $generation++; // next generation

    if (!$out[$generation] && ($generation != MAX_GEN)) $out[$generation] = array();

    $x_mother = gen($record[m_number], $generation ); // continue with mother
    $x_father = gen($record[f_number], $generation ); // continue with father

    if ($out[$generation]) {
        $out[$generation][] = $x_mother;
        $out[$generation][] = $x_father;
    }
    return $out;
}
$oneDimensionalArray = array_map('current', $twoDimensionalArray);

/*
current() function returns the value of the current element in an array. for ex : $fruits = array("banana", "apple", "orange"); echo current($fruits) //will return "banana" since current pointer is on index 0 which is banana
*/
<?php
	$dbc = mysqli_connect('localhost', 'root', '');	//connect database
	mysqli_select_db($dbc, 'news');	//select database
	
	$errorsUpdNewsArr = array();
	
	if(isset($_POST['updNewsData'])){
		$newsID = $_POST['update_id'];
		$newsTitle = $_POST['txtNewsTitle'];
		$newsDetails = $_POST['txtNewsDetails'];
		$newsCategory = $_POST['selectNewsCategory'];
		
		$targetImage = "/205CDE/Assignment/".basename($_FILES['uploadNewsImg']['name']);
		$newsImage = $_FILES['uploadNewsImg']['name'];
		$newsImageExt = pathinfo($newsImage, PATHINFO_EXTENSION);
		
		//ensure form fields are filled properly
		if(empty($newsTitle)){
			array_push($errorsUpdNewsArr, "News title is required! Please try again!");
		}
		if(empty($newsDetails)){
			array_push($errorsUpdNewsArr, "News details is required! Please try again!");
		}
		if($_FILES["uploadNewsImg"]["error"] == 4){
			//no upload image
			//uploading news image is not mandatory
		}else{
			//check uploaded image file type
			if($newsImageExt !== 'jpg' && $newsImageExt !== 'jpeg' && $newsImageExt !== 'png' && $newsImageExt !== 'jfif'){
				array_push($errorsUpdNewsArr, "Invalid news image file type! Please try again!");
			}
		}
		
		//no errors
		if(count($errorsUpdNewsArr) == 0){
			$query = "UPDATE news SET news_title='$newsTitle', news_details='$newsDetails', news_category='$newsCategory', news_image='$newsImage' WHERE news_id='$newsID'";
			
			//Move uploaded image into a folder
			if(move_uploaded_file($_FILES['name']['tmp_name'], $targetImage)){
				$msg = "Image uploaded successfully!";
				}else{
				$msg = "Image uploaded unsuccessfully!";
			}
			
			$runQuery = mysqli_query($dbc, $query);
			
			if($runQuery){
				echo '<script> alert("Data updated!"); </script>';
				header('Location: /205CDE/Assignment/manageNews.php');
				}else{
				echo '<script> alert("Data not update yet!"); </script>';
			}
			}else{
			//display error message in alert
			foreach($errorsUpdNewsArr as $errorsUpdNewsMsg){
				echo '<script type="text/javascript">alert("'.$errorsUpdNewsMsg.'");</script>'; 
			}
			
			//redirect to manageNews.php
			echo '<script type="text/javascript">window.location.href = "/205CDE/Assignment/manageNews.php";</script>'; 
		}
	}
	mysqli_close($dbc);
?>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html'); ?>
		
		<title>U Chen Daily | All News</title>
	</head>
	<style>
		@media only screen and (min-width: 893px) {
		.card-img-top{
		width: 100%;
		height: 15vw; 
		object-fit: cover;
		}
		}
		
		.card-body{
		background: #1f52a3;
		}
		
		.card-footer{
		background: #1f52a3;
		}
		
		.h5{
		color: #1f52a3;
		}
		
		.card-text{
		font-size: 12px;
		}
	</style>
	<body class="bg-light">
		<!--using external files-->
		<?php require('header.php'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">All News</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row d-flex justify-content-start" style="margin: 0 10px;">
			<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
				<div class="card" style="width: 22rem; margin: 20px 30px;">
					<img class="card-img-top" src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
					<div class="card-body">
						<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
					</div>
					<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
				</div>
				<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>		
<?php
	session_start();
	
	$errorsArr = array();
	
	if(isset($_POST['submittedLogin'])){
		$username = $_POST['usernameLogin'];
		$password = $_POST['passwordLogin'];
		
		//ensure form fields are filled properly
		if(empty($username)){
			array_push($errorsArr, "Username is required! Please try again!");
		}
		if(empty($password)){
			array_push($errorsArr, "Password is required! Please try again!");
		}
		if((!empty($username)) && (!empty($password)) && ($username != 'admin') && ($password != 'admin')){
			array_push($errorsArr, "Incorrect username or password! Please try again!");
		}
		
		//no errors
		if(count($errorsArr) == 0){
			$_SESSION['username'] = $username;
			$_SESSION['success'] = "You are now logged in!";
			header('Location: /205CDE/Assignment/manageNews.php');
		}
	}
	
	//logout
	if(isset($_GET['logout'])){
		session_destroy();
		unset($_SESSION['username']);
		header('Location: /205CDE/Assignment/home.php');
	}
?>
<div class="container-fluid" style="background: #1f52a3;">
	<div class="row">
		<div class="col-2"></div>
		<div class="col-8">
			<a href="/205CDE/Assignment/home.php"><h1 style="text-align: center; color: #e6e8eb; margin: 20px 0;">U Chen Daily</h1></a>
		</div>
		<div class="col-2 d-flex justify-content-center align-items-center">
			<?php if(isset($_SESSION['username'])){ ?>
				<a href="/205CDE/Assignment/home.php?logout='1'" class="btn btn-outline-light">LOGOUT</a>
				<?php }else{ 
				?>
				<button type="button" class="btn btn-outline-light" data-toggle="modal" data-target="#loginFormModal">
					LOGIN AS ADMIN
				</button>
			<?php } ?>
			<!--<a href="/205CDE/Assignment/manageNews.php" target="_blank" class="btn btn-outline-light">LOGIN</a>-->
		</div>
	</div>
</div>
<!--login form modal START-->
<!-- Modal -->
<div class="modal fade" id="loginFormModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<h5 class="modal-title" id="exampleModalCenterTitle">Login</h5>
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
			</div>
			<form action="/205CDE/Assignment/home.php" method="post" id="loginModalForm">
				<div class="modal-body">
					<?php
						if(count($errorsArr) > 0){?>
						<div class="form-group">
							<?php
								foreach($errorsArr as $errorMsg){
									//echo "<p class=\"text-danger\">$errorMsg</p>";
									echo "<script>alert(\"$errorMsg\")</script>";
								}
							?>
						</div>
						<?php }
					?>
					<div class="form-group">
						<label for="exampleInputEmail1">Username</label>
						<input type="text" class="form-control" name="usernameLogin" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter username" value="<?php if(isset($username)){echo $username;} ?>">
					</div>
					<div class="form-group">
						<label for="exampleInputPassword1">Password</label>
						<input type="password" class="form-control" name="passwordLogin" id="exampleInputPassword1" placeholder="Enter password">
					</div>
					<br>
					<div class="form-group">
						<button type="submit" class="btn btn-lg btn-block text-light" style="background: #1f52a3;">LOGIN</button>
						<input type="hidden" name="submittedLogin">
					</div>
				</div>
				<!--<div class="modal-footer">
					<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
					<button type="button" class="btn btn-primary">Login</button>
				</div>-->
			</form>
		</div>
	</div>
</div>
<!--login form modal END-->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
	<a class="navbar-brand" href="/205CDE/Assignment/home.php"><i class="fas fa-home" style="font-size: 30px; color: #1f52a3;"></i></a>
	<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
		<span class="navbar-toggler-icon"></span>
	</button>
	
	<div class="collapse navbar-collapse" id="navbarSupportedContent">
		<ul class="navbar-nav mr-auto">
			<li class="nav-item dropdown" style="margin: 0 15px;">
				<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">News</a>
				<div class="dropdown-menu" aria-labelledby="navbarDropdown">
					<?php
						$newsCategoryArr = array(
						'All', 'Nation', 'World',
						'Sport', 'Entertainment',
						);
						foreach($newsCategoryArr as $newsType){
							echo "<a class=\"dropdown-item\" href=\"/205CDE/Assignment/news$newsType.php\" target=\"_blank\">$newsType</a>";
						}
					?>
				</div>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/aboutUs.php" target="_blank">About Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/contactUs.php" target="_blank">Contact Us</a>
			</li>
			<li class="nav-item" style="margin: 0 15px;">
				<a class="nav-link" href="/205CDE/Assignment/faqs.php" target="_blank">FAQs</a>
			</li>
			<!-- <li class="nav-item"> -->
			<!-- <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> -->
			<!-- </li> -->
		</ul>
		<!-- <form class="form-inline my-2 my-lg-0"> -->
		<!-- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"> -->
		<!-- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> -->
		<!-- </form> -->
	</div>
</nav>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | News</title>
	</head>
	<body>
		<!--using external files-->
		<?php require('header.php'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">News</h3></div>
			</div>
		</div>
		<?php
			$dbc = mysqli_connect('localhost', 'root', '');
			mysqli_select_db($dbc, 'news');
			
			if(isset($_GET['id']) && is_numeric($_GET['id'])){
				$query = "SELECT * FROM news WHERE news_id={$_GET['id']}";
				
				if($r = mysqli_query($dbc, $query)){
					$row = mysqli_fetch_array($r);
				?>
				<div class="container-fluid bg-light" style="padding: 50px 20px">
					<div class="row d-flex justify-content-between" style="margin: 0 50px;">
						<div class="col-lg-8 col-md-12">
							<div class="row mb-3">
								<h2 style="color: #1f52a3;"><?php echo $row['news_title'] ?></h2>
							</div>
							<div class="row">
								<div class="col mb-3" style="font-size: 18px; color:#1f52a3;">
									<i class="far fa-clock"></i>&nbsp
									<?php echo date('d-M-Y', strtotime($row['news_datetime'])); ?>&nbsp&nbsp&nbsp
									<i class="fas fa-tag"></i>&nbsp
									<?php echo strtoupper($row['news_category']); ?>
								</div>
							</div>
							<div class="row">
								<div class="col-12"  style="margin-bottom: 10px;">
									<img class="card-img-top" src="<?php 
										if(empty($row['news_image'])){
											echo 'https://via.placeholder.com/350x250';
											}else{
											echo $row['news_image'];
										}
									?>" alt="Card image cap" style="width:80%;">
								</div>
								
							</div>
							<div class="row" style="margin: 10px 0; font-size: 20px;">
								<p class="font-weight-normal"><?php echo $row['news_details'] ?></p>
							</div>
						</div>
						<?php
						}
					}
					mysqli_close($dbc);
				?>
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC LIMIT 5';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<div class="col-lg-4 col-md-12">
					<div class="list-group list-group-flush" style="border: 2px solid #1f52a3; border-top: 0;">
						<h4 class="list-group-item text-light text-center" style="background: #1f52a3;">Top 5 Latest News</h4>
						<?php
							if($runQuery){
								foreach($runQuery as $row){?>
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>" class="list-group-item list-group-item-action" target="_blank">
									<div class="row">
										<div class="col-3">
											<img src="<?php 
												if(empty($row['news_image'])){
													echo 'https://via.placeholder.com/200x200';
													}else{
													echo $row['news_image'];
												}?>" alt="Thumbnail News Image" class="img-thumbnail">
											</div>
											<div class="col-8" style="font-size: 15px;">
												<?php echo $row['news_title']; ?>
											</div>
										</div>
									</a>	
									<?php }
									}else{
									echo "ERROR! No record found!";
								}
								mysqli_close($dbc);
							?>
						</div>
					</div>
					<!--<div class="col-3" style="">
						<img class="card-img-top" src="https://via.placeholder.com/350x200" alt="Card image cap">
					</div>-->
				</div>
			</div>
			
			
			<!--using external files-->
			<?php require('footer.html'); ?>
		</body>
	</html>	
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | FAQs</title>
	</head>
	<style>
		.card-header{
		background: #1f52a3;
		}
		.card-body{
		color: #1f52a3;
		}
		h3{
		color: #1f52a3;
		margin: 20px 0;
		}
	</style>
	<body>
		<!--using external files-->
		<?php require('header.php'); ?>
		<div class="container" style="margin: 5px 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">FAQs</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 10px 10px 50px;">
			<div class="row bg-light" style="margin: 10px 35px; font-size: 18px;">
				<div class="col-lg-6">
					<h3>General</h3>
					<div class="accordion" id="accordionExample">
						<!--first faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingOne">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
										There is something wrong with TheUChen.com.my and/or app. What should I do? (example: broken link, error page, spotted some issues)
									</button>
								</h2>
							</div>
							<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
								<div class="card-body bg-white">
									We are sorry for the inconvenience caused. Please report your issue to us and include as much information as possible.
								</div>
							</div>
						</div>
						<!--first faq END-->
						<!--second faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingTwo">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
										I want to publish articles or pictures from U Chen Daily. How do I get copyright permission?
									</button>
								</h2>
							</div>
							<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Write to us and get permission. Granting or refusal of permission is at our sole and absolute discretion.
								</div>
							</div>
						</div>
						<!--second faq END-->
						<!--third faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingThree">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
										Why can I only read a limited number of articles on TheUChen.com.my and app?
									</button>
								</h2>
							</div>
							<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Effective Feb 24, 2020, we will be offering a paid digital membership for unlimited access to TheUChen.com.my and app (“Digital Access”). This will ensure that we continue to provide reliable, relevant, and compelling content while maintaining the quality of journalism that readers trust us to uphold. The membership, called U Chen Daily Digital Access, also includes personalisation features to improve your reading experience.
								</div>
							</div>
						</div>
						<!--third faq END-->
						<!--4th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFour">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
										How can I keep track of how many articles I have read?
									</button>
								</h2>
							</div>
							<div id="collapseFour" class="collapse" aria-labelledby="headingFour" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Sorry, you can't track your article limit at the moment. We're still developing this part of the system so do bear with us while we continue to improve.
								</div>
							</div>
						</div>
						<!--4th faq END-->
						<!--5th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFive">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFive" aria-expanded="false" aria-controls="collapseFive">
										If I don’t want to register as a member, can I still read articles for free?
									</button>
								</h2>
							</div>
							<div id="collapseFive" class="collapse" aria-labelledby="headingFive" data-parent="#accordionExample">
								<div class="card-body bg-white">
									As a guest user without an active paid membership, you can access a limited number of articles for free each month. This limit resets every 30 days. This excludes premium content (marked as ‘PREMIUM’), which are exclusive to paid members, and content hosted on a separate subscription-based service, e.g. dimsum e-tuition videos.
								</div>
							</div>
						</div>
						<!--5th faq END-->
						<!--6th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingSix">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseSix" aria-expanded="false" aria-controls="collapseSix">
										Do I need to log in with a MyUChen account if I just want to read articles for free as a guest user?
									</button>
								</h2>
							</div>
							<div id="collapseSix" class="collapse" aria-labelledby="headingSix" data-parent="#accordionExample">
								<div class="card-body bg-white">
									While it’s not compulsory, we do recommend that you sign up for a MyUChen account. As a member, you can UChent your 1-month free trial to U Chen Daily Digital Access and enjoy personalisation features to improve your reading experience.
								</div>
							</div>
						</div>
						<!--6th faq END-->
						<!--7th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingSeven">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseSeven" aria-expanded="false" aria-controls="collapseSeven">
										What does the paid U Chen Daily Digital Access membership entail?
									</button>
								</h2>
							</div>
							<div id="collapseSeven" class="collapse" aria-labelledby="headingSeven" data-parent="#accordionExample">
								<div class="card-body bg-white">
									With U Chen Daily Digital Access membership, you will be able to access all articles on TheUChen.com.my and app, including premium content which are exclusive to paid members, excluding content hosted on a separate subscription-based services, e.g. dimsum e-tuition videos. Members can also access all personalisation features.
								</div>
							</div>
						</div>
						<!--7th faq END-->
						<!--8th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingEight">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseEight" aria-expanded="false" aria-controls="collapseEight">
										I'm currently subscribed to ePaper. Do I still need to subscribe to U Chen Daily?
									</button>
								</h2>
							</div>
							<div id="collapseEight" class="collapse" aria-labelledby="headingEight" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Yes. At the moment U Chen Daily Digital Access and ePaper subscription are on two separate platforms.
								</div>
							</div>
						</div>
						<!--8th faq END-->
					</div>
				</div>
				<div class="col-lg-6">
					<h3>About Account</h3>
					<div class="accordion" id="accordionExample">
						<!--9th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingNine">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light" type="button" data-toggle="collapse" data-target="#collapseNine" aria-expanded="true" aria-controls="collapseNine">
										I can’t sign up/register from Internet Explorer?
									</button>
								</h2>
							</div>
							<div id="collapseNine" class="collapse show" aria-labelledby="headingNine" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Internet Explorer is not supported at the moment. Best view from Chrome browsers.
								</div>
							</div>
						</div>
						<!--9th faq END-->
						<!--10th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingTen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseTen" aria-expanded="false" aria-controls="collapseTen">
										I signed up for a free MyUChen account before Feb 10, 2020 and was prompted to update my password. What should I do?
									</button>
								</h2>
							</div>
							<div id="collapseTen" class="collapse" aria-labelledby="headingTen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Please log in with your username/email and change your password with a minimum of eight characters. It must contain at least one upper case letter, one number, and one special character except '+' and '='. Please use your new password for future logins.
								</div>
							</div>
						</div>
						<!--10th faq END-->
						<!--11th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingEleven">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseEleven" aria-expanded="false" aria-controls="collapseEleven">
										Why do I have to change my password?
									</button>
								</h2>
							</div>
							<div id="collapseEleven" class="collapse" aria-labelledby="headingEleven" data-parent="#accordionExample">
								<div class="card-body bg-white">
									We've made some enhancements to the TheUChen.com.my and app to improve your reading experience and for web security. This includes migrating all MyUChen accounts to a new system. Members who signed up before Feb 10, 2020, are required to update their password.
								</div>
							</div>
						</div>
						<!--11th faq END-->
						<!--12th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingTwelve">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseTwelve" aria-expanded="false" aria-controls="collapseTwelve">
										I forgot my password, what should I do?
									</button>
								</h2>
							</div>
							<div id="collapseTwelve" class="collapse" aria-labelledby="headingTwelve" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Click ‘Forgot Password?’ and you will be emailed a temporary password that you can log in with. Please proceed to change your password as soon as possible.
								</div>
							</div>
						</div>
						<!--12th faq END-->
						<!--13th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingThirteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseThirteen" aria-expanded="false" aria-controls="collapseThirteen">
										I’ve updated my password, but I can’t log in with MyUChen account’s username?
									</button>
								</h2>
							</div>
							<div id="collapseThirteen" class="collapse" aria-labelledby="headingThirteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Please use the new password with your MyUChen email.
								</div>
							</div>
						</div>
						<!--13th faq END-->
						<!--14th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFourteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFourteen" aria-expanded="false" aria-controls="collapseFourteen">
										I registered for a MyUChen account but did not receive any verification email. What should I do?
									</button>
								</h2>
							</div>
							<div id="collapseFourteen" class="collapse" aria-labelledby="headingFourteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									lease check both your Inbox and/or Spam folders. Click ‘Resend verification email’ and try again. If you have closed the page or have been logged out, please log in again to click ‘Resend verification email’.
									<br>
									If you are using a corporate email, kindly inform your tech department to whitelist @theUChen.com.my.
								</div>
							</div>
						</div>
						<!--14th faq END-->
						<!--15th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingFifteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseFifteen" aria-expanded="false" aria-controls="collapseFifteen">
										The email verification link/code provided is invalid. What should I do?
									</button>
								</h2>
							</div>
							<div id="collapseFifteen" class="collapse" aria-labelledby="headingFifteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									Click ‘Resend verification email’ and try again. If you have closed the page or have been logged out, please log in again to click ‘Resend verification email’.
								</div>
							</div>
						</div>
						<!--15th faq END-->
						<!--16th faq UChenT-->
						<div class="card">
							<div class="card-header" id="headingSixteen">
								<h2 class="mb-0">
									<button class="btn btn-block text-left text-light collapsed" type="button" data-toggle="collapse" data-target="#collapseSixteen" aria-expanded="false" aria-controls="collapseSixteen">
										I can’t seem to register. It says email address previously registered. What do I do?
									</button>
								</h2>
							</div>
							<div id="collapseSixteen" class="collapse" aria-labelledby="headingSixteen" data-parent="#accordionExample">
								<div class="card-body bg-white">
									If you have forgotten your password, click ‘Forgot Password?’ to reset it. If you are certain that you did not sign up with your email address before, kindly contact our Customer Service.
								</div>
							</div>
						</div>
						<!--16th faq END-->
					</div>
				</div>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen  Daily | Contact Us</title>
	</head>
	<style>
		.google-maps {
        position: relative;
        padding-bottom: 50%;
        height: 0;
        overflow: hidden;
		}
		.google-maps iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
		}
		i {
		font-size: 50px; 
		color: #1f52a3;
		}
		h5 {
		color: #1f52a3;
		margin-top: 35px;
		}
	</style>
	<body>
		<!--using external files-->
		<?php require('header.html'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">Contact Us</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row bg-light" style="margin: 0px 35px;">
				<div class="col-12 google-maps">
					<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3972.4919887247825!2d100.2796820147649!3d5.341603796125226!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x304ac048a161f277%3A0x881c46d428b3162c!2sINTI%20International%20College%20Penang!5e0!3m2!1sen!2smy!4v1606047317819!5m2!1sen!2smy" width="600" height="450" frameborder="0" style="border: 2px solid #1f52a3;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>
				</div>
			</div>
			<div class="row bg-light" style="margin: 35px 35px 0;">
				<div class="col-4">
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<i class="far fa-envelope"></i>
					</div>
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<h5>info@uchendaily.com</h5>
					</div>
				</div>
				<div class="col-4">
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<i class="fas fa-phone-alt"></i>
					</div>
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<h5>+604-577 9999</h5>
					</div>
				</div>
				<div class="col-4">
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<i class="fas fa-map-marker-alt"></i>
					</div>
					<div class="row bg-light d-flex justify-content-center align-items-center">
						<h5>1-Z, Lebuh Bukit Jambul,<br>Bukit Jambul,<br>11900 Bayan Lepas,Pulau Pinang.</h5>
					</div>
				</div>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen  Daily | About Us</title>
	</head>
	<body>
		<!--using external files-->
		<?php require('header.html'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">About Us</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row bg-light" style="margin: 0 35px;">
				<div class="col">
					<h4>U Chen  Daily</h4>
				</div>
			</div>
			<div class="row bg-light" style="margin: 10px 35px;">
				<div class="col-6">
					<p>Since its launch on June 23, 1995, as Malaysia's first news website, U Chen  Daily has always striven to provide readers with up to date breaking news, compelling content and insightful opinions.</p>
					<p>Evolving with the times, our content includes current news, business, sports, community, tech, lifestyle and world news, as well as expert analysis and dynamic videos.</p>
					<p>The website was recognised in 2014 as one of the best in Asia by the World Association of Newspapers and News Publishers (WAN-IFRA).</p>
					<p>It serves as the foundation of an online community that has a million strong following on both Twitter and Facebook.</p>
					<p>As the digital companion to U Chen  Daily newspaper, U Chen  Daily is part of a portfolio that offers content through print, U Chen  Daily ePaper and a mobile app.</p>
					<p>Readers on-the-go who want breaking news and business updates delivered to them can opt for our SMS services available via Maxis and DiGi.</p>
				</div>
				<div class="col-6">
					<p>U Chen  Daily (daily) and Sunday U Chen  are published in five editions. Two editions cover the northern peninsular states of Penang, Kedah, Perlis, Kelantan and northern Perak, while another two editions cover the rest of the country. As of March 2010, the newspaper has a separate Sarawak edition priced at RM1.20.</p>
					<p>There are two main printing plants that publish four editions of U Chen  Daily on a daily basis. The northern editions are printed at U Chen  Daily Northern Hub in Bayan Lepas, Penang, while the other two editions are printed at U Chen  Daily Media Hub in Bukit Jelutong, Shah Alam, Selangor.</p>
					<p>U Chen  Daily weekday paper is packaged as a 4-in-1 paper, comprising the Main Paper, U Chen Biz, U Chen 2 and U Chen  Metro. Naturally, this newspaper also contains classifieds.</p>
					<p>The Main Paper covers the latest in both local and international news while U Chen Biz offers a comprehensive coverage of business developments, market trends, financial reports and updates in the stock market. U Chen 2 features articles on lifestyle, entertainment, health, parenting, social etiquette, science, environment, fashion, food, comics and many more. The contents published on U Chen  Daily Metro varies by edition, covering news and events in a particular region covered by each edition.</p>
				</div>
			</div>
		</div>
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>
<footer>
	<div class="container-fluid" style="background: #1f52a3; margin-top: 50px; padding: 30px;">
		<div class="row">
			<div class="col-1"></div>
			<div class="col-10 d-flex justify-content-start" style="color: #e6e8eb;">&#169; Copyright 2020 U Chen Daily. All rights reserved.</div>
			<div class="col-1"></div>
		</div>
	</div>
</footer>
<?php
	$dbc = mysqli_connect('localhost', 'root', '');	//connect database
	mysqli_select_db($dbc, 'news');	//select database
	
	$errorsAddNewsArr = array();
	
	if(isset($_POST['addNewsData'])){
		$newsTitle = trim(str_replace("'", "\'", $_POST['txtNewsTitle']));
		$newsDetails = trim(str_replace("'", "\'", $_POST['txtNewsDetails']));
		$newsCategory = $_POST['selectNewsCategory'];
		
		$targetImage = "/205CDE/Assignment/".basename($_FILES['uploadNewsImg']['name']);
		$newsImage = $_FILES['uploadNewsImg']['name'];
		
		//ensure form fields are filled properly
		if(empty($newsTitle)){
			array_push($errorsAddNewsArr, "News title is required! Please try again!");
		}
		if(empty($newsDetails)){
			array_push($errorsAddNewsArr, "News details is required! Please try again!");
		}
		if($newsCategory == 0){
			array_push($errorsAddNewsArr, "News category is required! Please try again!");
		}
		
		//no errors
		if(count($errorsAddNewsArr) == 0){
			$query = "INSERT INTO news (news_title, news_details, news_category, news_datetime, news_image) 
			VALUES ('$newsTitle', '$newsDetails', '$newsCategory', NOW(), '$newsImage')";
			
			//Move uploaded image into a folder
			if(move_uploaded_file($_FILES['name']['tmp_name'], $targetImage)){
				$msg = "Image uploaded successfully!";
				}else{
				$msg = "Image uploaded unsuccessfully!";
			}
			
			$runQuery = mysqli_query($dbc, $query);
			
			if($runQuery){
				echo '<script> alert("Data saved!"); </script>';
				header('Location: /205CDE/Assignment/manageNews.php');
				}else{
				echo '<script> alert("Data not save yet!"); </script>';
			}
		}else{
			//display error message in alert
			foreach($errorsAddNewsArr as $errorsAddNewsMsg){
				echo '<script type="text/javascript">alert("'.$errorsAddNewsMsg.'");</script>'; 
			}
			
			//redirect to manageNews.php
			echo '<script type="text/javascript">window.location.href = "/205CDE/Assignment/manageNews.php";</script>'; 
		}
	}
	mysqli_close($dbc);
?>
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Admin</title>
		<script type="text/javascript">
			setTimeout(function(){ 
				document.querySelector('.close').click();
			}, 2500);
		</script>
		<!--show news info for editing START-->
		<script type="text/javascript">
			$(document).ready(function(){
				$('.btnEdit').on('click', function(){
					$('#updNewsModal').modal('show');
					
					$tr = $(this).closest('tr');
					
					var data = $tr.children("td").map(function(){
						return $(this).text();
					}).get();
					
					console.log(data);
					
					$('#update_id').val(data[0]);
					$('#news_datetime').val(data[1]);
					$('#news_title').val(data[2]);
					$('#news_details').val(data[3]);
					$('#news_category').val(data[4]);
					$('#news_image').val(data[5]);
				});
			});
		</script>
		<!--show news info for editing END-->
		
		<!--show confirmation message for deleting START-->
		<script type="text/javascript">
			$(document).ready(function(){
				$('.btnDel').on('click', function(){
					$('#delNewsModal').modal('show');
					
					$tr = $(this).closest('tr');
					
					var data = $tr.children("td").map(function(){
						return $(this).text();
					}).get();
					
					console.log(data);
					
					$('#delete_id').val(data[0]);
				});
			});
		</script>
		<!--show confirmation message for deleting END-->
		
		<!--show file name after uploading image START-->
		<script type="text/javascript">
            $(document).ready(function() {
                bsCustomFileInput.init();
			});
		</script>
		<!--show file name after uploading image END-->
		<body>
			<!--using external files-->
			<?php
				if(empty($_SESSION['username'])){
					header('Location: /205CDE/Assignment/home.php');
				}
			?>
			<?php require('header.php'); ?>
			
			<div class="container" style="margin: 20px;">
				<div class="row">
					<div class="col-sm"><h3 style="color: #1f52a3;">Manage News</h3></div>
				</div>
			</div>
			<!--add news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="addNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Add News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/insertData.php" method="post" enctype="multipart/form-data">
							<div class="modal-body">
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="inputNewsTitle" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="selectNewsCategory">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Entertainment' => 4
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group mb-3">
									<label for="inputNewsImage" class="col-form-label">News Image:</label>
									<div class="custom-file">
										<input type="file" class="custom-file-input" name="uploadNewsImg" id="customFile">
										<label class="custom-file-label" for="customFile">Choose file</label>
									</div>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="inputNewsDetails" rows="10"></textarea>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="addNewsData" style="background: #1f52a3;">Add</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--add news modal END-->
			
			<!--edit news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="updNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Edit News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/updateData.php" method="post" enctype="multipart/form-data">
							<div class="modal-body">
								<input type="hidden" name="update_id" id="update_id">
								<div class="form-group">
									<label for="txtNewsDatetime">News Created Datetime:</label>
									<input type="text" class="form-control" name="txtNewsDatetime" id="news_datetime" aria-describedby="emailHelp" placeholder="Enter news datetime" disabled>
								</div>
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="news_title" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="news_category">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Entertainment' => 4
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group mb-3">
									<label for="inputNewsImage" class="col-form-label">News Image:</label>
									<div class="custom-file">
										<input type="file" class="custom-file-input" name="uploadNewsImg" id="news_image">
										<label class="custom-file-label" for="news_image"></label>
									</div>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="news_details" rows="10"></textarea>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="updNewsData" style="background: #1f52a3;">Edit</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--edit news modal END-->
			
			<!--delete news modal START-->
			<!-- Modal -->
			<div class="modal fade" id="delNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-dialog-centered" role="document">
					<div class="modal-content">
						<form action="/205CDE/Assignment/deleteData.php" method="post">
							<div class="modal-body">
								<input type="hidden" name="delete_id" id="delete_id">
								<div class="d-flex justify-content-center" style="margin: 25px 0;">
									<i class="fas fa-times-circle text-danger" style="font-size: 100px;"></i>
								</div>
								<div class="d-flex justify-content-center">
									<h4>Are you sure?</h4>
								</div>
								<div class="d-flex justify-content-center">
									<p class="col-1"></p>
									<p class="col-10" style="text-align: center;">Do you really want to delete this record?<br>This process cannot be undone.</p>
									<p class="col-1"></p>
								</div>
								<div class="row justify-content-around" style="margin: 15px 0;">
									<div class="col-6 d-flex justify-content-end">
										<button type="button" class="btn btn-secondary btn-lg" data-dismiss="modal">Cancel</button>
									</div>
									<div class="col-6 d-flex justify-content-start">
										<button type="submit" class="btn btn-danger btn-lg" name="delNewsData">Delete</button>
									</div>
									<input type="hidden" name="delSubmitted" value="true"/>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--delete news modal END-->
			
			<div class="container-fluid bg-light" style="padding: 30px 10px;">
				<div class="row bg-light" style="margin: 0 35px;">
					<div class="col-6">
						<h5>All News</h5>
					</div>
					<div class="col-6 d-flex justify-content-end">
						<button type="button" class="btn btn-primary" style="background: #1f52a3;" data-toggle="modal" data-target="#addNewsModal"><i class="fas fa-plus" style="font-size: 20px;"></i> Add News</button>
					</div>
				</div>
				<!--add news alert START-->
				<div class="row bg-light" style="margin: 15px 35px;" id="addNewsAlert">
					<div class="col-12">
						<div class="alert alert-success alert-dismissible fade show" role="alert" >
							<strong>Success!</strong> The news is added successfully!
							<button type="button" class="close" data-dismiss="alert" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
						</div>
					</div>
				</div>
				<!--add news alert END-->
				
				<!--news table START-->
				<div class="card-deck" style="margin: 15px 50px;">
					<?php
						$dbc = mysqli_connect('localhost', 'root', '');	//connect database
						mysqli_select_db($dbc, 'news');	//select database
						
						$query = 'SELECT * FROM news ORDER BY news_datetime DESC';
						$runQuery = mysqli_query($dbc, $query);
					?>
					<table class="table table-hover bg-light" id="manageNewsTable">
						<thead class="thead-light">
							<tr>
								<th scope="col">News ID</th>
								<th scope="col">News Created Datetime</th>
								<th scope="col">News Title</th>
								<th scope="col">News Details</th>
								<th scope="col">News Category</th>
								<th scope="col">News Image</th>
								<th scope="col">Edit/Delete</th>
							</tr>
						</thead>
						<?php
							if($runQuery){
								foreach($runQuery as $row){
								?>
								<tbody>
									<tr>
										<td><?php echo $row['news_id']; ?></td>
										<td><small><?php echo $row['news_datetime'];?></small></td>
										<td><?php echo $row['news_title']; ?></td>
										<td><?php echo $row['news_details']; ?></td>
										<td><?php echo $row['news_category']; ?></td>
										<td>
											<a href="<?php 
												if(empty($row['news_image'])){
													echo 'https://via.placeholder.com/200x200';
													}else{
													echo '/205CDE/Assignment/'.$row['news_image'];
												} ?>" target="_blank">
												<img src="<?php 
													if(empty($row['news_image'])){
														echo 'https://via.placeholder.com/200x200';
														}else{
														echo $row['news_image'];
													}?>" alt="Thumbnail News Image" class="img-thumbnail">
											</a>
										</td>
										<td>
											<button type="button" class="btn btn-info btnEdit"><i class="fas fa-edit" style="font-size: 14px;"></i></button>
											<button type="button" class="btn btn-danger btnDel"><i class="fas fa-trash" style="font-size: 14px;"></i></button>
										</td>
									</tr>
								</tbody>
								<?php
								}
								}else{
								echo "ERROR! No record found!";
							}
							mysqli_close($dbc);
						?>
					</table>
				</div>
				<!--news table END-->
			</div>
			<!--using external files-->
			<?php require('footer.html'); ?>
		</body>
	</html>																				
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Admin</title>
		<script>
			
		</script>
	</head>
	<body>
		<!--using external files-->
		<?php require('header.html'); ?>
		<div class="container" style="margin: 20px;">
			<div class="row">
				<div class="col-sm"><h3 style="color: #1f52a3;">Manage News</h3></div>
			</div>
		</div>
		<div class="container-fluid bg-light" style="padding: 30px 10px;">
			<div class="row bg-light" style="margin: 0 35px;">
				<div class="col-6">
					<h5>All News</h5>
				</div>
				<div class="col-6 d-flex justify-content-end">
					<button type="button" class="btn btn-primary" style="background: #1f52a3;" data-toggle="modal" data-target="#addNewsModal"><i class="fas fa-plus" style="font-size: 20px;"></i> Add News</button>
				</div>
			</div>
			
			<!--add news modal START-->
			<!-- Modal -->
			<div class="modal fade bd-example-modal-lg" id="addNewsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<h5 class="modal-title" id="exampleModalLabel">Add News</h5>
							<!--<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>-->
						</div>
						<form action="/205CDE/Assignment/admin.php" method="post">
							<div class="modal-body">
								<div class="form-group">
									<label for="inputNewsTitle">News Title:</label>
									<input type="text" class="form-control" name="txtNewsTitle" id="inputNewsTitle" aria-describedby="emailHelp" placeholder="Enter news title">
								</div>
								<div class="form-group">
									<label for="selectNewsCategory">News Category:</label>
									<select class="form-control" name="selectNewsCategory" id="selectNewsCategory">
										<?php
											$newsCategoryArr = array(
											'--Select news category--' => "",
											'Nation' => 1,	'World' => 2,
											'Sport' => 3,	'Lifestyle' => 4,
											'Food' => 5,	'Tech' => 6,
											'Education' => 7
											);
											foreach($newsCategoryArr as $newsType => $newsNum){
												echo "<option value=\"$newsType\">$newsType</option>";
											}
										?>
									</select>
								</div>
								<div class="form-group">
									<label for="inputNewsDetails" class="col-form-label">News Details:</label>
									<textarea class="form-control" name="txtNewsDetails" id="inputNewsDetails" rows="10"></textarea>
								</div>
								
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
								<button type="submit" class="btn btn-primary" name="btnAddNews" style="background: #1f52a3;">Add</button>
								<input type="hidden" name="submitted" value="true"/>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!--add news modal END-->
			<!--connect & insert news into database START-->
			<?php			
				if (isset($_POST['submitted'])){
					//connect database
					$dbc = mysqli_connect('localhost', 'root', '');
					//select database
					mysqli_select_db($dbc, 'news');
					
					$problem = FALSE;
					
					if(!empty($_POST['txtNewsTitle']) && !empty($_POST['selectNewsCategory']) && !empty($_POST['txtNewsDetails'])){
						$newsTitle = trim($_POST['txtNewsTitle']);
						$newsDetails = trim($_POST['txtNewsDetails']);
						$newsCategory = trim($_POST['selectNewsCategory']);
						}else{
						echo '<p>Error! Please enter title and details select category!</p>';
						$problem = TRUE;
					}
					
					if(!$problem){
						$query = "INSERT INTO news (news_title, news_details, news_category, news_datetime) 
						VALUES ('$newsTitle', '$newsDetails', '$newsCategory', NOW())";
						if(mysqli_query($dbc, $query)){
							echo '<p>Added successfully!</p>';
							}else{
							echo '<p>Error! '.mysqli_error($dbc).'</p>';
							echo '<p>Query: '.$query.'</p>';
						}
					}
					mysqli_close($dbc);
				}
			?>
			<!--connect & insert news into database END-->
			<!--news table START-->
			<div class="card-deck" style="margin: 15px 50px;">
				<table class="table table-hover bg-light">
					<thead class="thead-light">
						<tr>
							<th scope="col">News ID</th>
							<th scope="col">News Datetime</th>
							<th scope="col">News Title</th>
							<th scope="col">News Details</th>
							<th scope="col">News Category</th>
							<th scope="col">Edit/Delete</th>
						</tr>
					</thead>
					<tbody>
						<!--select news from database START-->
						<?php
							$dbc = mysqli_connect('localhost', 'root', '');
							mysqli_select_db($dbc, 'news');
							
							$query = 'SELECT * FROM news ORDER BY news_id ASC';
							
							if($r = mysqli_query($dbc, $query)){
								while($row = mysqli_fetch_array($r)){
									echo "<tr>
									<th scope=\"row\">{$row['news_id']}</th>
									<td>{$row['news_datetime']}</td>
									<td>{$row['news_title']}</td>
									<td>{$row['news_details']}</td>
									<td>{$row['news_category']}</td>
									<td>
									<button type=\"button\" class=\"btn btn-info\"><i class=\"fas fa-edit\" style=\"font-size: 20px;\"></i></button>
									<button type=\"button\" class=\"btn btn-danger\"><i class=\"fas fa-trash\" style=\"font-size: 20px;\"></i></button>
									</td>
									</tr>";
								}
								}else{
								echo '<p>Error! '.mysqli_error($dbc).'</p>';
							}
							
							mysqli_close($dbc);
						?>
						<!--select news from database END-->
					</tbody>
				</table>
			</div>
			<!--news table END-->
		</div>
	</body>
</html>
<?php

// get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);

// connect to the mysql database
$link = mysqli_connect('localhost', 'user', 'pass', 'dbname');
mysqli_set_charset($link,'utf8');

// retrieve the table and key from the path
$table = preg_replace('/[^a-z0-9_]+/i','',array_shift($request));
$key = array_shift($request)+0;

// escape the columns and values from the input object
$columns = preg_replace('/[^a-z0-9_]+/i','',array_keys($input));
$values = array_map(function ($value) use ($link) {
  if ($value===null) return null;
  return mysqli_real_escape_string($link,(string)$value);
},array_values($input));

// build the SET part of the SQL command
$set = '';
for ($i=0;$i<count($columns);$i++) {
  $set.=($i>0?',':'').'`'.$columns[$i].'`=';
  $set.=($values[$i]===null?'NULL':'"'.$values[$i].'"');
}

// create SQL based on HTTP method
switch ($method) {
  case 'GET':
    $sql = "select * from `$table`".($key?" WHERE id=$key":''); break;
  case 'PUT':
    $sql = "update `$table` set $set where id=$key"; break;
  case 'POST':
    $sql = "insert into `$table` set $set"; break;
  case 'DELETE':
    $sql = "delete `$table` where id=$key"; break;
}

// excecute SQL statement
$result = mysqli_query($link,$sql);

// die if SQL statement failed
if (!$result) {
  http_response_code(404);
  die(mysqli_error());
}

// print results, insert id or affected row count
if ($method == 'GET') {
  if (!$key) echo '[';
  for ($i=0;$i<mysqli_num_rows($result);$i++) {
    echo ($i>0?',':'').json_encode(mysqli_fetch_object($result));
  }
  if (!$key) echo ']';
} elseif ($method == 'POST') {
  echo mysqli_insert_id($link);
} else {
  echo mysqli_affected_rows($link);
}

// close mysql connection
mysqli_close($link);
add_action('wp_head', 'add_gtm');

function add_gtm() {
	?>
	{{INSERT SCRIPT HERE}}
<?php
}

add_action( 'wp_body_open', 'add_gtm_no_script' );

function add_gtm_no_script() {
	?>
	{{INSERT SCRIPT HERE}}
<?php
}
get_posts(array(
    'post_type' => 'quotes',
    'tax_query' => array(
        // get_the_terms() stuff.
    ),
    'order' => 'ASC',
    'posts_per_page' => 5,
    'orderby' => 'rand')
);
?>
function my_error_handler()
{
  $last_error = error_get_last();
  if ($last_error && $last_error['type']==E_ERROR)
      {
        header("HTTP/1.1 500 Internal Server Error");
        echo '...';//html for 500 page
      }
}
register_shutdown_function('my_error_handler');
error_reporting(E_ALL);
ini_set('display_errors', 'on');

function fatal_error_handler($buffer) {
    header('HTTP/1.1 500 Internal Server Error');
    exit(0);
}

function handle_error ($errno, $errstr, $errfile, $errline){
    header('HTTP/1.1 500 Internal Server Error');
    exit(0);
}

ob_start("fatal_error_handler");
set_error_handler("handle_error");

//would normally cause a fatal error, but instead our output handler will be called allowing us to handle the error.
somefunction();
ob_end_flush();
if (!isset($_COOKIE["//cookie//"])){
	...
}
$sgbd=new mysqli("localhost", $user, $pass, "productos");
if (mysqli_connect_errno()){
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
    echo "Connection successful";
}
// Create a new instance of MyObject into $obj
$obj = new MyObject();
// Set a property in the $obj object called thisProperty
$obj->thisProperty = 'Fred';
// Call a method of the $obj object named getProperty
$obj->getProperty();
	function qzr_page_target_meta_box( $post) {
		$qzr_targets = get_terms([
			'taxonomy' => 'qzr_target',
			'hide_empty' => false,
		]);

		$current_targets = get_the_terms($post->ID,'qzr_target');

		if(is_array($current_targets)) {
			$current_term_slug = count($current_targets) > 1? 'all' : $current_targets[0]->slug;
		}
		else {
			$current_term_slug = false;
		}
	?>
		<select name="qzr_target" class="qzr_target">
			<?= !$current_term_slug ? '<option selected disabled>Seleziona un target</option>' : '' ?>
			<?php foreach($qzr_targets as $target): ?>
				<option value="<?= $target->slug?>" <?= $target->slug == $current_term_slug? 'selected' : '' ?>>
				<?= $target->name?>
			</option>	
			<?php endforeach?>
		</select>
		<?php
	}

	function qzr_save_target_meta( $post_id ){
		if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
		return $post_id;
		if(isset($_POST['qzr_target'])) {
			if($_POST['qzr_target'] == 'all') {
				$qzr_targets = get_terms([
					'taxonomy' => 'qzr_target',
					'hide_empty' => false,
				]);
				$all_targets = [];

				foreach($qzr_targets as $target) {
					array_push($all_targets,$target->term_id);
				}
				wp_set_post_terms( $post_id, $all_targets, 'qzr_target' );	
			}
			else {
				$term = get_term_by( 'slug',$_POST['qzr_target'], 'qzr_target' );
				if($term->term_id > 0) {
					wp_set_post_terms( $post_id, array( $term->term_id ), 'qzr_target' );
				}
			}
		}
	}
	add_action( 'save_post', 'qzr_save_target_meta', 10, 2 );

	function qzr_post_target_meta() {
		add_meta_box( 'qzr_page_target', 'Target', 'qzr_page_target_meta_box','page','side','high' );
		add_meta_box( 'qzr_page_target', 'Target', 'qzr_page_target_meta_box','post','side','high' );
		add_meta_box( 'qzr_page_target', 'Target', 'qzr_page_target_meta_box','project','side','high' );
	}
	add_action( 'admin_init', 'qzr_post_target_meta' );
foreach($array as $key => $element) {
    if ($key === array_key_first($array))
        echo 'FIRST ELEMENT!';

    if ($key === array_key_last($array))
        echo 'LAST ELEMENT!';
}
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
    <!-- Primary Navigation Menu -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div class="flex justify-between h-16">
            <div class="flex">
                <!-- Logo -->
                <div class="flex-shrink-0 flex items-center">
                    <a href="{{ route('dashboard') }}">
                        <x-jet-application-mark class="block h-9 w-auto" />
                    </a>
                </div>

                <!-- Navigation Links -->
                <div class=" space-x-8 sm:-my-px sm:ml-10 sm:flex">
                    <x-jet-nav-link href="{{ route('dashboard') }}" :active="request()->routeIs('dashboard')">
                        {{ __('Dashboard') }}
                    </x-jet-nav-link>
                </div>
            </div>

            <!-- Settings Dropdown -->
            <div class=" sm:flex sm:items-center sm:ml-6">
                <x-jet-dropdown align="right" width="48">
                    <x-slot name="trigger">
                         @if (Laravel\Jetstream\Jetstream::managesProfilePhotos())
                            <button class="flex text-sm border-2 border-transparent rounded-full focus:outline-none focus:border-gray-300 transition duration-150 ease-in-out">
                                <img class="h-8 w-8 rounded-full object-cover" src="{{ Auth::user()->profile_photo_url }}" alt="{{ Auth::user()->name }}" />
                            </button>
                         @else
                            <button class="flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
                                <div>{{ Auth::user()->name }}</div>

                                <div class="ml-1">
                                    <svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
                                        <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
                                    </svg>
                                </div>
                            </button>
                        @endif
                    </x-slot>

                    <x-slot name="content">
                        <!-- Account Management -->
                        <div class="block px-4 py-2 text-xs text-gray-400">
                            {{ __('Manage Account') }}
                        </div>

                        <x-jet-dropdown-link href="{{ route('profile.show') }}">
                            {{ __('Profile') }}
                        </x-jet-dropdown-link>

                        @if (Laravel\Jetstream\Jetstream::hasApiFeatures())
                            <x-jet-dropdown-link href="{{ route('api-tokens.index') }}">
                                {{ __('API Tokens') }}
                            </x-jet-dropdown-link>
                        @endif

                        <div class="border-t border-gray-100"></div>

                        <!-- Team Management -->
                        @if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
                            <div class="block px-4 py-2 text-xs text-gray-400">
                                {{ __('Manage Team') }}
                            </div>

                            <!-- Team Settings -->
                            <x-jet-dropdown-link href="{{ route('teams.show', Auth::user()->currentTeam->id) }}">
                                {{ __('Team Settings') }}
                            </x-jet-dropdown-link>

                            @can('create', Laravel\Jetstream\Jetstream::newTeamModel())
                                <x-jet-dropdown-link href="{{ route('teams.create') }}">
                                    {{ __('Create New Team') }}
                                </x-jet-dropdown-link>
                            @endcan

                            <div class="border-t border-gray-100"></div>

                            <!-- Team Switcher -->
                            <div class="block px-4 py-2 text-xs text-gray-400">
                                {{ __('Switch Teams') }}
                            </div>

                            @foreach (Auth::user()->allTeams() as $team)
                                <x-jet-switchable-team :team="$team" />
                            @endforeach

                            <div class="border-t border-gray-100"></div>
                        @endif

                        <!-- Authentication -->
                        <form method="POST" action="{{ route('logout') }}">
                            @csrf

                            <x-jet-dropdown-link href="{{ route('logout') }}"
                                                onclick="event.preventDefault();
                                                            this.closest('form').submit();">
                                {{ __('Logout') }}
                            </x-jet-dropdown-link>
                        </form>
                    </x-slot>
                </x-jet-dropdown>
            </div>

            <!-- Hamburger -->
            <div class="-mr-2 flex items-center sm:hidden">
                <button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
                    <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
                        <path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
                        <path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
                    </svg>
                </button>
            </div>
        </div>
    </div>

    <!-- Responsive Navigation Menu -->
    <div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
        <div class="pt-2 pb-3 space-y-1">
            <x-jet-responsive-nav-link href="{{ route('dashboard') }}" :active="request()->routeIs('dashboard')">
                {{ __('Dashboard') }}
            </x-jet-responsive-nav-link>
        </div>

        <!-- Responsive Settings Options -->
        <div class="pt-4 pb-1 border-t border-gray-200">
            <div class="flex items-center px-4">
                <div class="flex-shrink-0">
                    <img class="h-10 w-10 rounded-full" src="{{ Auth::user()->profile_photo_url }}" alt="{{ Auth::user()->name }}" />
                </div>

                <div class="ml-3">
                    <div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
                    <div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
                </div>
            </div>

            <div class="mt-3 space-y-1">
                <!-- Account Management -->
                <x-jet-responsive-nav-link href="{{ route('profile.show') }}" :active="request()->routeIs('profile.show')">
                    {{ __('Profile') }}
                </x-jet-responsive-nav-link>

                @if (Laravel\Jetstream\Jetstream::hasApiFeatures())
                    <x-jet-responsive-nav-link href="{{ route('api-tokens.index') }}" :active="request()->routeIs('api-tokens.index')">
                        {{ __('API Tokens') }}
                    </x-jet-responsive-nav-link>
                @endif

                <!-- Authentication -->
                <form method="POST" action="{{ route('logout') }}">
                    @csrf

                    <x-jet-responsive-nav-link href="{{ route('logout') }}"
                                    onclick="event.preventDefault();
                                                this.closest('form').submit();">
                        {{ __('Logout') }}
                    </x-jet-responsive-nav-link>
                </form>

                <!-- Team Management -->
                @if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
                    <div class="border-t border-gray-200"></div>

                    <div class="block px-4 py-2 text-xs text-gray-400">
                        {{ __('Manage Team') }}
                    </div>

                    <!-- Team Settings -->
                    <x-jet-responsive-nav-link href="{{ route('teams.show', Auth::user()->currentTeam->id) }}" :active="request()->routeIs('teams.show')">
                        {{ __('Team Settings') }}
                    </x-jet-responsive-nav-link>

                    <x-jet-responsive-nav-link href="{{ route('teams.create') }}" :active="request()->routeIs('teams.create')">
                        {{ __('Create New Team') }}
                    </x-jet-responsive-nav-link>

                    <div class="border-t border-gray-200"></div>

                    <!-- Team Switcher -->
                    <div class="block px-4 py-2 text-xs text-gray-400">
                        {{ __('Switch Teams') }}
                    </div>

                    @foreach (Auth::user()->allTeams() as $team)
                        <x-jet-switchable-team :team="$team" component="jet-responsive-nav-link" />
                    @endforeach
                @endif
            </div>
        </div>
    </div>
</nav>
"repositories": {
        "webdevmatics/jetstream" : {
            "type": "path",
            "url": "C:\\laragon\\www\\codegenerator\\packages/webdevmatics/jetstream"
        }
    }
<html lang="en">
	<head>
		<!--using external files-->
		<?php require('import.html') ?>
		
		<title>U Chen Daily | Home</title>
	</head>
	<style>
		@media only screen and (min-width: 893px) {
		.card-img-top{
		width: 100%;
		height: 15vw; 
		object-fit: cover;
		}
		}
		
		.card-body{
		background: #1f52a3;
		}
		
		.card-footer{
		background: #1f52a3;
		}
		
		.h5{
		color: #1f52a3;
		}
		
		.card-text{
		font-size: 12px;
		}
	</style>
	<body class="bg-light">
		<!--using external files-->
		<?php require('header.php'); ?>
		<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
			<ol class="carousel-indicators">
				<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
				<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
				<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
			</ol>
			<div class="carousel-inner">
				<div class="carousel-item active">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>First slide label</h5>
						<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
					</div>
				</div>
				<div class="carousel-item">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>Second slide label</h5>
						<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
					</div>
				</div>
				<div class="carousel-item">
					<img src="https://via.placeholder.com/1500x550" class="d-block w-100" alt="...">
					<div class="carousel-caption d-none d-sm-block">
						<h5>Third slide label</h5>
						<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
					</div>
				</div>
			</div>
			<a class="carousel-control-prev" href="#carouselExampleCaptions" role="button" data-slide="prev">
				<span class="carousel-control-prev-icon" aria-hidden="true"></span>
				<span class="sr-only">Previous</span>
			</a>
			<a class="carousel-control-next" href="#carouselExampleCaptions" role="button" data-slide="next">
				<span class="carousel-control-next-icon" aria-hidden="true"></span>
				<span class="sr-only">Next</span>
			</a>
		</div>
		<!--4 latest news START-->
		<div class="container-fluid bg-light" style="padding: 40px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-6">
					<h5 style="color: #1f52a3;">Latest News</h5>
				</div>
				
				<div class="col-6 d-flex justify-content-end">
					<a href="" class="btn btn-link font-weight-bold" style="color: #1f52a3;">MORE NEWS <i class="fas fa-angle-double-right" style="font-size: 18px;"></i></a>
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 latest news END-->
		<!--4 nation news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">Nation News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="Nation" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php	
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 nation news END-->
		<!--4 world news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">World News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="World" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 world news END-->
		<!--4 entertainment news START-->
		<div class="container-fluid bg-light" style="padding: 20px 0 0; margin-bottom: 40px;">
			<div class="row" style="margin: 0 50px;">
				<div class="col-sm">
					<h5 style="color: #1f52a3;">Entertainment News</h5>
				</div>
				<div class="col-sm">
				</div>
				<div class="col-sm">
				</div>
			</div>
			
			<div class="card-deck" style="margin: 10px 50px;">
				<?php
					$dbc = mysqli_connect('localhost', 'root', '');	//connect database
					mysqli_select_db($dbc, 'news');	//select database
					
					$query = 'SELECT * FROM news WHERE news_category="Entertainment" ORDER BY news_datetime DESC LIMIT 4';
					$runQuery = mysqli_query($dbc, $query);
				?>
				<!--news card START-->
				<?php
					if($runQuery){
						foreach($runQuery as $row){
						?>
						<div class="card mb-4">
							<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id'] ?>">
								<img class="card-img-top" 
								src="<?php 
									if(empty($row['news_image'])){
										echo 'https://via.placeholder.com/350x250';
										}else{
										echo $row['news_image'];
									}
								?>" alt="Card image cap">
							</a>
							<div class="card-body">
								<a href="/205CDE/Assignment/news.php?id=<?php echo $row['news_id']; ?>">
									<h5 class="card-title text-uppercase text-light d-md-none d-lg-block">
										<?php 
											if(strlen($row['news_title']) > 50){
												echo substr($row['news_title'], 0, 50).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
									<h5 class="card-title text-uppercase text-light d-none d-md-block d-lg-none">
										<?php 
											if(strlen($row['news_title']) > 106){
												echo substr($row['news_title'], 0, 106).'...';
												}else{
												echo $row['news_title'];
											}
										?>
									</h5>
								</a>
							</div>
							<div class="card-footer border-0">
								<div class="row">
									<div class="col-6 card-text text-light text-uppercase"><i class="fas fa-hashtag"></i>
										<?php echo $row['news_category']; ?>
									</div>
									<div class="col-6 card-text text-light text-right text-uppercase"><i class="far fa-clock"></i>
										<?php echo date('d-M-Y', strtotime($row['news_datetime']));?>
									</div>
								</div>
							</div>
						</div>
						<div class="w-100 d-none d-sm-block d-lg-none"><!-- wrap every 2 on sm--></div>
						<?php
						}
						}else{
						echo "ERROR! No record found!";
					}
					mysqli_close($dbc);
				?>
				<!--news card END-->
			</div>
		</div>
		<!--4 entertainment news END-->
		<!--using external files-->
		<?php require('footer.html'); ?>
	</body>
</html>				
function add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
}
add_action('upload_mimes', 'add_file_types_to_uploads');
$query = new ProductSearchQuery();
        $query
            ->setQueryType('prices-drop')
            ->setSortOrder(new SortOrder('product', 'name', 'asc'));

        return $query;
$table = $html->find('table', 0); // ID LOCK IE TABLE 0 (first table) Get the first table ??
foreach($table ->find('tr') as $tr) {     // Foreach row in the table!
    if($td = $tr->find('td', 0)) {
        $Ex_Date = $td->plaintext; // Find the first TD (starts with 0)
        // ... and so on for each variable
  $(document).ready(function() {

        $('#check').on('submit', function(e) {
            e.preventDefault();

            $('#sub').prop('disable', true)
            $('#sub').text('Checking');
            $.ajax({
                url: '/home/checkorderstatus',
                method: 'POST',
                contentType: false,
                processData: false,
                cache: false,
                data: new FormData(this),
                success: function(data) {
                    $('#success').slideDown('slow').html(data);

                }
            });


            $(document).ajaxComplete(function() {
                $('#sub').prop('disabled', false)
                $('#sub').html('<i class="fa fa-search"></i>')
                $('#check').trigger("reset");
            })

            setTimeout(function() {
                $('#success').hide('slow')
            }, 3000)
        })


    })
<?php

add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');

function my_theme_enqueue_styles()
{
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style'));
    wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/path/to/script.js', '', '', true );
}
       $pic = $this->request->getFile('image');
            if ($pic->isValid()) {
                //let set the rules
                $profile_pic = [
                    'photo' => [
                        'label' => 'Image', 'rules' => 'uploaded[image]|max_size[image,2048]|is_image[image]',
                        'errors' => [
                            'max_size' => 'The uploaded image not accepted',
                            'is_image' => 'Image format not accepted'
                        ]
                    ]
                ];

                //now let validate the picture
                if (!$this->validate($profile_pic)) {
                    //let store the error here
                    $errors = array(
                        'error' => $validation->listErrors('error_msg')
                    );
                    //show the error
                    session()->setFlashdata($errors);
                    return redirect()->back()->withInput();
                } else {
                    //this is to get random
                    $name = $pic->getRandomName();
                    $pic->move('./assets/images/blog/', $name);
                }
$ip =   "127.0.0.1";
exec("ping -n 3 $ip", $output, $status);
print_r($output);
function recursiveFind(array $haystack, $needle)
{
    $iterator  = new RecursiveArrayIterator($haystack);
    $recursive = new RecursiveIteratorIterator(
        $iterator,
        RecursiveIteratorIterator::SELF_FIRST
    );
    foreach ($recursive as $key => $value) {
        if ($key === $needle) {
            yield $value;
        }
    }
}

// Usage
foreach (recursiveFind($haystack, $needle) as $value) {
    // Use `$value` here
}
function replace_accents($str) {
   $str = htmlentities($str, ENT_COMPAT, "UTF-8");
   $str = preg_replace('/&([a-zA-Z])(uml|acute|grave|circ|tilde);/','$1',$str);
   return html_entity_decode($str);
}
function extract_emails_from($string) {
         preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
         return $matches[0];
}
<?php

  $var1 = 'nameOfVariable';

  $nameOfVariable = 'This is the value I want!';

  echo $$var1; 

?>
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
     $ip=$_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
     $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
     $ip=$_SERVER['REMOTE_ADDR'];
}
<?php 
  
function startsWith($string, $startString) { 
  $len = strlen($startString); 
  return (substr($string, 0, $len) === $startString); 
} 

// usage
echo startsWith("cat", "c"); // true
echo startsWith("dog", "x"); // false

?> 
SELECT * FROM tableName WHERE timeColumn > UNIX_TIMESTAMP( date_sub(now(),interval 1 week)) and UserName = 'givenUserName'
<?php
/**
 * Titlebar template.
 *
 * @author     ThemeFusion
 * @copyright  (c) Copyright by ThemeFusion
 * @link       https://theme-fusion.com
 * @package    Avada
 * @subpackage Core
 */

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'Direct script access denied.' );
}
?>
<?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
<div class="fusion-page-title-bar fusion-page-title-bar-<?php echo esc_attr( $content_type ); ?> fusion-page-title-bar-<?php echo esc_attr( $alignment ); ?>" style="background: url('<?php echo $backgroundImg[0]; ?>') no-repeat center center; ">
	<div class="fusion-page-title-row">
		<div class="fusion-page-title-wrapper">
			<div class="fusion-page-title-captions">

				<?php if ( $title ) : ?>
					<?php // Add entry-title for rich snippets. ?>
					<?php $entry_title_class = ( Avada()->settings->get( 'disable_date_rich_snippet_pages' ) && Avada()->settings->get( 'disable_rich_snippet_title' ) ) ? 'entry-title' : ''; ?>
					<h1 class="<?php echo esc_attr( $entry_title_class ); ?>"><?php echo $title; // phpcs:ignore WordPress.Security.EscapeOutput ?></h1>

					<?php if ( $subtitle ) : ?>
						<h3><?php echo $subtitle; // phpcs:ignore WordPress.Security.EscapeOutput ?></h3>
					<?php endif; ?>
				<?php endif; ?>

				<?php if ( 'center' === $alignment ) : // Render secondary content on center layout. ?>
					<?php if ( 'none' !== fusion_get_option( 'page_title_bar_bs' ) ) : ?>
						<div class="fusion-page-title-secondary">
							<?php echo $secondary_content; // phpcs:ignore WordPress.Security.EscapeOutput ?>
						</div>
					<?php endif; ?>
				<?php endif; ?>

			</div>

			<?php if ( 'center' !== $alignment ) : // Render secondary content on left/right layout. ?>
				<?php if ( 'none' !== fusion_get_option( 'page_title_bar_bs' ) ) : ?>
					<div class="fusion-page-title-secondary">
						<?php echo $secondary_content; // phpcs:ignore WordPress.Security.EscapeOutput ?>
					</div>
				<?php endif; ?>
			<?php endif; ?>

		</div>
	</div>
</div>
<!DOCTYPE html>
<html>

<head>
    <title>My MySQL Form</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
</head>

<body>
<?php

require 'helpers/connect.php';
$form = "<form>";

$result = $conn->query("describe codewalldb.people");

if ($result->num_rows > 0) {
    // output data of each row
    while ($row = $result->fetch_assoc()) {
        if ($row["Field"] != "id") {
            $form .= "<div class='form-group'>";
            $form .= "<label for='" . $row["Field"] . "'>" . $row["Field"] . "</label> <input type='text' class='form-control' name='" . $row["Field"] . "' >";
            $form .= "</div>";
        }
    }
    $form .= "<input type='submit' value='Submit'></form>";
}

echo $form;
?>

</body>

</html>
Copy
$servername = "localhost";
$username = "codewall";
$password = "password";

// Create connection
$conn = mysqli_connect($servername, $username, $password);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
Copy
add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'font-awesome' ); }, 50 );
add_action( 'elementor/frontend/after_enqueue_styles', function () { wp_dequeue_style( 'font-awesome' ); } );
/**
 * Change number of products that are displayed per page (shop page)
 */
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );

function new_loop_shop_per_page( $cols ) {
  // $cols contains the current number of products per page based on the value stored on Options -> Reading
  // Return the number of products you wanna show per page.
  $cols = 9;
  return $cols;
}
<?php 
    
    $rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
    $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
    
?>
<?php
  $gravatar_link = 'http://www.gravatar.com/avatar/' . md5($comment_author_email) . '?s=32';
   echo '<img src="' . $gravatar_link . '" />';
?>
function replace_accents($str) {
   $str = htmlentities($str, ENT_COMPAT, "UTF-8");
   $str = preg_replace('/&([a-zA-Z])(uml|acute|grave|circ|tilde);/','$1',$str);
   return html_entity_decode($str);
}
<?php 
  
function startsWith($string, $startString) { 
  $len = strlen($startString); 
  return (substr($string, 0, $len) === $startString); 
} 

// usage
echo startsWith("cat", "c"); // true
echo startsWith("dog", "x"); // false

?> 
function encrypt($key, $plain, $salt = null)
    {
        echo $key;
    $plain = serialize(array( $plain, $salt ));

    $crypt = mcrypt_module_open('rijndael-256', '', 'ofb', '');

    if (false !== stripos(PHP_OS, 'win') and 
        version_compare(PHP_VERSION, '5.3.0')  == -1) 
    {
        $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypt), MCRYPT_RAND);    
    }
    else
    {
        $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypt), MCRYPT_DEV_URANDOM);
    }

    $ks = mcrypt_enc_get_key_size($crypt);

    $key = substr(md5($key), 0, $ks);
    echo strlen($key);
    mcrypt_generic_init($crypt, $key, $iv);
    $encrypted = base64_encode($iv . mcrypt_generic($crypt, $plain));
    mcrypt_generic_deinit($crypt);
    mcrypt_module_close($crypt);

    return $encrypted;
}
<?php
  $gravatar_link = 'http://www.gravatar.com/avatar/' . md5($comment_author_email) . '?s=32';
   echo '<img src="' . $gravatar_link . '" />';
?>
function startsWith($string, $startString) {
  return strncmp($string, $startString, strlen($startString)) === 0;
}
<?php

add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 );
add_filter('woocommerce_coupon_error', 'rename_coupon_label', 10, 3);
add_filter('woocommerce_coupon_message', 'rename_coupon_label', 10, 3);
add_filter('woocommerce_cart_totals_coupon_label', 'rename_coupon_label',10, 1);
add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' );


function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) {
	// bail if not modifying frontend woocommerce text
	if ( is_admin() || 'woocommerce' !== $text_domain ) {
		return $translated_text;
	}
	if ( 'Coupon:' === $text ) {
		$translated_text = 'Voucher:';
	}

	if ('Coupon has been removed.' === $text){
		$translated_text = 'Voucher has been removed.';
	}

	if ( 'Apply coupon' === $text ) {
		$translated_text = 'Apply voucher';
	}

	if ( 'Coupon code' === $text ) {
		$translated_text = 'Voucher';
	
	} 

	return $translated_text;
}


// rename the "Have a Coupon?" message on the checkout page
function woocommerce_rename_coupon_message_on_checkout() {
	return 'Have a voucher?' . ' ' . __( 'Enter your voucher code', 'woocommerce' ) . '';
}


function rename_coupon_label($err, $err_code=null, $something=null){

	$err = str_ireplace("Coupon","Voucher ",$err);

	return $err;
}

?>
// assuming file.zip is in the same directory as the executing script.
$file = 'file.zip';

// get the absolute path to $file
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);

$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
  // extract it to the path we determined above
  $zip->extractTo($path);
  $zip->close();
  echo "WOOT! $file extracted to $path";
} else {
  echo "Doh! I couldn't open $file";
}
DB::transaction(function () {
    DB::table('users')->update(['votes' => 1]);

    DB::table('posts')->delete();
}, 5);
<?php
/**
 * Template Name: Archive Album
 * Album Post type archive page.
 * *
 * @package Avada
 * @subpackage Templates
 */

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'Direct script access denied.' );
}
?>
<?php get_header(); ?>
<section id="content" <?php Avada()->layout->add_class( 'content_class' ); ?> <?php Avada()->layout->add_style( 'content_style' ); ?>>
	<?php if ( category_description( 'album' ) ) : ?>
		<div id="post-<?php the_ID(); ?>" <?php post_class( 'fusion-archive-description' ); ?>>
			<div class="post-content">
				<?php echo category_description(); ?>
			</div>
		</div>
	<?php endif; ?>

	<?php get_template_part( 'templates/blog', 'layout' ); ?>
</section>
<?php do_action( 'avada_after_content' ); ?>
<?php
get_footer();

/* Omit closing PHP tag to avoid "Headers already sent" issues. */
/**
 * Add Album post type
 * 
 */
function create_posttype() {
 
    register_post_type( 'album',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'album' ),
                'singular_name' => __( 'album' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'album'),
        )
    );
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

/**
 * Show Album post type with Blog pages
 * 
 */
add_filter( 'pre_get_posts', 'my_get_posts' );

function my_get_posts( $query ) {

	if ( is_home() && $query->is_main_query() )
		$query->set( 'post_type', array( 'post', 'album') );

	return $query;
}
UPDATE TABLE_NAME
SET COL_NAME = REPLACE(COL_NAME, 'OLD_URL/', 'NEW_URL/') where 1
add_filter( 'woocommerce_available_payment_gateways', 'conditionally_disable_cod_payment_method', 10, 1);
function conditionally_disable_cod_payment_method( $gateways ){
    // HERE define your Products IDs
    $products_ids = array(2880);

    // Loop through cart items
    foreach ( WC()->cart->get_cart() as $cart_item ){
        // Compatibility with WC 3+
        $product_id = version_compare( WC_VERSION, '3.0', '<' ) ? $cart_item['data']->id : $cart_item['data']->get_id();
        if (in_array( $cart_item['product_id'], $products_ids ) ){
            unset($gateways['cod']);
            break; // As "COD" is removed we stop the loop
        }
    }
    return $gateways;
}
$myDateTime = DateTime::createFromFormat('Y-m-d', $dateString);
$newDateString = $myDateTime->format('m/d/Y');
<?php 
function count_num_finger( $n ) 
{ 
	$r = $n % 8; 
	if ($r == 1) 
		return $r; 
	if ($r == 5) 
		return $r; 
	if ($r == 0 or $r == 2) 
		return 2; 
	if ($r == 3 or $r == 7) 
		return 3; 
	if ($r == 4 or $r == 6) 
		return 4; 
}	 

// Driver Code 
$n = 30; 
echo(count_num_finger($n)); 
 
?> 
<?php 
// PHP program to find nth 
// magic number 

// Function to find nth 
// magic number 
function nthMagicNo($n) 
{ 
	$pow = 1; 
	$answer = 0; 

	// Go through every bit of n 
	while ($n) 
	{ 
	$pow = $pow * 5; 

	// If last bit of n is set 
	if ($n & 1) 
		$answer += $pow; 

	// proceed to next bit 
	$n >>= 1; // or $n = $n/2 
	} 
	return $answer; 
} 

// Driver Code 
$n = 5; 
echo "nth magic number is ", 
	nthMagicNo($n), "\n"; 

// This code is contributed by Ajit. 
?> 
$path = $_FILES['image']['name'];
$ext = pathinfo($path, PATHINFO_EXTENSION);
star

Fri Mar 08 2024 12:45:12 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Mar 04 2024 11:55:50 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Mar 03 2024 13:21:49 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 29 2024 10:53:47 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Feb 28 2024 10:22:57 GMT+0000 (Coordinated Universal Time)

#html #php #javascript
star

Wed Feb 28 2024 07:16:18 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Feb 25 2024 10:34:37 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Feb 21 2024 07:55:51 GMT+0000 (Coordinated Universal Time)

#blade #php #laravel #html #livewire #alpinejs
star

Wed Feb 14 2024 15:00:19 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Feb 12 2024 13:58:13 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Mon Feb 12 2024 07:55:29 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Sat Feb 10 2024 13:38:29 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 08 2024 11:43:41 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 08 2024 11:28:13 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 08 2024 11:27:12 GMT+0000 (Coordinated Universal Time)

#jquery #php
star

Thu Feb 08 2024 07:20:10 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 23 2024 09:50:08 GMT+0000 (Coordinated Universal Time)

#javascript #php
star

Sat Jan 20 2024 02:05:07 GMT+0000 (Coordinated Universal Time) https://github.com/LaravelDaily/laravel-tips/blob/master/artisan.md

#laravel #php #artisan #tips
star

Sat Jan 20 2024 02:03:22 GMT+0000 (Coordinated Universal Time) https://github.com/LaravelDaily/laravel-tips/blob/master/api.md

#php #laravel #api #api_tips #tips
star

Sat Jan 20 2024 01:44:36 GMT+0000 (Coordinated Universal Time) https://github.com/LaravelDaily/Laravel-Travel-API-Course/blob/main/app/Http/Controllers/Api/V1/TourController.php

#laravel #php #filtering #search #eloquent
star

Fri Jan 19 2024 15:14:52 GMT+0000 (Coordinated Universal Time)

#php #laravel #selectall
star

Thu Jan 18 2024 10:06:32 GMT+0000 (Coordinated Universal Time) https://www.orioninfosolutions.com/poker-game-development.php

#poker #software #php #html #css #design
star

Tue Jan 16 2024 15:17:37 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jan 04 2024 11:05:57 GMT+0000 (Coordinated Universal Time) https://www.twilio.com/blog/image-compression-in-laravel

#php
star

Thu Jan 04 2024 11:05:44 GMT+0000 (Coordinated Universal Time) https://www.twilio.com/blog/image-compression-in-laravel

#php
star

Wed Jan 03 2024 05:51:05 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Dec 19 2023 05:29:57 GMT+0000 (Coordinated Universal Time) https://xtemos.com/forums/topic/add-year-in-post-date/

#php
star

Thu Dec 14 2023 11:42:09 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/69294670/how-to-merge-2-pdf-in-mpdf-using-php-laravel

#php
star

Mon Dec 11 2023 14:02:36 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Mon Dec 11 2023 14:02:34 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri Dec 08 2023 12:19:13 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Dec 04 2023 13:21:17 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Thu Nov 30 2023 14:49:15 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=4Dko5W96WHg

#php #poo #mvc #jquery #postgresql
star

Thu Nov 30 2023 13:54:18 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Wed Nov 29 2023 18:22:44 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Mon Nov 27 2023 07:13:43 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Nov 26 2023 08:25:05 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/94364/set-post-title-from-two-meta-fields

#php
star

Sun Nov 26 2023 07:55:25 GMT+0000 (Coordinated Universal Time) https://metabox.io/build-hotel-booking-web-use-meta-box-p2/

#php
star

Sat Nov 25 2023 10:06:01 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/plugins/taxonomies/working-with-custom-taxonomies/

#php
star

Sat Nov 25 2023 10:05:09 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/plugins/post-types/working-with-custom-post-types/

#php
star

Tue Nov 07 2023 19:39:51 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Tue Nov 07 2023 17:46:31 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=6qiOsJIliIo

#php #poo #mvc #jquery #postgresql
star

Thu Nov 02 2023 15:24:28 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Tue Oct 24 2023 04:46:28 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 21 2023 14:52:30 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Oct 18 2023 06:36:26 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Oct 18 2023 06:34:08 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Oct 12 2023 15:09:02 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Oct 09 2023 13:41:04 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Thu Oct 05 2023 16:55:36 GMT+0000 (Coordinated Universal Time) https://html.spec.whatwg.org/multipage/introduction.html#abstract

#php #poo #mvc #jquery #postgresql
star

Tue Oct 03 2023 15:14:56 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Oct 03 2023 11:13:35 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Oct 02 2023 05:28:38 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Sep 30 2023 05:45:52 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Sep 26 2023 08:51:12 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Sep 26 2023 05:47:43 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Sep 25 2023 19:53:13 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/48220709/how-to-safely-remove-laravel-debugbar

#php
star

Thu Sep 21 2023 04:40:11 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Sep 18 2023 10:58:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/68706922/laravel-8-npm-run-dev-error-unknown-option-hide-modules

#php
star

Mon Sep 18 2023 10:00:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/68706922/laravel-8-npm-run-dev-error-unknown-option-hide-modules

#php
star

Sun Sep 17 2023 13:09:11 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Sep 16 2023 05:16:29 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Sep 15 2023 17:17:27 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Thu Sep 14 2023 20:08:27 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Wed Sep 13 2023 14:45:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/57674334/laravel-how-to-include-schema-org-structured-data-on-multiple-pages

#php
star

Fri Sep 08 2023 05:40:55 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Sep 06 2023 17:07:49 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Wed Sep 06 2023 13:05:04 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Wed Sep 06 2023 05:59:28 GMT+0000 (Coordinated Universal Time) https://geniuscourses.com/как-на-woocommerce-задать-скидку-в-процентах/

#php
star

Mon Sep 04 2023 18:48:48 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Aug 30 2023 09:33:30 GMT+0000 (Coordinated Universal Time)

#laravel #php
star

Wed Aug 30 2023 06:53:30 GMT+0000 (Coordinated Universal Time) https://www.zoho.com/deluge/help/people/fetch-records.html

#php
star

Fri Aug 25 2023 08:08:20 GMT+0000 (Coordinated Universal Time)

#php #email
star

Mon Aug 21 2023 20:24:56 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/16978227/append-at-the-beginning-of-the-file-in-php

#php
star

Mon Aug 21 2023 20:24:38 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1760525/need-to-write-at-beginning-of-file-with-php

#php
star

Thu Aug 17 2023 15:51:03 GMT+0000 (Coordinated Universal Time) https://www.codinguru.online

#compiler #javascript #php #c++ #python #html
star

Thu Aug 17 2023 15:45:11 GMT+0000 (Coordinated Universal Time) https://www.codinguru.online/compiler/php

#php #compiler #codinguru
star

Fri Aug 11 2023 07:27:15 GMT+0000 (Coordinated Universal Time)

#html #css #javascript #php
star

Mon Aug 07 2023 19:15:36 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Aug 07 2023 10:04:19 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 07 2023 06:01:42 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/extension/initializing?newuser

#vb.net #tag #1pm #php
star

Sat Aug 05 2023 19:11:03 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jul 31 2023 12:02:53 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jul 24 2023 19:05:27 GMT+0000 (Coordinated Universal Time) https://youtu.be/8uYSLxJbPEY?t=1436

#php
star

Fri Jul 14 2023 12:24:38 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/62786231/how-can-we-display-current-user-display-name-with-shortcode

#php
star

Wed Jul 12 2023 17:45:30 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Wed Jul 12 2023 17:45:16 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Tue Jul 11 2023 01:03:58 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=zZ6vybT1HQs&t=11097s

#php
star

Mon Jul 10 2023 23:06:28 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=zZ6vybT1HQs&t=10763s

#php
star

Mon Jul 10 2023 00:58:55 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=zZ6vybT1HQs&t=9870s

#php
star

Sun Jul 09 2023 02:43:12 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v=zZ6vybT1HQs

#php
star

Thu Jul 06 2023 16:50:33 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Tue Jul 04 2023 10:31:54 GMT+0000 (Coordinated Universal Time)

#php #jquery
star

Thu Jun 29 2023 14:18:16 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jun 29 2023 08:43:39 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Jun 25 2023 10:58:08 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/8215979/php-random-x-digit-number

#php
star

Sun Jun 11 2023 04:37:53 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/30408882/wordpress-add-filtercron-schedules-not-working-in-a-php-class

#php
star

Thu Jun 08 2023 15:11:49 GMT+0000 (Coordinated Universal Time)

#php #poo #mvc #jquery #postgresql
star

Thu Jun 08 2023 14:34:22 GMT+0000 (Coordinated Universal Time)

#wordpress #config #nginx #apache #php
star

Tue Jun 06 2023 17:30:48 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/28954168/how-to-use-class-methods-as-callbacks

#php
star

Tue Jun 06 2023 16:02:00 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jun 05 2023 04:11:42 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/106973/wp-insert-post-or-similar-for-custom-post-type

#php
star

Sun Jun 04 2023 15:25:02 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/106973/wp-insert-post-or-similar-for-custom-post-type

#php
star

Sun Jun 04 2023 15:23:21 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/72266190/difference-between-php-and

#php
star

Sun Jun 04 2023 15:23:16 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/72266190/difference-between-php-and

#php
star

Sun Jun 04 2023 15:22:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1993409/operator-the-elvis-operator-in-php

#php
star

Sun Jun 04 2023 06:14:30 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/64371962/wordpress-wp-insert-post-is-creating-new-taxonomy-term-when-creating-new-custom

#php
star

Fri May 26 2023 17:14:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/67227913/laravel-api-request-unauthorized

#php
star

Mon May 22 2023 11:13:29 GMT+0000 (Coordinated Universal Time)

#php
star

Fri May 19 2023 13:09:20 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 17 2023 15:42:25 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 17 2023 13:42:26 GMT+0000 (Coordinated Universal Time)

#php
star

Tue May 16 2023 15:12:57 GMT+0000 (Coordinated Universal Time)

#php
star

Mon May 15 2023 23:27:23 GMT+0000 (Coordinated Universal Time)

#php
star

Mon May 15 2023 23:21:19 GMT+0000 (Coordinated Universal Time)

#php
star

Fri May 12 2023 14:42:36 GMT+0000 (Coordinated Universal Time) https://romanmiranda.com/wordpress-snippet-change-users-role-by-username/

#php #wordpress
star

Fri May 12 2023 14:18:45 GMT+0000 (Coordinated Universal Time) http://192.168.4.192/framework.php

#php
star

Fri May 12 2023 14:11:19 GMT+0000 (Coordinated Universal Time) http://192.168.4.192/framework.php

#php
star

Fri May 12 2023 13:52:53 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Wed May 10 2023 08:39:52 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 10 2023 06:48:04 GMT+0000 (Coordinated Universal Time)

#php
star

Tue May 09 2023 14:05:07 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Sun May 07 2023 18:04:06 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/61450239/laravel-passport-to-return-403-error-instead-of-routelogin

#php
star

Sat May 06 2023 15:07:28 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Mon May 01 2023 20:08:28 GMT+0000 (Coordinated Universal Time) https://forums.digitalpoint.com/threads/how-to-convert-seconds-to-minutes.531022/

#php
star

Sat Apr 29 2023 17:04:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/57912963/upload-multiple-files-at-the-same-time-without-a-duplicate-in-laravel

#php
star

Fri Apr 28 2023 13:25:21 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/69455572/delete-rows-older-than-30-days-using-laravel-eloquent-orm

#php
star

Fri Apr 28 2023 05:27:01 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/6079479/how-to-get-the-absolute-path-to-the-public-html-folder

#php
star

Fri Apr 28 2023 05:26:43 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/25780085/copy-all-files-from-one-folder-to-another-folder-using-php-scripts

#php
star

Wed Apr 26 2023 09:27:24 GMT+0000 (Coordinated Universal Time) https://mintedempire.com/add-a-last-updated-column-to-the-wp-backend/

#php
star

Sat Apr 22 2023 08:14:14 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/48510683/laravel-how-to-revert-local-storage-symlink-and-refresh

#php
star

Wed Apr 19 2023 13:43:45 GMT+0000 (Coordinated Universal Time) https://www.businessbloomer.com/disable-variable-product-price-range-woocommerce/

#php
star

Mon Apr 17 2023 22:38:22 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Apr 12 2023 14:14:59 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Apr 09 2023 14:47:55 GMT+0000 (Coordinated Universal Time) https://codeshack.io/21-useful-php-snippets/

#php
star

Thu Apr 06 2023 19:31:14 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/html/tryit.asp?filename

#undefined #php #html
star

Wed Apr 05 2023 13:37:01 GMT+0000 (Coordinated Universal Time) https://github.com/mtownsend5512/xml-to-array

#php #xml
star

Mon Apr 03 2023 23:19:15 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/6555342/executing-a-java-jar-file-with-php

#php
star

Sun Apr 02 2023 21:36:48 GMT+0000 (Coordinated Universal Time) https://codingfaculty.com/courses/41956/lectures/600445

#php
star

Sun Apr 02 2023 21:06:53 GMT+0000 (Coordinated Universal Time)

#php #mysql
star

Sun Apr 02 2023 21:05:35 GMT+0000 (Coordinated Universal Time)

#php #mysql
star

Sun Apr 02 2023 21:02:49 GMT+0000 (Coordinated Universal Time)

#php #mysql
star

Sun Apr 02 2023 18:56:09 GMT+0000 (Coordinated Universal Time)

#php #mysql
star

Sun Apr 02 2023 17:29:20 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Apr 02 2023 17:09:45 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Apr 02 2023 16:52:26 GMT+0000 (Coordinated Universal Time)

#php #mysql
star

Fri Mar 31 2023 17:20:50 GMT+0000 (Coordinated Universal Time) https://makitweb.com/remove-duplicate-values-from-an-array-in-php/

#laravel #php
star

Fri Mar 31 2023 12:22:24 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Mar 28 2023 15:45:00 GMT+0000 (Coordinated Universal Time)

#php #wordpress #facetwp
star

Tue Mar 28 2023 07:07:25 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Mar 27 2023 09:27:56 GMT+0000 (Coordinated Universal Time)

#docker #php
star

Mon Mar 27 2023 09:13:54 GMT+0000 (Coordinated Universal Time)

#docker #php
star

Thu Mar 23 2023 22:52:49 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Mar 22 2023 20:15:59 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/reference/functions/the_post_thumbnail/

#php
star

Thu Mar 16 2023 19:48:35 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Mar 15 2023 09:05:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/62248112/laravel-authuser-name-and-authuser-id-is-not-working

#php
star

Sat Mar 11 2023 08:07:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/71147523/cant-create-laravel-8-project-problem-appeared-after-release-of-laravel-9

#php
star

Fri Mar 10 2023 12:25:21 GMT+0000 (Coordinated Universal Time)

#javascript #php
star

Mon Mar 06 2023 21:16:04 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/72300328/post-api-mpesa-callbackurl-502-bad-gateway-in-ngrok-in-mpesa-integration

#php
star

Fri Mar 03 2023 13:48:55 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Mar 03 2023 13:48:10 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Mar 02 2023 13:20:22 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 23 2023 02:36:10 GMT+0000 (Coordinated Universal Time) https://refindustries.com/community/12632/how-to-sort-a-laravel-query-builder-result-by-multiple-columns

#laravel #php
star

Thu Feb 16 2023 20:37:32 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/45835797/how-do-i-create-a-webhook

#php
star

Thu Feb 16 2023 20:37:16 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/70727830/how-to-add-meta-data-in-laravel-api-resource

#php
star

Thu Feb 16 2023 01:25:05 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47219542/how-can-i-manually-return-or-throw-a-validation-error-exception-in-laravel

#php
star

Mon Feb 13 2023 04:04:50 GMT+0000 (Coordinated Universal Time) date_default_timezone_set("Asia/Bangkok");

#php
star

Sat Feb 11 2023 17:16:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/31539727/laravel-password-validation-rule

#php
star

Fri Feb 03 2023 16:25:25 GMT+0000 (Coordinated Universal Time) https://support.advancedcustomfields.com/forums/topic/date-picker-output-dependent-on-editor-timezone/

#php
star

Thu Feb 02 2023 15:11:21 GMT+0000 (Coordinated Universal Time)

#php #laravel #command
star

Tue Jan 24 2023 20:44:33 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 24 2023 20:43:56 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 24 2023 20:26:45 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 24 2023 20:15:37 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 24 2023 20:15:05 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 24 2023 09:13:05 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Jan 22 2023 11:33:37 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jan 14 2023 07:18:43 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jan 14 2023 07:18:29 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jan 14 2023 07:17:51 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jan 14 2023 07:17:20 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Jan 04 2023 00:06:59 GMT+0000 (Coordinated Universal Time) https://docs.sendgrid.com/ui/account-and-settings/api-keys

#php
star

Wed Dec 28 2022 04:15:12 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Tue Dec 27 2022 06:17:08 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Dec 22 2022 11:15:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/48533921/validation-rule-unique-requires-at-least-1-parameters

#php #laravel
star

Wed Dec 21 2022 19:43:06 GMT+0000 (Coordinated Universal Time) https://w3codegenerator.com/code-snippets/laravel/how-to-get-data-from-two-tables-in-laravel

#php
star

Wed Dec 21 2022 11:20:01 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/64597051/how-to-downgrade-or-install-a-specific-version-of-composer

#php
star

Fri Dec 16 2022 14:23:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/66385685/laravel-increment-decrement-to-update-display-order-field

#php
star

Fri Dec 16 2022 13:58:49 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Dec 15 2022 07:50:01 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Dec 14 2022 09:40:23 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Dec 14 2022 09:39:41 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Dec 09 2022 20:57:26 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14236148/how-to-remove-all-numbers-from-string

#php
star

Wed Nov 30 2022 17:21:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/56473929/how-to-expose-all-the-acf-fields-to-wordpress-rest-api-in-both-pages-and-custom

#php #wp #acf #rest
star

Mon Nov 28 2022 14:52:51 GMT+0000 (Coordinated Universal Time) https://wordpress.org/support/article/debugging-in-wordpress/

#php
star

Wed Nov 23 2022 21:55:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/307650/how-to-remove-duplicate-values-from-an-array-in-php

#php
star

Wed Nov 23 2022 15:44:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/25700529/laravel-eloquent-how-to-order-results-of-related-models

#php
star

Tue Nov 22 2022 21:33:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/29594572/laravel-eloquent-update-record-without-loading-from-database

#php
star

Mon Nov 21 2022 15:45:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14266730/js-how-to-cache-a-variable

#php #array #javascript
star

Mon Nov 21 2022 14:44:09 GMT+0000 (Coordinated Universal Time)

#php #woocommerce
star

Fri Nov 18 2022 08:25:18 GMT+0000 (Coordinated Universal Time) https://eseospace.dev/websites/expertreputation/wp-admin/theme-editor.php?file

#php #html
star

Wed Nov 16 2022 14:29:22 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/53433293/laravel-collective-how-to-set-formdate-default-value-based-on-the-object-value

#php
star

Tue Nov 15 2022 23:53:36 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/37022384/laravel-migrations-change-update

#php
star

Sun Nov 13 2022 18:25:03 GMT+0000 (Coordinated Universal Time) https://www.wpexplorer.com/best-woocommerce-snippets/

#php
star

Sun Nov 13 2022 18:23:37 GMT+0000 (Coordinated Universal Time) https://www.wpexplorer.com/best-woocommerce-snippets/

#php
star

Sun Nov 13 2022 18:22:17 GMT+0000 (Coordinated Universal Time) https://www.wpexplorer.com/best-woocommerce-snippets/

#php
star

Sun Nov 13 2022 18:20:07 GMT+0000 (Coordinated Universal Time) https://www.wpexplorer.com/best-woocommerce-snippets/

#php
star

Tue Nov 08 2022 13:07:00 GMT+0000 (Coordinated Universal Time) https://gist.github.com/artikus11/1d2b2459474154fd27d4e01cb4391e7a

#php
star

Mon Nov 07 2022 19:06:00 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Nov 07 2022 18:45:19 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/410968/modify-a-query-using-both-a-text-field-and-a-true-false-afc-field

#php
star

Wed Nov 02 2022 18:47:58 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Nov 01 2022 12:13:22 GMT+0000 (Coordinated Universal Time) https://wpcode.com/

#php
star

Mon Oct 31 2022 14:35:25 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/71546848/laravel-9-install-vue-router-for-vue-2-6-12

#php
star

Mon Oct 31 2022 09:05:47 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Oct 31 2022 09:05:47 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Oct 28 2022 12:53:53 GMT+0000 (Coordinated Universal Time) controller-logic

#php #controller #laravel
star

Wed Oct 26 2022 22:27:55 GMT+0000 (Coordinated Universal Time) https://www.moesif.com/blog/technical/cors/Authoritative-Guide-to-CORS-Cross-Origin-Resource-Sharing-for-REST-APIs/

#php
star

Tue Oct 25 2022 11:32:18 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/19495068/convert-stdclass-object-to-array-in-php

#php
star

Tue Oct 25 2022 08:52:40 GMT+0000 (Coordinated Universal Time) https://medium.com/makers-byte/how-to-hide-a-woocommerce-category-from-shop-page-495ff3286bcf

#php
star

Tue Oct 25 2022 08:49:52 GMT+0000 (Coordinated Universal Time) https://medium.com/makers-byte/how-to-hide-plugins-from-the-wordpressadmin-plugin-list-589edb2fd897

#php
star

Fri Oct 21 2022 07:34:35 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Oct 19 2022 10:27:20 GMT+0000 (Coordinated Universal Time) https://maticz.com/token-development

#nodejs #angular #javascript #php #python #vue.js #react.js
star

Wed Oct 19 2022 10:19:52 GMT+0000 (Coordinated Universal Time) https://bit.ly/3GLa8p1

#javascript #java #php #laravel #angular #nodejs
star

Wed Oct 19 2022 10:16:04 GMT+0000 (Coordinated Universal Time) https://maticz.com/ethereum-token-development

#java #javascript #php #laravel
star

Wed Oct 19 2022 10:11:54 GMT+0000 (Coordinated Universal Time) https://bit.ly/3RN2YXJ

#java #javascript #php #laravel
star

Tue Oct 18 2022 09:41:41 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Oct 18 2022 05:36:45 GMT+0000 (Coordinated Universal Time) https://rudrastyh.com/woocommerce/payment-gateway-plugin.html

#php
star

Tue Oct 18 2022 05:35:50 GMT+0000 (Coordinated Universal Time) https://rudrastyh.com/woocommerce/payment-gateway-plugin.html

#php
star

Tue Oct 18 2022 05:35:43 GMT+0000 (Coordinated Universal Time) https://rudrastyh.com/woocommerce/payment-gateway-plugin.html

#php
star

Tue Oct 18 2022 05:35:10 GMT+0000 (Coordinated Universal Time) https://rudrastyh.com/woocommerce/payment-gateway-plugin.html

#php
star

Tue Oct 18 2022 05:33:58 GMT+0000 (Coordinated Universal Time) https://rudrastyh.com/woocommerce/payment-gateway-plugin.html

#php
star

Tue Oct 18 2022 05:33:33 GMT+0000 (Coordinated Universal Time) https://rudrastyh.com/woocommerce/payment-gateway-plugin.html

#php
star

Mon Oct 17 2022 19:45:59 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:38:59 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:36:45 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:28:00 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:27:03 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:26:46 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:26:24 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:25:36 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:23:57 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:19:30 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:18:13 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:15:59 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:15:10 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:10:52 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 15 2022 17:10:33 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Oct 09 2022 08:01:38 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 08 2022 14:24:16 GMT+0000 (Coordinated Universal Time)

#php #wpdb
star

Fri Oct 07 2022 12:18:14 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Oct 02 2022 23:07:58 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Oct 02 2022 18:02:43 GMT+0000 (Coordinated Universal Time) https://www.w3schools.in/php/form-validation

#php
star

Fri Sep 30 2022 17:28:10 GMT+0000 (Coordinated Universal Time)

#php #pdo
star

Fri Sep 30 2022 17:24:03 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Sep 28 2022 17:55:00 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/36468759/laravel-grouping-by-eloquent-relationship

#php
star

Tue Sep 27 2022 12:01:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/32557492/how-to-add-a-woocommerce-buy-now-button

#php
star

Thu Sep 22 2022 11:33:34 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Sep 15 2022 05:44:35 GMT+0000 (Coordinated Universal Time) https://www.hivelance.com/binance-clone-script

#javascript #php #nodejs #laravel
star

Wed Sep 14 2022 13:34:16 GMT+0000 (Coordinated Universal Time) https://phpdelusions.net/pdo

#mysql #bd #pdo #php
star

Tue Sep 13 2022 07:04:37 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/35839303/laravel-check-if-collection-is-empty

#php
star

Thu Sep 08 2022 09:32:40 GMT+0000 (Coordinated Universal Time) https://zetcode.com/php/pdo/

#php #mysql #pdo
star

Thu Sep 08 2022 09:30:39 GMT+0000 (Coordinated Universal Time) https://zetcode.com/php/pdo/

#php #mysql #pdo
star

Thu Sep 08 2022 09:24:44 GMT+0000 (Coordinated Universal Time) https://zetcode.com/php/pdo/

#php #mysql #pdo
star

Thu Sep 08 2022 09:22:09 GMT+0000 (Coordinated Universal Time) https://zetcode.com/php/pdo/

#php #mysql #pdo
star

Thu Sep 08 2022 09:17:16 GMT+0000 (Coordinated Universal Time) https://zetcode.com/php/pdo/

#php #mysql #pdo
star

Thu Sep 08 2022 09:13:05 GMT+0000 (Coordinated Universal Time) https://zetcode.com/php/pdo/

#php #mysql #pdo
star

Thu Sep 08 2022 08:09:10 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/php-pdo-como-se-conectar-ao-banco-de-dados/37211

#php
star

Thu Sep 08 2022 08:07:59 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/php-pdo-como-se-conectar-ao-banco-de-dados/37211

#php
star

Thu Sep 08 2022 08:05:57 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/php-pdo-como-se-conectar-ao-banco-de-dados/37211

#php
star

Thu Sep 08 2022 08:03:49 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/php-pdo-como-se-conectar-ao-banco-de-dados/37211

#php
star

Thu Sep 08 2022 08:01:57 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/php-pdo-como-se-conectar-ao-banco-de-dados/37211

#php
star

Thu Sep 08 2022 08:01:05 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Sep 08 2022 07:53:32 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Thu Sep 08 2022 07:52:34 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Thu Sep 08 2022 07:51:38 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Thu Sep 08 2022 07:50:36 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Thu Sep 08 2022 07:49:41 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Thu Sep 08 2022 07:48:17 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Thu Sep 08 2022 07:46:54 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Wed Sep 07 2022 09:11:31 GMT+0000 (Coordinated Universal Time)

#html #css #php #mys #js #json
star

Tue Sep 06 2022 17:29:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/31983345/laravel-5-1-how-to-use-the-same-form-request-rules-for-two-methods-when-a-field

#php
star

Tue Sep 06 2022 17:29:14 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/31983345/laravel-5-1-how-to-use-the-same-form-request-rules-for-two-methods-when-a-field

#php
star

Sat Sep 03 2022 16:20:01 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Sep 02 2022 07:43:24 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Sep 01 2022 11:33:22 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Sep 01 2022 06:08:06 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Aug 31 2022 21:28:18 GMT+0000 (Coordinated Universal Time) https://gretathemes.com/wordpress-disable-application-passwords/

#php
star

Wed Aug 31 2022 21:22:50 GMT+0000 (Coordinated Universal Time) https://www.code-paste.com/remove-css-and-js-version-parameter-from-wordpress/

#php
star

Wed Aug 31 2022 21:20:48 GMT+0000 (Coordinated Universal Time) https://onlinemediamasters.com/disable-wordpress-heartbeat-api/

#php
star

Wed Aug 31 2022 21:15:08 GMT+0000 (Coordinated Universal Time) https://www.cssigniter.com/hide-the-wordpress-update-notifications-from-all-users-except-administrators/

#php
star

Wed Aug 31 2022 21:11:16 GMT+0000 (Coordinated Universal Time) https://purothemes.com/remove-woocommerce-marketing-hub/

#php
star

Wed Aug 31 2022 21:07:54 GMT+0000 (Coordinated Universal Time) https://www.webroomtech.com/how-to-disable-woocommerce-admin-dashboard-and-woocommerce-analytics/

#php
star

Wed Aug 31 2022 21:04:50 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/wordpress/remove-link-to-the-wlw-manifest-file/

#php
star

Wed Aug 31 2022 20:56:06 GMT+0000 (Coordinated Universal Time) https://wpti.ps/remove-meta-generator-wordpress-woocommerce-revslider-wpbakery/

#php
star

Wed Aug 31 2022 13:12:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41981922/minimum-working-example-for-ajax-post-in-laravel-5-3

#php
star

Wed Aug 31 2022 12:04:15 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Aug 30 2022 13:47:58 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 19:55:54 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 19:52:53 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 19:49:31 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 19:37:05 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 19:36:14 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 19:11:35 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 18:49:22 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 18:45:16 GMT+0000 (Coordinated Universal Time)

#php #nginx
star

Mon Aug 29 2022 18:22:35 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 17:09:44 GMT+0000 (Coordinated Universal Time)

#sql #php
star

Mon Aug 29 2022 16:21:54 GMT+0000 (Coordinated Universal Time)

#php #sql
star

Mon Aug 29 2022 16:06:01 GMT+0000 (Coordinated Universal Time)

#sql #php
star

Mon Aug 29 2022 16:01:27 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 29 2022 15:51:59 GMT+0000 (Coordinated Universal Time)

#php #sql
star

Mon Aug 29 2022 12:01:09 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Aug 28 2022 12:52:40 GMT+0000 (Coordinated Universal Time)

#bash #php
star

Sun Aug 28 2022 01:42:26 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Aug 28 2022 01:39:54 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Aug 25 2022 11:04:40 GMT+0000 (Coordinated Universal Time) https://github.com/AlexWebLab/bootstrap-5-wordpress-navbar-walker

#css #php #wordpress
star

Thu Aug 25 2022 10:59:04 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Aug 25 2022 10:29:44 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Aug 22 2022 18:17:17 GMT+0000 (Coordinated Universal Time) https://capitainewp.io/formations/developper-theme-wordpress/debugguer-code

#php
star

Fri Aug 19 2022 22:35:35 GMT+0000 (Coordinated Universal Time) https://metabox.io/disable-gutenberg-without-using-plugins/

#php
star

Fri Aug 12 2022 16:36:41 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Aug 12 2022 01:01:35 GMT+0000 (Coordinated Universal Time) https://docs.metabox.io/displaying-fields-with-code/

#wordpress #php #metabox
star

Thu Aug 11 2022 23:37:20 GMT+0000 (Coordinated Universal Time)

#wordpress #php
star

Thu Aug 11 2022 23:11:14 GMT+0000 (Coordinated Universal Time)

#wordpress #php
star

Wed Aug 10 2022 13:27:13 GMT+0000 (Coordinated Universal Time)

#php #javascript #html
star

Mon Aug 08 2022 20:01:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/43053550/laravel-how-to-change-default-login-error-message-these-credentials-do-not-ma

#php
star

Mon Aug 08 2022 04:46:18 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/plugins/plugin-basics/header-requirements/

#php #email #form #wordpress #header
star

Sun Aug 07 2022 01:45:23 GMT+0000 (Coordinated Universal Time) https://webtalkhub.com/how-to-change-number-of-products-per-page-woocommerce/

#php
star

Tue Aug 02 2022 13:02:05 GMT+0000 (Coordinated Universal Time) https://www.codexworld.com/how-to/get-uri-segment-php/

#php
star

Mon Aug 01 2022 15:18:35 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/16675753/php-fastest-way-to-handle-undefined-array-key

#php
star

Fri Jul 22 2022 03:40:39 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Wed Jul 20 2022 09:25:40 GMT+0000 (Coordinated Universal Time)

#code #html #php
star

Tue Jul 19 2022 08:08:08 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Jul 13 2022 11:53:53 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/checking-if-a-value-is-set/62ce5ca63289bc001593cfd5

#php
star

Mon Jul 11 2022 15:03:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/12954578/how-to-require-php-files-relatively-at-different-directory-levels

#php
star

Fri Jul 08 2022 15:08:10 GMT+0000 (Coordinated Universal Time) https://medium.com/@cahyofajar28/live-search-in-laravel-8-using-ajax-and-mysql-ac4bc9b0a93c

#php #javascript #html #blade
star

Fri Jul 08 2022 15:07:05 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/51537381/best-way-to-search-multiple-fields-laravel

#php
star

Tue Jul 05 2022 18:03:12 GMT+0000 (Coordinated Universal Time) https://kinsta.com/blog/wp-config-php/

#php
star

Tue Jul 05 2022 17:46:36 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:46:09 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:44:08 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:41:58 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:39:12 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:38:10 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:36:26 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jul 05 2022 17:34:07 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jul 04 2022 11:04:23 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jul 01 2022 17:24:39 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/32236030/format-code-command-for-php-html-in-visual-studio-code

#php
star

Fri Jul 01 2022 06:59:14 GMT+0000 (Coordinated Universal Time) https://www.businessbloomer.com/woocommerce-remove-add-cart-add-view-product-loop/

#php
star

Thu Jun 30 2022 16:44:57 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47219542/how-can-i-manually-return-or-throw-a-validation-error-exception-in-laravel

#php
star

Wed Jun 29 2022 12:12:54 GMT+0000 (Coordinated Universal Time) https://github.com/tsayen/dom-to-image/issues/343

#php #javascript
star

Sun Jun 26 2022 08:40:16 GMT+0000 (Coordinated Universal Time)

#php #laravel #bash #apache #server
star

Fri Jun 24 2022 10:56:02 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/4282413/sort-array-of-objects-by-object-fields

#php
star

Fri Jun 24 2022 04:34:00 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/28127495/in-phps-laravel-how-do-i-clear-laravel-log

#php
star

Wed Jun 22 2022 09:18:15 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Jun 22 2022 05:39:48 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jun 21 2022 10:08:53 GMT+0000 (Coordinated Universal Time) https://www.divi-community.fr/tutoriels-divi/comment-renommer-les-projets-divi/

#php
star

Tue Jun 21 2022 08:58:06 GMT+0000 (Coordinated Universal Time) https://es.stackoverflow.com/questions/249917/comparar-y-fusionar-2-arrays-en-php

#php
star

Tue Jun 21 2022 08:55:12 GMT+0000 (Coordinated Universal Time) https://es.stackoverflow.com/questions/249917/comparar-y-fusionar-2-arrays-en-php

#php
star

Tue Jun 21 2022 05:01:33 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/9.x/deployment

#php #laravel #nginx
star

Sun Jun 19 2022 10:48:57 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jun 18 2022 06:21:50 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/59595863/file-put-contentsc-xampp-htdocs-instant-storage-framework-sessions-ff-failed

#php #laravel
star

Thu Jun 16 2022 12:24:06 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/18862160/composer-laravel-create-project

#php #laravel
star

Thu Jun 16 2022 08:16:13 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Jun 15 2022 18:57:51 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jun 14 2022 12:16:44 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jun 14 2022 06:16:27 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jun 14 2022 06:15:04 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jun 13 2022 14:16:57 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Jun 12 2022 04:09:14 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/43053550/laravel-how-to-change-default-login-error-message-these-credentials-do-not-ma

#php
star

Wed Jun 08 2022 10:10:06 GMT+0000 (Coordinated Universal Time) https://ayudawp.com/ocultar-menus-admin/

#php
star

Tue Jun 07 2022 21:19:21 GMT+0000 (Coordinated Universal Time) https://codigoconjuan.com/

#php
star

Tue Jun 07 2022 13:44:00 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jun 04 2022 05:40:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/56144956/anyway-to-remove-not-needed-css-in-laravel-using-blade/56146617#56146617

#php
star

Tue May 31 2022 21:10:03 GMT+0000 (Coordinated Universal Time) https://circle.digitalambition.co/c/code-snippets/fix-oxyextras-infinite-scroll-not-working-on-static-homepage

#php
star

Tue May 31 2022 19:36:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47611251/any-way-to-overwrite-get-stock-quantity-in-my-functions-php

#wordpress #php #stock #quantity #filter
star

Tue May 31 2022 14:49:26 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/53194/wordpress-paginate-wpdb-get-results

#wordpress #wpdb #pagination #php
star

Tue May 31 2022 09:47:25 GMT+0000 (Coordinated Universal Time)

#woocommerce #product #type #php
star

Mon May 30 2022 23:35:44 GMT+0000 (Coordinated Universal Time)

#php
star

Mon May 30 2022 22:19:05 GMT+0000 (Coordinated Universal Time)

#php
star

Thu May 26 2022 20:21:06 GMT+0000 (Coordinated Universal Time)

#wordpress #php
star

Thu May 26 2022 20:17:54 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Thu May 26 2022 20:13:46 GMT+0000 (Coordinated Universal Time) https://docs.memberpress.com/article/381-how-to-edit-lessons-in-classroom-mode-with-a-page-builder

#php #memberpress #wordpress
star

Tue May 24 2022 20:34:10 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/50730143/laravel-storage-link-wont-work-on-production

#php
star

Tue May 24 2022 17:27:57 GMT+0000 (Coordinated Universal Time)

#php
star

Sat May 21 2022 09:52:23 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/60284298/laravel-and-arabic-slugs

#php
star

Sat May 21 2022 08:58:42 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/reference/functions/wpautop/

#php
star

Fri May 20 2022 16:36:06 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3599056/best-way-to-read-zip-file-in-php

#php
star

Fri May 20 2022 16:21:21 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri May 20 2022 14:05:23 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/67497441/laravel-how-to-use-foreach-loop-to-decrease-stock-based-on-order-quantity

#php
star

Fri May 20 2022 13:25:55 GMT+0000 (Coordinated Universal Time)

#php #css #divi
star

Fri May 20 2022 11:21:05 GMT+0000 (Coordinated Universal Time) https://community.automaticcss.com/c/general-discussion/another-workaround

#php
star

Fri May 20 2022 11:17:42 GMT+0000 (Coordinated Universal Time)

#php
star

Fri May 20 2022 11:16:44 GMT+0000 (Coordinated Universal Time)

#php
star

Fri May 20 2022 11:13:53 GMT+0000 (Coordinated Universal Time)

#php
star

Fri May 20 2022 09:02:51 GMT+0000 (Coordinated Universal Time)

#php
star

Thu May 19 2022 15:23:43 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 18 2022 19:23:27 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 18 2022 19:13:47 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 18 2022 15:30:39 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Tue May 17 2022 14:02:47 GMT+0000 (Coordinated Universal Time) https://wpdevdesign.com/taxonomy-term-specific-image-grid-using-meta-box/

#php #metabox #wordpress
star

Mon May 16 2022 14:42:51 GMT+0000 (Coordinated Universal Time)

#php
star

Mon May 16 2022 14:30:45 GMT+0000 (Coordinated Universal Time) https://wpdevdesign.com/how-to-remove-pagination-for-repeater-queries-in-oxygen/

#php
star

Mon May 16 2022 07:19:46 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/53480420/change-the-default-shipping-method-in-woocommerce

#php
star

Mon May 16 2022 07:09:00 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/50498391/remove-selected-checkout-fields-with-woocommerce-depending-on-shipping-method

#php #javascript #css
star

Sun May 15 2022 18:29:13 GMT+0000 (Coordinated Universal Time) https://code.dplugins.com/change-excerpt-length/

#php
star

Sun May 15 2022 18:28:55 GMT+0000 (Coordinated Universal Time) https://code.dplugins.com/add-prev-and-next-post-with-title-and-thumb-in-the-same-category/

#php
star

Sun May 15 2022 18:28:20 GMT+0000 (Coordinated Universal Time) https://code.dplugins.com/remove-archive-prefix/

#php
star

Sun May 15 2022 18:27:54 GMT+0000 (Coordinated Universal Time) https://code.dplugins.com/modify-or-disable-heartbeat-api-without-plugin/

#php
star

Sun May 15 2022 18:27:17 GMT+0000 (Coordinated Universal Time) https://code.dplugins.com/wordpress-admin-dark-theme/

#php
star

Fri May 13 2022 08:06:44 GMT+0000 (Coordinated Universal Time) https://wordpress-543613-2502748.cloudwaysapps.com/wp-admin/theme-editor.php?file

#php
star

Fri May 13 2022 01:17:44 GMT+0000 (Coordinated Universal Time)

#php
star

Wed May 11 2022 09:44:22 GMT+0000 (Coordinated Universal Time) https://toolset.com/forums/topic/random-number-as-permalink/

#php
star

Tue May 10 2022 20:55:36 GMT+0000 (Coordinated Universal Time)

#php
star

Tue May 10 2022 19:45:42 GMT+0000 (Coordinated Universal Time) https://phpgeek.xyz

#php
star

Tue May 10 2022 14:00:08 GMT+0000 (Coordinated Universal Time) https://www.businessbloomer.com/woocommerce-find-products-with-no-weight-wp-admin/

#php
star

Tue May 10 2022 11:33:17 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Tue May 10 2022 04:32:37 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/24891276/how-to-automatically-append-query-string-to-laravel-pagination-links

#php
star

Fri May 06 2022 02:25:33 GMT+0000 (Coordinated Universal Time)

#php
star

Thu May 05 2022 11:07:24 GMT+0000 (Coordinated Universal Time) https://alexhooley.com/divi-custom-woff-fonts/

#php
star

Mon Apr 25 2022 19:45:31 GMT+0000 (Coordinated Universal Time) https://onlinemediamasters.com/wp-rocket-settings/

#php
star

Sun Apr 24 2022 08:56:47 GMT+0000 (Coordinated Universal Time) https://sir.kr/g5_tip/14037?page

#php #lazyload #그누보드
star

Sun Apr 24 2022 08:56:27 GMT+0000 (Coordinated Universal Time) https://sir.kr/g5_tip/14037?page

#php #그누보드 #lazyload
star

Sun Apr 24 2022 03:22:34 GMT+0000 (Coordinated Universal Time) Home

#php #laravel
star

Sun Apr 24 2022 00:57:52 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Apr 23 2022 11:13:13 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/22615926/migration-cannot-add-foreign-key-constraint

#php
star

Fri Apr 22 2022 23:59:22 GMT+0000 (Coordinated Universal Time) https://dev.to/ninjasoards/easy-headless-wordpress-with-nuxt-netlify-5c4a

#php #wordpress
star

Thu Apr 21 2022 09:16:33 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Apr 21 2022 09:11:08 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/124354/why-wp-register-style-is-important-while-im-using-a-complete-wp-enqueue-style

#php
star

Tue Apr 19 2022 16:38:21 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Sun Apr 17 2022 18:33:08 GMT+0000 (Coordinated Universal Time) https://www.wpbeginner.com/wp-tutorials/how-to-change-the-woocommerce-shop-page-title/

#php
star

Sun Apr 17 2022 18:24:03 GMT+0000 (Coordinated Universal Time) https://www.wpbeginner.com/wp-tutorials/how-to-disable-the-language-switcher-on-wordpress-login-screen/

#php
star

Sat Apr 16 2022 08:37:53 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Apr 16 2022 08:34:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/70395763/woocommerce-how-to-redirect-a-custom-end-point-on-my-account-page

#php
star

Sat Apr 16 2022 08:30:16 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/hide-downloads-link-on-woocommerce-my-account-if-customer-has-no-downloadable-products/

#php
star

Sat Apr 16 2022 08:12:53 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/rename-the-woocommerce-my-account-menu-link-for-logged-out-users/

#php
star

Sat Apr 16 2022 08:08:44 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/change-the-woocommerce-return-to-shop-link/

#php
star

Sat Apr 16 2022 08:06:59 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/woocommerce-hide-other-shipping-methods-when-free-shipping-is-available/

#php
star

Sat Apr 16 2022 08:01:47 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/how-to-modify-wordpress-text-strings-without-a-plugin/

#php
star

Sat Apr 16 2022 07:54:56 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/change-the-wordpress-page-title-separator-without-a-plugin/

#php #seo
star

Fri Apr 15 2022 12:31:34 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Apr 14 2022 06:13:13 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Tue Apr 12 2022 09:35:34 GMT+0000 (Coordinated Universal Time) https://programadorwebvalencia.com/cursos/php/bases-de-datos/

#php
star

Tue Apr 12 2022 00:09:32 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Apr 08 2022 18:56:59 GMT+0000 (Coordinated Universal Time) https://element.how/elementor-wp-rocket-settings/

#php
star

Thu Apr 07 2022 10:56:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/35827062/how-to-force-laravel-project-to-use-https-for-all-routes

#php
star

Tue Apr 05 2022 19:06:27 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Tue Apr 05 2022 19:06:13 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Tue Apr 05 2022 08:31:18 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/a/6881058/3238619

#php #html #form
star

Mon Apr 04 2022 15:34:03 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Apr 04 2022 13:10:23 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Apr 04 2022 08:47:14 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/67466925/remove-product-item-from-woocommerce-checkout-page-using-ajax

#php
star

Thu Mar 31 2022 15:47:42 GMT+0000 (Coordinated Universal Time) https://www.moorewebexposure.com/wordpress-posts/how-to-upload-all-file-types-to-wordpress/

#php
star

Thu Mar 31 2022 15:43:13 GMT+0000 (Coordinated Universal Time) https://www.moorewebexposure.com/wordpress-posts/elementor/disable-all-google-fonts-from-loading-in-elementor/

#php
star

Tue Mar 29 2022 07:06:55 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Mar 28 2022 04:55:51 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/46940318/what-is-the-best-way-to-use-laravel-route-in-vue-js-component

#php
star

Thu Mar 24 2022 18:14:58 GMT+0000 (Coordinated Universal Time)

#php #secure #input #forms
star

Wed Mar 23 2022 14:52:26 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Mar 23 2022 03:02:28 GMT+0000 (Coordinated Universal Time) https://gist.github.com/dev-jaskaranSingh/e209225626d7b1b18a89d41d4a6ecfed

#laravel #php
star

Wed Mar 23 2022 02:27:30 GMT+0000 (Coordinated Universal Time) https://www.guru99.com/php-mail.html

#php
star

Wed Mar 23 2022 02:25:45 GMT+0000 (Coordinated Universal Time) https://www.guru99.com/php-mail.html

#php
star

Tue Mar 22 2022 15:00:46 GMT+0000 (Coordinated Universal Time) https://wpdevdesign.com/manual-query-params-in-oxygen/

#php
star

Tue Mar 22 2022 07:42:56 GMT+0000 (Coordinated Universal Time) https://www.wpbeginner.com/wp-tutorials/how-to-set-get-and-delete-wordpress-cookies-like-a-pro/

#php #wordpress
star

Thu Mar 17 2022 12:21:27 GMT+0000 (Coordinated Universal Time)

#php #elasticsearch #fos_elastica
star

Tue Mar 15 2022 14:15:16 GMT+0000 (Coordinated Universal Time)

#wordpress #php #woocommerce
star

Tue Mar 15 2022 14:03:42 GMT+0000 (Coordinated Universal Time)

#wordpress #php #woocommerce
star

Tue Mar 15 2022 12:48:38 GMT+0000 (Coordinated Universal Time)

#wordpress #php #woocommerce
star

Tue Mar 15 2022 12:44:34 GMT+0000 (Coordinated Universal Time)

#wordpress #php #woocommerce
star

Tue Mar 15 2022 04:13:20 GMT+0000 (Coordinated Universal Time) https://www.digitalocean.com/community/conceptual_articles/s-o-l-i-d-the-first-five-principles-of-object-oriented-design

#standards #php #coding
star

Tue Mar 15 2022 00:31:04 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Tue Mar 15 2022 00:27:48 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Mon Mar 14 2022 14:41:51 GMT+0000 (Coordinated Universal Time) https://wpti.ps/how-to-debug-error-in-wordpress/

#php
star

Fri Mar 11 2022 11:40:12 GMT+0000 (Coordinated Universal Time) https://laracasts.com/discuss/channels/laravel/laravel-storage-goes-to-404-page

#php
star

Thu Mar 10 2022 05:52:14 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Mar 09 2022 23:42:54 GMT+0000 (Coordinated Universal Time) https://www.markhesketh.com/switching-multiple-php-versions-on-macos/

#php
star

Tue Mar 08 2022 21:32:37 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Mar 08 2022 12:40:57 GMT+0000 (Coordinated Universal Time)

#php #css
star

Tue Mar 08 2022 11:17:56 GMT+0000 (Coordinated Universal Time) https://www.webtng.com/code-snippets-used-when-creating-an-oxygen-site/

#css #php
star

Sat Mar 05 2022 20:50:50 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/54283283/laravel-extendslayouts-app-not-working-on-some-pages

#php
star

Sat Mar 05 2022 18:39:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/44462989/how-to-edit-bootstrap-css-files-in-laravel-5-2

#php
star

Wed Mar 02 2022 13:46:51 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Mar 02 2022 13:44:44 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Mar 01 2022 15:42:38 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Tue Mar 01 2022 10:34:24 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Mar 01 2022 10:13:22 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Feb 26 2022 17:16:47 GMT+0000 (Coordinated Universal Time) https://perishablepress.com/advanced-php-error-handling-via-htaccess/

#php
star

Fri Feb 25 2022 12:24:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/136782/convert-from-mysql-datetime-to-another-format-with-php

#php #date #mysql
star

Thu Feb 24 2022 13:43:32 GMT+0000 (Coordinated Universal Time)

#php #codeigniter #database #model
star

Thu Feb 24 2022 09:08:59 GMT+0000 (Coordinated Universal Time)

#php #codeigniter #database #model
star

Thu Feb 24 2022 08:48:16 GMT+0000 (Coordinated Universal Time) https://codeigniter.com/userguide3/database/query_builder.html

#php #codeigniter #database #model
star

Tue Feb 22 2022 20:09:23 GMT+0000 (Coordinated Universal Time) https://snipplr.com/view/344725/time-add

#php
star

Tue Feb 22 2022 13:35:44 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41400395/replace-password-reset-mail-template-with-custom-template-laravel-5-3

#php
star

Fri Feb 18 2022 22:52:37 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/12696996/php-regex-to-remove-everything-after-a-character

#php
star

Fri Feb 18 2022 16:16:21 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/59908145/how-to-add-additional-condition-to-laravel-6-auth-attempt-method

#php
star

Fri Feb 18 2022 10:27:42 GMT+0000 (Coordinated Universal Time) https://www.wpexplorer.com/best-woocommerce-snippets/

#php
star

Thu Feb 17 2022 19:32:53 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41675051/get-response-in-json-format-in-yii2

#php #yii2 #response #json #format
star

Thu Feb 17 2022 08:18:20 GMT+0000 (Coordinated Universal Time) https://www.webtng.com/code-snippets-used-when-creating-an-oxygen-site/

#php
star

Thu Feb 17 2022 08:17:38 GMT+0000 (Coordinated Universal Time) https://www.webtng.com/code-snippets-used-when-creating-an-oxygen-site/

#php
star

Thu Feb 17 2022 08:17:10 GMT+0000 (Coordinated Universal Time) https://www.webtng.com/code-snippets-used-when-creating-an-oxygen-site/

#php
star

Thu Feb 17 2022 08:15:17 GMT+0000 (Coordinated Universal Time) https://www.webtng.com/code-snippets-used-when-creating-an-oxygen-site/

#php
star

Thu Feb 17 2022 08:14:23 GMT+0000 (Coordinated Universal Time) https://www.webtng.com/creating-a-website-with-oxygen/#setup-hosting-and-new-wordpress-install

#php
star

Tue Feb 15 2022 04:42:32 GMT+0000 (Coordinated Universal Time)

#imageupload #form #html #php
star

Sun Feb 13 2022 19:36:14 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Feb 11 2022 17:07:05 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-loops.html

#php
star

Fri Feb 11 2022 17:05:09 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-functions.html

#php
star

Fri Feb 11 2022 17:03:58 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-switch.html

#php
star

Fri Feb 11 2022 17:02:25 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-if-else.html

#php
star

Fri Feb 11 2022 17:01:06 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-math.html

#php
star

Fri Feb 11 2022 16:59:23 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-numbers.html

#php
star

Fri Feb 11 2022 16:57:51 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-strings.html

#php
star

Fri Feb 11 2022 16:56:16 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-echo-print.html

#php
star

Fri Feb 11 2022 16:54:50 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-operator-types.html

#php
star

Fri Feb 11 2022 16:53:03 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-data-types.html

#php
star

Fri Feb 11 2022 16:51:40 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-constants.html

#php
star

Fri Feb 11 2022 16:50:04 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-variables.html

#php
star

Fri Feb 11 2022 16:48:25 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-comments.html

#php
star

Fri Feb 11 2022 16:46:54 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-syntax.html

#php
star

Fri Feb 11 2022 16:43:11 GMT+0000 (Coordinated Universal Time) https://www.elementtutorials.com/php/php-tutorial.html

#php
star

Fri Feb 11 2022 12:06:32 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Feb 11 2022 08:35:10 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Feb 11 2022 08:30:43 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Feb 11 2022 00:06:31 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/php/php_file_upload.asp

#imageupload #form #html #php
star

Wed Feb 09 2022 07:22:18 GMT+0000 (Coordinated Universal Time) https://faq.o2switch.fr/gestion-site/debug-page-blanche-erreur-500

#php #wordpress #debug
star

Tue Feb 08 2022 11:10:45 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/sub.html

#html #css #java #javascript #php #sass #bootstrap
star

Tue Feb 08 2022 11:06:55 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/style.html

#html #css #javascript #php #python #sass
star

Tue Feb 08 2022 10:42:06 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/input.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 10:41:10 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/img.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 10:40:18 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/iframe.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 10:39:04 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/i.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:25:14 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/html.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:24:36 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/hr.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:24:00 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/h.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:23:29 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/header.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:22:55 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/head.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:22:25 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/form.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:21:56 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/footer.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:21:28 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/figure.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:20:56 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/fieldset.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:20:18 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/embed.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:19:43 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/em.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:19:13 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/dt.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:18:32 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/dl.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:17:49 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/div.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:17:19 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/dialog.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:16:43 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/dfn.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:16:10 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/details.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:15:40 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/del.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:15:05 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/dd.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:14:36 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/data.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:14:05 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/colgroup.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:13:24 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/code.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:12:48 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/cite.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:12:21 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/caption.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:11:32 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/canvas.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:11:01 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/button.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:10:21 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/br.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:09:47 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/body.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:09:22 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/blockquote.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:08:49 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/bdo.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:08:18 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/bdi.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:07:39 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/base.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:06:58 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/b.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:06:10 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/audio.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 09:05:24 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/aside.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 08:57:04 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/ref/article.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 08:56:01 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/html/html-tutorial.html/ref/area.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 08:40:32 GMT+0000 (Coordinated Universal Time) http://www.elementtutorials.com//ref/area.html

#html #css #javasc #java #php #sass
star

Tue Feb 08 2022 08:39:50 GMT+0000 (Coordinated Universal Time) http://www.elementtutorials.com//ref/abbr.html

#html #css #java #javascript #php #sass
star

Tue Feb 08 2022 08:38:47 GMT+0000 (Coordinated Universal Time) http://www.elementtutorials.com//ref/address.html

#html #css #java #javasc #php #sass
star

Tue Feb 08 2022 07:58:53 GMT+0000 (Coordinated Universal Time) http://www.elementtutorials.com//ref/abbr.html

#html #css #java #javasc #php #sass
star

Tue Feb 08 2022 07:56:50 GMT+0000 (Coordinated Universal Time) http://www.elementtutorials.com//ref/abbr.html

#html #css #java #javasc #php #sass
star

Tue Feb 08 2022 07:49:56 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/

#elementtutorials #ht #css #java #javascript #php #sass #jquery #python
star

Wed Feb 02 2022 14:10:14 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/63807930/target-class-controller-does-not-exist-laravel-8

#php
star

Wed Feb 02 2022 07:06:03 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Jan 30 2022 16:32:10 GMT+0000 (Coordinated Universal Time) https://www.phptutorial.net/php-tutorial/php-file-exists/

#php
star

Fri Jan 28 2022 15:48:04 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jan 27 2022 19:02:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/69127314/fos-elastica-bundle-populate-command-killed-by-oom-reaper-with-out-of-memory

#php #elasticsearch #fos_elastica
star

Thu Jan 27 2022 18:38:45 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Jan 27 2022 09:16:58 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Jan 27 2022 03:39:12 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jan 27 2022 03:36:13 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jan 21 2022 14:47:55 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Jan 20 2022 14:57:39 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Wed Jan 19 2022 14:52:39 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Wed Jan 19 2022 12:46:06 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Wed Jan 19 2022 01:21:33 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/7.x

#php
star

Tue Jan 18 2022 08:17:48 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Jan 17 2022 21:39:57 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sat Jan 15 2022 10:45:09 GMT+0000 (Coordinated Universal Time) https://phppot.com/php/simple-php-shopping-cart/

#php
star

Sat Jan 15 2022 10:44:43 GMT+0000 (Coordinated Universal Time) https://phppot.com/php/simple-php-shopping-cart/

#php
star

Sat Jan 15 2022 10:44:22 GMT+0000 (Coordinated Universal Time) https://phppot.com/php/simple-php-shopping-cart/

#php
star

Sat Jan 15 2022 10:43:54 GMT+0000 (Coordinated Universal Time) https://phppot.com/php/simple-php-shopping-cart/

#php
star

Sat Jan 15 2022 10:43:41 GMT+0000 (Coordinated Universal Time) https://phppot.com/php/simple-php-shopping-cart/

#php
star

Sat Jan 15 2022 00:14:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47224791/display-product-prices-with-a-shortcode-by-product-id-in-woocommerce

#php #woocommerce
star

Fri Jan 14 2022 11:26:54 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Fri Jan 14 2022 08:50:22 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Fri Jan 14 2022 08:49:31 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Jan 13 2022 20:52:16 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Jan 13 2022 16:00:55 GMT+0000 (Coordinated Universal Time) https://www.ryansutana.name/2012/07/how-to-include-jquery-and-css-in-wordpress-the-wordpress-way/

#php
star

Wed Jan 12 2022 22:17:41 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Wed Jan 12 2022 14:52:58 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Wed Jan 12 2022 14:52:18 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Tue Jan 11 2022 14:53:09 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jan 10 2022 12:32:25 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Jan 10 2022 12:06:29 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Jan 09 2022 19:52:49 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Jan 09 2022 19:52:07 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Jan 09 2022 19:51:34 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Jan 09 2022 16:38:10 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sat Jan 08 2022 13:59:33 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sat Jan 08 2022 05:57:18 GMT+0000 (Coordinated Universal Time) https://gist.github.com/juliyvchirkov/2c5c8d54b182528e39d4565d1632f8ee#file-magentodocumentroot-php

#php #magento #document_root #resolve #module #include
star

Thu Jan 06 2022 14:52:48 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Jan 06 2022 08:39:33 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Tue Jan 04 2022 19:59:01 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Jan 03 2022 14:46:05 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Jan 03 2022 14:20:43 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Dec 27 2021 16:15:10 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/8006692/get-current-date-given-a-timezone-in-php

#php
star

Mon Dec 27 2021 14:57:51 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Dec 27 2021 14:57:06 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Dec 26 2021 17:24:00 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Dec 26 2021 17:23:20 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Dec 26 2021 17:17:51 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Dec 26 2021 11:29:30 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Sun Dec 26 2021 08:30:15 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Dec 22 2021 23:16:29 GMT+0000 (Coordinated Universal Time) https://es.stackoverflow.com/questions/505679/para-los-que-conocen-wordpress-y-creadores-de-temas/505704#505704

#wordpress #html #php
star

Tue Dec 21 2021 20:33:20 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Dec 20 2021 12:19:02 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Mon Dec 20 2021 12:17:31 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Fri Dec 17 2021 17:46:27 GMT+0000 (Coordinated Universal Time) https://make.wordpress.org/themes/2021/12/15/reminder-if-your-theme-integrates-with-external-plugins-make-sure-that-they-are-available-before-trying-to-use-them/

#php #wordpress
star

Fri Dec 17 2021 13:35:42 GMT+0000 (Coordinated Universal Time) https://code.mukto.info/wordpress-ajax-search-without-plugin/

#php #ajax
star

Fri Dec 17 2021 00:51:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/28600330/format-timezone-for-carbon-date

#php #dates #timezone
star

Thu Dec 16 2021 14:52:00 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Dec 16 2021 14:51:34 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Thu Dec 16 2021 14:51:00 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Wed Dec 15 2021 13:52:07 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Sun Dec 12 2021 14:07:55 GMT+0000 (Coordinated Universal Time)

#drupal #php
star

Tue Dec 07 2021 02:22:13 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Dec 06 2021 20:54:35 GMT+0000 (Coordinated Universal Time) https://www.drupal.org/project/drupal/issues/3099148

#php #drupal
star

Mon Dec 06 2021 07:40:04 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Dec 03 2021 12:23:07 GMT+0000 (Coordinated Universal Time)

#php #drupal
star

Fri Dec 03 2021 09:54:48 GMT+0000 (Coordinated Universal Time)

#php #drupal
star

Fri Dec 03 2021 08:29:37 GMT+0000 (Coordinated Universal Time)

#php #javascript
star

Thu Dec 02 2021 08:07:22 GMT+0000 (Coordinated Universal Time) https://laravel-news.com/laravel-8-74-0

#php #laravel
star

Thu Dec 02 2021 08:04:47 GMT+0000 (Coordinated Universal Time) https://laravel-news.com/laravel-8-74-0

#php #laravel
star

Thu Dec 02 2021 08:00:24 GMT+0000 (Coordinated Universal Time) https://laravel-news.com/laravel-8-74-0

#php #laravel
star

Thu Dec 02 2021 07:54:36 GMT+0000 (Coordinated Universal Time) https://laravel-news.com/laravel-8-74-0

#php #laravel
star

Thu Dec 02 2021 07:50:26 GMT+0000 (Coordinated Universal Time) https://laravel-news.com/laravel-8-74-0

#php #laravel
star

Thu Dec 02 2021 07:47:42 GMT+0000 (Coordinated Universal Time) https://laravel-news.com/laravel-8-74-0

#php #laravel
star

Fri Nov 26 2021 19:26:12 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Nov 26 2021 19:23:46 GMT+0000 (Coordinated Universal Time) https://www.php.net/manual/en/pdo.construct.php

#php
star

Wed Nov 24 2021 19:03:48 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/61816556/laravel-artisan-tinker-from-amazon-linux-2-elastic-beanstalk

#php #elasticbeanstalk #laravel
star

Wed Nov 24 2021 17:49:00 GMT+0000 (Coordinated Universal Time)

#php #composer #mariadb #pimcore-6.9.0
star

Wed Nov 24 2021 16:39:26 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/51443557/how-to-install-php-composer-inside-a-docker-container

#php
star

Thu Nov 18 2021 20:18:27 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42244541/laravel-migration-error-syntax-error-or-access-violation-1071-specified-key-wa

#php #laravel
star

Thu Nov 18 2021 03:26:39 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Nov 18 2021 03:26:13 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Nov 18 2021 03:18:48 GMT+0000 (Coordinated Universal Time)

#wordpress #php #gutenberg
star

Thu Nov 18 2021 03:18:21 GMT+0000 (Coordinated Universal Time)

#php #gutenberg #wordpress
star

Thu Nov 18 2021 02:32:53 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Thu Nov 18 2021 02:27:34 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php #laravel
star

Tue Nov 16 2021 11:37:21 GMT+0000 (Coordinated Universal Time)

#docker #nginx #php #phpfm
star

Tue Nov 09 2021 18:31:10 GMT+0000 (Coordinated Universal Time) https://hopeforsd.org/events

#php
star

Tue Nov 09 2021 18:30:40 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Nov 09 2021 01:05:17 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Nov 08 2021 23:50:49 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Nov 08 2021 23:47:29 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Nov 07 2021 17:47:19 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Nov 04 2021 11:35:16 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Oct 31 2021 20:59:14 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Oct 29 2021 04:36:51 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/8.x/middleware

#php #laravel
star

Mon Oct 25 2021 06:55:32 GMT+0000 (Coordinated Universal Time) https://github.com/srikat/my-custom-functionality/blob/master/plugin.php

#wordpress #mu-plugins #php
star

Mon Oct 25 2021 06:36:11 GMT+0000 (Coordinated Universal Time) https://www.sitepoint.com/wordpress-mu-plugins/

#wordpress #php #mu-plugins
star

Mon Oct 25 2021 04:21:40 GMT+0000 (Coordinated Universal Time)

#wordpress #php #wp-config
star

Mon Oct 25 2021 04:15:43 GMT+0000 (Coordinated Universal Time)

#wordpress #php #wp-config
star

Mon Oct 25 2021 03:40:24 GMT+0000 (Coordinated Universal Time) https://github.com/WebDevStudios/WDS-Required-Plugins

#wordpress #php #plugin
star

Sun Oct 24 2021 22:44:08 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 23 2021 23:13:28 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Oct 23 2021 22:09:30 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Oct 22 2021 20:49:54 GMT+0000 (Coordinated Universal Time) https://maugelves.com/como-agregar-async-o-defer-a-los-scripts-en-wordpress/

#php #async
star

Fri Oct 22 2021 19:26:41 GMT+0000 (Coordinated Universal Time) https://www.devmedia.com.br/crud-com-php-pdo/28873

#php
star

Fri Oct 22 2021 18:48:32 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Oct 22 2021 18:20:56 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Oct 22 2021 16:30:17 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/reference/functions/add_action/

#php #wordpress #functions #documentation #prority
star

Fri Oct 22 2021 13:28:15 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Oct 21 2021 21:39:53 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Oct 20 2021 23:37:10 GMT+0000 (Coordinated Universal Time) crackshack.com

#php
star

Fri Oct 15 2021 18:16:09 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/30686880/laravel-firstornew-how-to-check-if-its-first-or-new

#php
star

Fri Oct 15 2021 14:29:30 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/2910611/php-sort-a-multidimensional-array-by-element-containing-date/2910642

#php
star

Thu Oct 07 2021 20:09:32 GMT+0000 (Coordinated Universal Time)

#javascript #jquery #php #html
star

Thu Oct 07 2021 08:04:20 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Oct 03 2021 01:16:58 GMT+0000 (Coordinated Universal Time) https://www.postgresql.org/docs/

#php #sql #postgresql
star

Thu Sep 30 2021 21:00:53 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/53532424/how-to-enable-animate-css-in-wordpress

#php
star

Thu Sep 30 2021 17:10:31 GMT+0000 (Coordinated Universal Time)

#php #laravel #querybuilder
star

Mon Sep 27 2021 01:38:18 GMT+0000 (Coordinated Universal Time) https://babiato.co/threads/wp-content-pilot-pro-best-wordpress-autoblog-affiliate-marketing-plugin.30824/

#php
star

Fri Sep 24 2021 17:36:04 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Sep 24 2021 15:22:07 GMT+0000 (Coordinated Universal Time) https://www.humblix.com/Wxmew2p/in-php-how-to-check-if-a-multidimensional-array-is-empty

#php
star

Tue Sep 21 2021 15:18:57 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/8754980/convert-array-of-single-element-arrays-to-one-a-dimensional-array

#php
star

Thu Sep 16 2021 08:36:20 GMT+0000 (Coordinated Universal Time)

#php #sort #array
star

Tue Sep 14 2021 20:54:34 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/13469803/php-merging-two-arrays-into-one-array-also-remove-duplicates

#php
star

Wed Sep 08 2021 23:52:36 GMT+0000 (Coordinated Universal Time) https://www.itsolutionstuff.com/post/laravel-5-inner-join-with-multiple-conditions-example-using-query-builderexample.html

#php
star

Wed Sep 01 2021 13:20:42 GMT+0000 (Coordinated Universal Time) https://docs.wp-rocket.me/article/1280-customize-access-to-options-for-user-roles#custom-code

#php
star

Wed Aug 25 2021 16:19:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/36241924/laravel-model-error-handling-when-creating

#php
star

Wed Aug 25 2021 11:54:18 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Aug 25 2021 11:33:31 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Aug 19 2021 11:00:37 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Aug 17 2021 17:28:48 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/7.x/migrations

#php
star

Sat Aug 14 2021 22:26:45 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Aug 04 2021 17:05:38 GMT+0000 (Coordinated Universal Time) https://wpglorify.com/show-total-savings/

#php
star

Tue Aug 03 2021 15:54:10 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14179758/how-can-i-build-a-condition-based-query-in-laravel

#php
star

Tue Aug 03 2021 04:36:57 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/51487769/how-to-insert-big-data-on-the-laravel

#php
star

Mon Aug 02 2021 15:49:52 GMT+0000 (Coordinated Universal Time) https://wordpress.org/support/topic/how-to-increase-product-variation-limit-in-woo-commerce/

#php
star

Mon Aug 02 2021 08:20:32 GMT+0000 (Coordinated Universal Time) https://seodoityourself.co.il/איך-להוסיף-תמונת-מוצר-להזמנות-של-ווקומ/

#php
star

Fri Jul 30 2021 00:28:21 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/8.x/eloquent-relationships#many-to-many

#php #laravel
star

Thu Jul 22 2021 22:02:00 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 22:01:24 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 22:00:52 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 22:00:00 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 21:59:18 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 21:58:35 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 21:58:03 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 21:57:46 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Jul 22 2021 21:41:14 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:40:33 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:40:00 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:37:52 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:35:05 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:33:06 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:32:52 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:31:28 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:30:27 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:30:09 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:29:49 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:28:57 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:28:38 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:28:09 GMT+0000 (Coordinated Universal Time) https://borishoekmeijer.nl/tutorials/wordpress-snippet-collection/

#php
star

Thu Jul 22 2021 21:24:54 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Thu Jul 22 2021 21:23:10 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Thu Jul 22 2021 21:21:50 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Thu Jul 22 2021 21:21:21 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Thu Jul 22 2021 18:28:01 GMT+0000 (Coordinated Universal Time) https://colorfield.be/blog/lando-configuration-solr7-drupal8-search-api-umami-profile

#php #solr
star

Fri Jul 09 2021 06:51:40 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Jul 07 2021 19:35:03 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jul 02 2021 14:44:10 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/8.x/artisan

#php
star

Fri Jun 18 2021 21:20:10 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/49073558/laravel-5-6-upgrade-caused-logging-to-break

#php
star

Wed Jun 16 2021 06:59:05 GMT+0000 (Coordinated Universal Time) https://iconicwp.com/docs/woocommerce-attribute-swatches/disable-grey-out-out-of-stock-swatches/

#php
star

Fri Jun 11 2021 20:56:52 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:56:24 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:55:48 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:55:16 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:54:44 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:54:08 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:53:36 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Fri Jun 11 2021 20:52:59 GMT+0000 (Coordinated Universal Time)

#bash #php
star

Fri Jun 11 2021 20:47:49 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jun 11 2021 20:36:55 GMT+0000 (Coordinated Universal Time)

#laravel #php
star

Tue Jun 08 2021 20:16:08 GMT+0000 (Coordinated Universal Time)

#php #debugging
star

Fri Jun 04 2021 14:42:19 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/31948980/how-to-call-a-controller-function-in-another-controller-in-laravel-5/31949144

#php
star

Fri Jun 04 2021 14:41:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/30365169/access-controller-method-from-another-controller-in-laravel-5

#php
star

Wed May 26 2021 10:14:35 GMT+0000 (Coordinated Universal Time) https://www.johnparris.com/exclude-certain-pages-from-wordpress-search-results/

#php #wordpress
star

Fri May 21 2021 08:43:46 GMT+0000 (Coordinated Universal Time)

#php
star

Thu May 20 2021 16:00:44 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/39508963/calculate-difference-between-two-dates-using-carbon-and-blade

#php
star

Wed May 19 2021 09:36:41 GMT+0000 (Coordinated Universal Time)

#php #javasc #html #python
star

Wed May 19 2021 09:35:33 GMT+0000 (Coordinated Universal Time)

#php #javasc #html #python
star

Thu May 13 2021 21:59:34 GMT+0000 (Coordinated Universal Time) https://www.clevelandwebdeveloper.com/code-snippets/wordpress-add-allowed-file-types/

#php #wordpress
star

Thu May 13 2021 15:05:08 GMT+0000 (Coordinated Universal Time) https://www.tychesoftwares.com/how-to-add-plus-and-minus-buttons-to-the-quantity-input-on-the-product-page-in-woocommerce/

#php #wordpress
star

Thu May 13 2021 10:01:16 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Wed May 12 2021 22:38:25 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Wed May 12 2021 22:38:09 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Wed May 12 2021 22:37:45 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Wed May 12 2021 22:37:16 GMT+0000 (Coordinated Universal Time)

#php #wordpress #elementor
star

Wed May 12 2021 22:36:52 GMT+0000 (Coordinated Universal Time)

#php #wordpress #elementor
star

Wed May 12 2021 22:36:18 GMT+0000 (Coordinated Universal Time)

#php #wordpress #elementor
star

Tue May 11 2021 11:34:49 GMT+0000 (Coordinated Universal Time)

#javascript #php #jquery
star

Sun May 09 2021 12:44:01 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php
star

Fri May 07 2021 18:34:56 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri May 07 2021 18:34:23 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri May 07 2021 18:33:50 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri May 07 2021 18:26:52 GMT+0000 (Coordinated Universal Time)

#php #wordpress #woocomerce
star

Fri May 07 2021 18:26:02 GMT+0000 (Coordinated Universal Time)

#php #wordpress #woocomerce
star

Fri May 07 2021 18:25:16 GMT+0000 (Coordinated Universal Time)

#php #wordpress #woocomerce
star

Fri May 07 2021 18:24:18 GMT+0000 (Coordinated Universal Time)

#php #wordpress #woocomerce
star

Fri May 07 2021 18:21:47 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri May 07 2021 18:15:24 GMT+0000 (Coordinated Universal Time) https://wpdev.co.il/%d7%94%d7%92%d7%93%d7%a8%d7%94-%d7%90%d7%95%d7%98%d7%95%d7%9e%d7%98%d7%99%d7%aa-%d7%a9%d7%9c-%d7%9b%d7%95%d7%aa%d7%a8%d7%aa-alt-%d7%9b%d7%99%d7%aa%d7%95%d7%91-%d7%95%d7%aa%d7%99%d7%90%d7%95%d7%a8/

#php #wordpress
star

Fri May 07 2021 18:14:11 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Apr 30 2021 16:50:58 GMT+0000 (Coordinated Universal Time) https://www.php.net/manual/en/function.implode.php

#php
star

Fri Apr 30 2021 16:50:09 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/8.x/queries

#php
star

Thu Apr 29 2021 12:16:52 GMT+0000 (Coordinated Universal Time)

#javascript #php #jquery
star

Thu Apr 29 2021 09:35:44 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/46391808/get-current-route-in-symfony-3-3-and-twig

#php #symfony
star

Wed Apr 28 2021 12:54:09 GMT+0000 (Coordinated Universal Time)

#javascript #php #jquery
star

Sat Apr 24 2021 11:46:58 GMT+0000 (Coordinated Universal Time) https://htmlweb.ru/php/example/image_box2.php

#php
star

Sat Apr 24 2021 11:45:45 GMT+0000 (Coordinated Universal Time) https://htmlweb.ru/php/example/image_to_bw.php

#php
star

Mon Apr 19 2021 13:00:09 GMT+0000 (Coordinated Universal Time)

#php #javascript
star

Wed Apr 14 2021 17:22:37 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/30175559/php-how-to-check-which-item-in-an-array-is-closest-to-a-given-number

#php
star

Tue Apr 13 2021 22:29:07 GMT+0000 (Coordinated Universal Time) https://www.smashingmagazine.com/2016/07/how-to-make-wordpress-hard-for-clients-to-mess-up/

#php
star

Tue Apr 13 2021 19:15:46 GMT+0000 (Coordinated Universal Time) https://formvalidation.io/guide/examples/integrating-with-bootbox/

#php #jquery
star

Tue Apr 13 2021 04:01:31 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Apr 13 2021 03:05:48 GMT+0000 (Coordinated Universal Time)

#php #javasc #html
star

Tue Apr 13 2021 03:04:46 GMT+0000 (Coordinated Universal Time)

#php #javasc #html
star

Tue Apr 13 2021 03:04:11 GMT+0000 (Coordinated Universal Time)

#php #javasc #html
star

Tue Apr 13 2021 03:03:13 GMT+0000 (Coordinated Universal Time)

#php #javasc #html
star

Tue Apr 13 2021 03:01:42 GMT+0000 (Coordinated Universal Time)

#php #javasc #html
star

Tue Apr 13 2021 03:00:27 GMT+0000 (Coordinated Universal Time)

#php #java #javasc #html
star

Mon Apr 12 2021 14:02:26 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Apr 12 2021 09:41:59 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Apr 11 2021 02:54:36 GMT+0000 (Coordinated Universal Time)

#php #java #javasc #html
star

Sun Apr 11 2021 02:40:41 GMT+0000 (Coordinated Universal Time)

#php #java #javasc #html
star

Sun Apr 11 2021 01:52:04 GMT+0000 (Coordinated Universal Time)

#php #java #javasc #html
star

Fri Apr 09 2021 16:03:21 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Apr 08 2021 12:12:31 GMT+0000 (Coordinated Universal Time) https://www.robbertvermeulen.com/wp_get_nav_menu_items-current-menu-item/

#php
star

Thu Apr 08 2021 12:11:32 GMT+0000 (Coordinated Universal Time) https://www.robbertvermeulen.com/wp_get_nav_menu_items-current-menu-item/

#php
star

Wed Apr 07 2021 15:28:59 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/15016725/how-to-get-closest-date-compared-to-an-array-of-dates-in-php

#php
star

Tue Apr 06 2021 20:22:31 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

#php #laravel
star

Tue Apr 06 2021 13:12:16 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Apr 06 2021 12:42:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47151886/how-can-i-run-specific-migration-in-laravel

#laravel #php
star

Sun Apr 04 2021 19:15:12 GMT+0000 (Coordinated Universal Time) https://chrislloyd.co/fixing-laravel-php-8-error-unknown-named-parameter-error/

#php
star

Thu Apr 01 2021 13:00:44 GMT+0000 (Coordinated Universal Time)

#php #css
star

Wed Mar 31 2021 16:52:41 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Mar 30 2021 16:45:25 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Mar 29 2021 16:38:03 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Mar 29 2021 15:28:52 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Mar 27 2021 11:46:04 GMT+0000 (Coordinated Universal Time)

#php #regex
star

Fri Mar 26 2021 05:17:17 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Mar 25 2021 16:15:29 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Mar 23 2021 17:18:57 GMT+0000 (Coordinated Universal Time) https://support.advancedcustomfields.com/forums/topic/how-to-get-repeater-data-to-be-used-as-a-select/

#php
star

Wed Mar 17 2021 08:33:26 GMT+0000 (Coordinated Universal Time) https://qiita.com/revenue-hack/items/f90fa5a7d4352d0bbc3f

#laravel #php
star

Fri Mar 12 2021 17:02:15 GMT+0000 (Coordinated Universal Time) https://hotexamples.com/examples/-/-/wp_mail/php-wp_mail-function-examples.html

#php
star

Fri Mar 12 2021 08:24:20 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Mar 11 2021 16:17:14 GMT+0000 (Coordinated Universal Time) https://codeanywhere.com/editor/

#php #css #javascript
star

Thu Mar 11 2021 16:03:49 GMT+0000 (Coordinated Universal Time)

#php #css
star

Thu Mar 11 2021 06:41:43 GMT+0000 (Coordinated Universal Time) https://laracasts.com/discuss/channels/eloquent/how-to-delete-multiple-records-using-laravel-eloquent

#laravel #php
star

Wed Mar 10 2021 06:42:15 GMT+0000 (Coordinated Universal Time) https://codex.wordpress.org/Data_Validation

#php
star

Wed Mar 10 2021 06:35:16 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Mar 10 2021 06:30:42 GMT+0000 (Coordinated Universal Time) https://github.com/CMB2/CMB2/wiki/Basic-Usage

#php
star

Wed Mar 10 2021 06:29:56 GMT+0000 (Coordinated Universal Time) https://github.com/CMB2/CMB2/wiki/Basic-Usage

#php
star

Mon Feb 22 2021 14:14:21 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/4366730/how-do-i-check-if-a-string-contains-a-specific-word

#php
star

Thu Feb 18 2021 17:47:53 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 18 2021 16:33:24 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 18 2021 16:11:29 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Feb 18 2021 15:22:20 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/57985564/laravel5-8-the-get-method-is-not-supported-for-this-route-supported-methods-p

#php #save #laravel
star

Wed Feb 10 2021 23:12:50 GMT+0000 (Coordinated Universal Time)

#html,signature #php
star

Fri Feb 05 2021 11:31:47 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/27330650/how-to-display-time-in-x-days-ago-in-php/27330857

#php
star

Thu Feb 04 2021 20:47:06 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Feb 02 2021 17:47:46 GMT+0000 (Coordinated Universal Time) https://www.php.net/manual/en/function.array-column.php

#php
star

Tue Feb 02 2021 17:41:05 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/29115385/how-to-make-laravel-eloquent-in-query

#php
star

Tue Feb 02 2021 17:39:52 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/22925451/how-can-i-query-raw-via-eloquent/28174112

#php
star

Tue Feb 02 2021 15:33:48 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Jan 19 2021 15:41:53 GMT+0000 (Coordinated Universal Time) https://codeofaninja.com/2014/06/google-maps-geocoding-example-php.html

#php
star

Mon Jan 18 2021 16:03:17 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/4356289/php-random-string-generator

#php
star

Fri Jan 15 2021 15:59:55 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41521837/laravel-5-3-clear-config-cache-in-shared-hosting

#php
star

Fri Jan 15 2021 13:28:09 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Tue Jan 12 2021 05:26:01 GMT+0000 (Coordinated Universal Time) https://www.taniarascia.com/how-to-use-json-data-with-php-or-javascript/

#php
star

Mon Jan 11 2021 22:13:38 GMT+0000 (Coordinated Universal Time) https://phpenthusiast.com/blog/parse-html-with-php-domdocument

#php
star

Tue Jan 05 2021 08:48:30 GMT+0000 (Coordinated Universal Time)

##js #php
star

Sat Jan 02 2021 12:11:36 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Jan 02 2021 12:03:07 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jan 01 2021 08:41:33 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jan 01 2021 08:41:33 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jan 01 2021 08:29:00 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jan 01 2021 08:25:41 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Jan 01 2021 07:43:06 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Dec 27 2020 13:24:48 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Dec 24 2020 11:49:03 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Dec 23 2020 22:15:28 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Dec 22 2020 09:21:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/37085102/laravel-valet-install-not-found

#php
star

Sun Dec 20 2020 21:33:51 GMT+0000 (Coordinated Universal Time)

#php
star

Sat Dec 19 2020 21:10:46 GMT+0000 (Coordinated Universal Time) https://www.thedevfiles.com/2014/09/building-a-simple-contact-form-in-php-part-2

#php
star

Wed Dec 02 2020 05:07:39 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/53062258/php-recursive-function-for-genealogical-tree/53064551

#php
star

Tue Dec 01 2020 05:30:30 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/8.x/migrations

#php
star

Mon Nov 30 2020 14:23:00 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/8754980/how-to-convert-two-dimensional-array-to-one-dimensional-array-in-php5

#php #array
star

Thu Nov 26 2020 14:52:26 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Nov 26 2020 14:50:56 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Nov 25 2020 14:39:33 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Nov 25 2020 14:38:59 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Nov 25 2020 14:36:11 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Nov 22 2020 14:36:28 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Nov 22 2020 14:36:11 GMT+0000 (Coordinated Universal Time)

#php
star

Sun Nov 22 2020 14:35:24 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Nov 20 2020 12:52:23 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Nov 20 2020 12:51:43 GMT+0000 (Coordinated Universal Time)

#php
star

Thu Nov 19 2020 14:12:09 GMT+0000 (Coordinated Universal Time)

#html #php
star

Wed Nov 18 2020 04:14:04 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/54432059/laravel-valet-logs

#php
star

Tue Nov 17 2020 20:39:56 GMT+0000 (Coordinated Universal Time) https://www.leaseweb.com/labs/2015/10/creating-a-simple-rest-api-in-php/

#php
star

Tue Nov 17 2020 14:06:24 GMT+0000 (Coordinated Universal Time)

#php #javascript
star

Thu Nov 12 2020 22:59:58 GMT+0000 (Coordinated Universal Time) https://support.advancedcustomfields.com/forums/topic/query-posts-via-taxonomy-field/

#php
star

Thu Nov 05 2020 04:49:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/59335911/how-to-install-old-version-of-composer

#php
star

Wed Nov 04 2020 22:58:43 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/40276967/uninstall-laravel-valet

#php
star

Wed Nov 04 2020 08:31:33 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1555862/how-can-i-get-php-to-return-500-upon-encountering-a-fatal-exception/8851820

#php
star

Wed Nov 04 2020 08:27:07 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3052715/how-to-return-an-http-500-code-on-any-error-no-matter-what

#php
star

Tue Nov 03 2020 11:29:25 GMT+0000 (Coordinated Universal Time)

#php
star

Tue Nov 03 2020 07:57:15 GMT+0000 (Coordinated Universal Time)

#html #php
star

Thu Oct 29 2020 15:48:38 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/14037290/what-does-this-mean-in-php-or

#php
star

Sat Oct 24 2020 09:59:54 GMT+0000 (Coordinated Universal Time) https://jsfiddle.net/

#php #taxonomy
star

Sat Oct 10 2020 15:31:37 GMT+0000 (Coordinated Universal Time) https://intranet.kshp.ch/dokumente/broschueren-hopro-intern

#php
star

Sat Oct 10 2020 15:31:03 GMT+0000 (Coordinated Universal Time) https://intranet.kshp.ch/dokumente/broschueren-hopro-intern

#php
star

Wed Oct 07 2020 20:56:30 GMT+0000 (Coordinated Universal Time) https://github.com/zircote/swagger-php

#docker #swagger #php
star

Tue Oct 06 2020 21:25:15 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1070244/how-to-determine-the-first-and-last-iteration-in-a-foreach-loop

#php
star

Fri Oct 02 2020 12:02:13 GMT+0000 (Coordinated Universal Time) Fuck men

#php #html #blade
star

Fri Oct 02 2020 03:24:40 GMT+0000 (Coordinated Universal Time)

#php #laravel
star

Thu Oct 01 2020 06:29:28 GMT+0000 (Coordinated Universal Time)

#javascript #css #html #php
star

Wed Sep 30 2020 12:02:11 GMT+0000 (Coordinated Universal Time)

#php #functions
star

Thu Sep 17 2020 11:32:22 GMT+0000 (Coordinated Universal Time)

#php
star

Wed Sep 02 2020 10:27:42 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47342481/simple-html-dom-scraping-error-notice-trying-to-get-property-of-non-object-in/47343369

#php
star

Thu Aug 27 2020 14:17:42 GMT+0000 (Coordinated Universal Time)

#php #codeigniter #jquery
star

Wed Aug 26 2020 16:08:48 GMT+0000 (Coordinated Universal Time)

#php #wordpress
star

Fri Aug 21 2020 14:40:19 GMT+0000 (Coordinated Universal Time)

#php #codeigniter4
star

Sat Aug 08 2020 16:25:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/13283674/how-to-ping-ip-addresses-in-php-and-give-results

#php
star

Fri Aug 07 2020 09:11:39 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/3975585/search-for-a-key-in-an-array-recursively

#php
star

Wed Jun 24 2020 09:51:02 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/convert-accented-characters/

#php
star

Mon Jun 22 2020 13:14:31 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/extract-email-addresses/

#php
star

Mon Jun 22 2020 13:13:18 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/variable-variables/

#php
star

Mon Jun 22 2020 13:02:38 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/get-users-ip-address/

#php
star

Mon Jun 22 2020 13:02:05 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/test-if-string-starts-with-certain-characters-in-php/

#php
star

Sun Jun 21 2020 13:31:54 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/9632392/get-mysql-database-entries-within-last-week

#mys #php
star

Wed Jun 10 2020 17:50:55 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/41667871/how-do-i-allow-a-single-wordpress-site-to-accept-my-ttf-file-upload

#php
star

Sat Jun 06 2020 15:29:35 GMT+0000 (Coordinated Universal Time) https://www.codewall.co.uk/how-to-automatically-make-a-mysql-input-form-with-php/?utm_source=CWTwitter

#php
star

Sat Jun 06 2020 15:23:27 GMT+0000 (Coordinated Universal Time) https://www.codewall.co.uk/how-to-automatically-make-a-mysql-input-form-with-php/?utm_source=CWTwitter

#php
star

Fri Jun 05 2020 20:36:29 GMT+0000 (Coordinated Universal Time) https://ltheme.com/how-to-quicken-a-slow-site-with-elementor-page-builder/

#php
star

Fri Jun 05 2020 06:35:17 GMT+0000 (Coordinated Universal Time) https://makersbyte.com/how-to-change-number-of-products-display-in-woocommerce-product-listing-page/

#php
star

Tue Jun 02 2020 03:52:39 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/random-hex-color/

#php
star

Mon Jun 01 2020 05:59:54 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/display-a-user-gravatar-from-email-address/

#php
star

Mon Jun 01 2020 05:58:28 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/convert-accented-characters/

#php
star

Fri May 29 2020 13:09:12 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/test-if-string-starts-with-certain-characters-in-php/

#javascript #php
star

Fri May 29 2020 11:29:28 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/62083689/how-to-decrypt-rijndael-256-in-python-used-in-quickbooks-php-api

#php
star

Fri May 29 2020 10:09:17 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/display-a-user-gravatar-from-email-address/

#php
star

Fri May 29 2020 10:07:44 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/snippets/php/test-if-string-starts-with-certain-characters-in-php/

#javascript #php
star

Thu May 28 2020 22:22:31 GMT+0000 (Coordinated Universal Time) https://www.grahamethomson.com/2018/10/07/rename-coupon-code-text-in-woocommerce/

#php
star

Wed May 20 2020 19:53:26 GMT+0000 (Coordinated Universal Time)

#php
star

Mon May 11 2020 14:51:53 GMT+0000 (Coordinated Universal Time) https://laravel.com/docs/7.x/database

#php
star

Fri Mar 06 2020 19:34:15 GMT+0000 (Coordinated Universal Time)

#php
star

Fri Mar 06 2020 19:31:17 GMT+0000 (Coordinated Universal Time)

#php
star

Mon Feb 17 2020 07:36:12 GMT+0000 (Coordinated Universal Time)

#android #php
star

Thu Feb 06 2020 12:35:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/42108036/how-to-disable-cash-on-delivery-on-some-specific-products-in-woocommerce

#php
star

Sat Jan 04 2020 18:42:11 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/2167916/convert-one-date-format-into-another-in-php

#php #webdev #howto
star

Thu Dec 26 2019 15:18:45 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/program-count-numbers-fingers/

#php #interesting #interviewquestions #logic
star

Wed Dec 25 2019 13:48:42 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/find-nth-magic-number/

#php #interviewquestions #makethisbetter
star

https://stackoverflow.com/a/10368236/7286945

#php

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension