esc_html__( 'Add new link', 'affieasy' ), 'editLink' => esc_html__( 'Edit link', 'affieasy' ), 'copyToClipboard' => esc_html__( 'Copy to clipboard', 'affieasy' ), 'tagCopied' => esc_html__( 'Tag copied!', 'affieasy' ), 'shortUrlCopied' => esc_html__( 'Short url copied!', 'affieasy' ), 'add' => esc_html__( 'Add', 'affieasy' ), 'edit' => esc_html__( 'Edit', 'affieasy' ), 'cancel' => esc_html__( 'Cancel', 'affieasy' ), 'yes' => esc_html__( 'Yes', 'affieasy' ), 'no' => esc_html__( 'No', 'affieasy' ), ) ); $dbManager = new AFES_DbManager(); $actionType = ( isset( $_POST['actionType'] ) ? sanitize_key( $_POST['actionType'] ) : null ); $id = ( isset( $_POST['idParam'] ) && is_numeric( $_POST['idParam'] ) ? intval( sanitize_key( $_POST['idParam'] ) ) : null ); if ( isset( $actionType ) ) { if ( $actionType === 'deletion' && isset( $id ) && is_numeric( $id ) ) { $dbManager->delete_link( $id ); } else { if ( $actionType === 'edition' ) { $dbManager->edit_link( new AFES_Link( $id, ( isset( $_POST['webshopIdParam'] ) ? sanitize_key( $_POST['webshopIdParam'] ) : null ), ( isset( $_POST['labelParam'] ) ? sanitize_text_field( $_POST['labelParam'] ) : null ), ( isset( $_POST['categoryParam'] ) ? sanitize_text_field( $_POST['categoryParam'] ) : null ), ( isset( $_POST['parametersParam'] ) ? AFES_Utils::sanitize_parameters( $_POST['parametersParam'] ) : null ), ( isset( $_POST['urlParam'] ) ? esc_url_raw( str_replace( '[', '', str_replace( ']', '', preg_replace( '/\\[[\\s\\S]+?]/', '', $_POST['urlParam'] ) ) ) ) : null ), ( isset( $_POST['noFollowParam'] ) ? sanitize_key( $_POST['noFollowParam'] ) === 'on' : false ), ( isset( $_POST['openInNewTabParam'] ) ? sanitize_key( $_POST['openInNewTabParam'] ) === 'on' : false ) ) ); } } } $canUsePremiumCode = false; $currentLinkCount = 0; if ( !$canUsePremiumCode ) { $currentLinkCount = $dbManager->get_table_count( AFES_Constants::TABLE_LINK ); } $webshops = $dbManager->get_webshop_list(); $hasNoWebshop = empty($webshops); ?>