Skip to content

Commit

Permalink
Change prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
James Kemp committed Mar 12, 2018
1 parent 5ee9ce8 commit b350a26
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 148 deletions.
2 changes: 1 addition & 1 deletion callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$consumer_key = filter_var( $post_data->consumer_key, FILTER_SANITIZE_STRING );
$consumer_secret = filter_var( $post_data->consumer_secret, FILTER_SANITIZE_STRING );

$insert_user_keys = jck_db_insert_user_keys( $user_id, $consumer_key, $consumer_secret );
$insert_user_keys = iconic_db_insert_user_keys( $user_id, $consumer_key, $consumer_secret );

if ( ! $insert_user_keys ) {
http_response_code( 500 );
Expand Down
28 changes: 14 additions & 14 deletions connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@

require_once( $_SERVER['DOCUMENT_ROOT'] . '/inc/setup.php' );

if ( ! jck_verify_form_token( 'jck-connect' ) ) {
jck_add_notice( 'Could not verify form token.' );
header( "Location: " . jck_get_app_url() );
if ( ! iconic_verify_form_token( 'jck-connect' ) ) {
iconic_add_notice( 'Could not verify form token.' );
header( "Location: " . iconic_get_app_url() );
die();
}

$url = filter_input( INPUT_POST, 'store_url', FILTER_SANITIZE_URL );

if ( empty( $url ) ) {
jck_add_notice( 'The URL was invalid.' );
header( "Location: " . jck_get_app_url() );
iconic_add_notice( 'The URL was invalid.' );
header( "Location: " . iconic_get_app_url() );
die();
}

$url = jck_add_trailing_slash( $url );
$auth_url = $url . jck_get_authorize_path();
$auth_url = jck_add_auth_params( $auth_url );
$url = iconic_add_trailing_slash( $url );
$auth_url = $url . iconic_get_authorize_path();
$auth_url = iconic_add_auth_params( $auth_url );

if ( ! jck_url_exists( $auth_url ) ) {
jck_add_notice( 'The URL was invalid.' );
header( "Location: " . jck_get_app_url() );
if ( ! iconic_url_exists( $auth_url ) ) {
iconic_add_notice( 'The URL was invalid.' );
header( "Location: " . iconic_get_app_url() );
die();
}

$insert_store_url = jck_db_insert_store_url( $url );
$insert_store_url = iconic_db_insert_store_url( $url );

if ( ! $insert_store_url ) {
jck_add_notice( 'The connection failed, please try again.', 'warning' );
header( "Location: " . jck_get_app_url() );
iconic_add_notice( 'The connection failed, please try again.', 'warning' );
header( "Location: " . iconic_get_app_url() );
die();
}

Expand Down
8 changes: 4 additions & 4 deletions customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<h1>Customers</h1>
</div>

<?php jck_display_notices(); ?>
<?php iconic_display_notices(); ?>

<?php $customers = jck_api_get_collection( 'customers', array(
<?php $customers = iconic_api_get_collection( 'customers', array(
'orderby' => 'id',
) ); ?>

Expand Down Expand Up @@ -34,7 +34,7 @@
<td><?php echo $customer->total_spent; ?></td>
<td>
<a href="/edit-customer.php?id=<?php echo $customer->id; ?>" class="btn btn-default">Edit</a>
<a href="<?php echo jck_get_current_url( array(
<a href="<?php echo iconic_get_current_url( array(
'action' => 'delete_collection_item',
'type' => 'customers',
'id' => $customer->id,
Expand All @@ -45,7 +45,7 @@
</tbody>
</table>

<?php jck_display_pagination_links( 'customers' ); ?>
<?php iconic_display_pagination_links( 'customers' ); ?>
<?php } else { ?>
<div class="alert alert-warning" role="alert">
<p>Sorry, no customers were found.</p>
Expand Down
4 changes: 2 additions & 2 deletions disconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_once( $_SERVER['DOCUMENT_ROOT'] . '/inc/setup.php' );

$delete_keys = jck_delete_user_keys();
$delete_keys = iconic_delete_user_keys();

header( "Location: " . jck_get_app_url() );
header( "Location: " . iconic_get_app_url() );
die();
8 changes: 4 additions & 4 deletions edit-customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<h1>Edit Customer</h1>
</div>

<?php jck_display_notices(); ?>
<?php iconic_display_notices(); ?>

<?php
$customer_id = (int) filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
$customer = jck_api_get_collection_item( 'customers', $customer_id );
$customer = iconic_api_get_collection_item( 'customers', $customer_id );
?>

<?php if ( $customer ) { ?>
<?php $fields = jck_get_edit_customer_fields(); ?>
<?php $fields = iconic_get_edit_customer_fields(); ?>

<form action="<?php echo jck_get_current_url( array( 'action' => 'update_customer' ) ); ?>" method="post">
<form action="<?php echo iconic_get_current_url( array( 'action' => 'update_customer' ) ); ?>" method="post">
<?php foreach( $fields as $field_id => $field ) { ?>
<div class="form-group">
<label for="<?php echo $field_id; ?>"><?php echo $field['label']; ?></label>
Expand Down
8 changes: 4 additions & 4 deletions edit-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<h1>Edit Product</h1>
</div>

<?php jck_display_notices(); ?>
<?php iconic_display_notices(); ?>

<?php
$product_id = (int) filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
$product = jck_api_get_collection_item( 'products', $product_id );
$product = iconic_api_get_collection_item( 'products', $product_id );
?>

<?php if ( $product ) { ?>
<?php $fields = jck_get_edit_product_fields( $product->type ); ?>
<?php $fields = iconic_get_edit_product_fields( $product->type ); ?>

<form action="<?php echo jck_get_current_url( array( 'action' => 'update_product' ) ); ?>" method="post">
<form action="<?php echo iconic_get_current_url( array( 'action' => 'update_product' ) ); ?>" method="post">
<?php foreach( $fields as $field_id => $field ) { ?>
<div class="form-group">
<label for="<?php echo $field_id; ?>"><?php echo $field['label']; ?></label>
Expand Down
48 changes: 24 additions & 24 deletions inc/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
/**
* Process actions.
*/
function jck_process_actions() {
function iconic_process_actions() {
$action = filter_input( INPUT_GET, 'action' );

if ( ! $action ) {
return;
}

$action_name = sprintf( 'jck_action_%s', $action );
$action_name = sprintf( 'iconic_action_%s', $action );

if ( ! function_exists( $action_name ) ) {
return;
Expand All @@ -25,8 +25,8 @@ function jck_process_actions() {
/**
* Update order status.
*/
function jck_action_order_status() {
$redirect = jck_get_current_url( array(
function iconic_action_order_status() {
$redirect = iconic_get_current_url( array(
'action' => null,
'order_id' => null,
'status' => null,
Expand All @@ -35,29 +35,29 @@ function jck_action_order_status() {
$status = filter_input( INPUT_GET, 'status' );

if ( ! $order_id || ! $status ) {
jck_add_notice( 'Order status could not be updated.' );
iconic_add_notice( 'Order status could not be updated.' );

return $redirect;
}

$update_status = jck_api_update_collection_item( 'orders', $order_id, array(
$update_status = iconic_api_update_collection_item( 'orders', $order_id, array(
'status' => $status,
) );

if ( ! $update_status ) {
return $redirect;
}

jck_add_notice( sprintf( 'Order #%d status updated.', $order_id ), 'success' );
iconic_add_notice( sprintf( 'Order #%d status updated.', $order_id ), 'success' );

return $redirect;
}

/**
* Update customer.
*/
function jck_action_update_customer() {
$redirect = jck_get_current_url( array(
function iconic_action_update_customer() {
$redirect = iconic_get_current_url( array(
'action' => null,
) );
$customer_id = (int) filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
Expand All @@ -66,33 +66,33 @@ function jck_action_update_customer() {
$last_name = filter_input( INPUT_POST, 'last-name' );

if ( ! $customer_id ) {
jck_add_notice( 'No customer ID was given.' );
iconic_add_notice( 'No customer ID was given.' );

return $redirect;
}

$update_customer = jck_api_update_collection_item( 'customers', $customer_id, array(
$update_customer = iconic_api_update_collection_item( 'customers', $customer_id, array(
'email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
) );

if ( ! $update_customer ) {
jck_add_notice( 'Sorry, the customer could not be updated at this time.' );
iconic_add_notice( 'Sorry, the customer could not be updated at this time.' );

return $redirect;
}

jck_add_notice( 'Customer updated.', 'success' );
iconic_add_notice( 'Customer updated.', 'success' );

return $redirect;
}

/**
* Update product.
*/
function jck_action_update_product() {
$redirect = jck_get_current_url( array(
function iconic_action_update_product() {
$redirect = iconic_get_current_url( array(
'action' => null,
) );
$product_id = (int) filter_input( INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT );
Expand All @@ -101,33 +101,33 @@ function jck_action_update_product() {
$sale_price = filter_input( INPUT_POST, 'sale-price', FILTER_SANITIZE_NUMBER_INT );

if ( ! $product_id ) {
jck_add_notice( 'No product ID was given.' );
iconic_add_notice( 'No product ID was given.' );

return $redirect;
}

$update_product = jck_api_update_collection_item( 'products', $product_id, array(
$update_product = iconic_api_update_collection_item( 'products', $product_id, array(
'name' => $name,
'regular_price' => $regular_price,
'sale_price' => $sale_price,
) );

if ( ! $update_product ) {
jck_add_notice( 'Sorry, the product could not be updated.' );
iconic_add_notice( 'Sorry, the product could not be updated.' );

return $redirect;
}

jck_add_notice( 'Product updated.', 'success' );
iconic_add_notice( 'Product updated.', 'success' );

return $redirect;
}

/**
* Delete collection item.
*/
function jck_action_delete_collection_item() {
$redirect = jck_get_current_url( array(
function iconic_action_delete_collection_item() {
$redirect = iconic_get_current_url( array(
'action' => null,
'type' => null,
'id' => null,
Expand All @@ -136,18 +136,18 @@ function jck_action_delete_collection_item() {
$type = filter_input( INPUT_GET, 'type' );

if ( ! $id || ! $type ) {
jck_add_notice( 'Item could not be deleted.' );
iconic_add_notice( 'Item could not be deleted.' );

return $redirect;
}

$delete_item = jck_api_delete_collection_item( $type, $id );
$delete_item = iconic_api_delete_collection_item( $type, $id );

if ( ! $delete_item ) {
return $redirect;
}

jck_add_notice( sprintf( 'Item #%d deleted.', $id ), 'success' );
iconic_add_notice( sprintf( 'Item #%d deleted.', $id ), 'success' );

return $redirect;
}
Loading

0 comments on commit b350a26

Please sign in to comment.