PNG %k25u25%fgd5n! '#27ae60', 'paid' => '#27ae60', 'shipping' => '#16a085', 'in-progress' => '#2980b9', 'payment-confirm' => $confirm_color, 'on-hold' => '#7f8c8d', 'cancelled' => '#d35400', 'refunded' => '#c0392b', 'pending' => '#7f8c8d', 'added' => '#2980b9', 'inactive' => '#c0392b', 'active' => '#2ecc71', 'expired' => '#c0392b' ]; } /** * Get hex color code from text * @since 1.0.0 * @param string $text String value that will be converted * @return string Hex code value */ function sejolisa_get_hex_from_text($text) { $code = dechex(crc32($text)); $code = substr($code, 0, 6); return '#'.$code; } /** * Get fixed color by text * @since 1.0.0 * @param string $text * @return string */ function sejolisa_get_text_color($text) { $code = false; $color = sejolisa_get_all_colors(); return isset($color[$text]) ? $color[$text] : sejolisa_get_hex_from_text($text); } /** * Encrypt and decrypt * @since 1.0.0 * @param string $action Action between encrypt or decrypt * @param string $string String that will be processed * @return string String result */ function sejolisa_encrypt_decrypt($action = 'encrypt', $string = '') { $output = false; $encrypt_method = "AES-256-CBC"; $secret_key = AUTH_SALT; $secret_iv = SECURE_AUTH_SALT; // hash $key = hash('sha256', $secret_key); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr(hash('sha256', $secret_iv), 0, 16); if ( $action == 'encrypt' ) : $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); $output = base64_encode($output); elseif( $action == 'decrypt' ) : $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv); endif; return $output; } /** * Parsing given form HTML code to array data to validate subscription form * @since 1.0.0 * @param string $code Autoresponder html code * @return array Array of response */ function sejolisa_parsing_form_html_code($code) { $response = [ 'valid' => false, 'messages' => [], 'form' => [], 'fields' => [] ]; // strip unneccessary tags $form = strip_tags($code, '