Skip to content

Commit

Permalink
esc echo variables
Browse files Browse the repository at this point in the history
  • Loading branch information
parisnakitakejser committed Jan 27, 2022
1 parent 9a5cecf commit 8d27d15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/Controllers/AdminSettingsPage_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function () use ($options) {
echo '<input
type="text"
name="' . $this->_prefix . 'settings[endpoint]"
value="' . ($options['endpoint'] ?? '') . '">
value="' . esc_attr(($options['endpoint'] ?? '')) . '">
';
},
'pluginPage',
Expand All @@ -56,7 +56,7 @@ function () use ($options) {
echo '<input
type="text"
name="' . $this->_prefix . 'settings[webhook_key]"
value="' . ($options['webhook_key'] ?? '') . '">
value="' . esc_attr(($options['webhook_key'] ?? '')) . '">
';
},
'pluginPage',
Expand All @@ -70,7 +70,7 @@ function () use ($options) {
echo '<input
type="text"
name="' . $this->_prefix . 'settings[nonce_key]"
value="' . ($options['nonce_key'] ?? '') . '">
value="' . esc_attr(($options['nonce_key'] ?? '')) . '">
';
},
'pluginPage',
Expand Down
10 changes: 2 additions & 8 deletions src/Controllers/CLI/Stock_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function execute()

if ($products->status === 200) {
foreach ($products->data as $val) {
echo 'SKU: ' . $val->sku . "\n";
// Product lookup, if exists, update stock, if not skip product!
$product_data = get_posts([
'post_type' => 'product',
Expand All @@ -27,22 +26,17 @@ function execute()
]);

if (!empty($product_data)) {
echo 'ProductID: ' . $product_data[0]->ID . "\n";
echo 'Stock: ' . $val->totalCombined . "\n";

$product = new \WC_Product($product_data[0]->ID);
$product->set_manage_stock(true);
$product->save();

wc_update_product_stock($product_data[0]->ID, $val->totalCombined);
} else {
echo "not found!\n";
// Not found
}

echo "\n";
}
} else {
echo 'error';
// Error
}
}
}

0 comments on commit 8d27d15

Please sign in to comment.