id, 'affcoups' ) !== false ) ? true : false; } /** * Get website url * * @param $path * @param string $source * * @return string */ function affcoups_get_website_url( $path = '', $source = 'plugin-settings' ) { $url = 'https://affcoups.com/'; if ( ! empty( $path ) ) { $url .= trim( $path, '/' ) . '/'; } return esc_url( add_query_arg( array( 'utm_source' => $source, 'utm_medium' => 'plugin-row', 'utm_campaign' => 'Affiliate Coupons', ), $url ) ); } /** * Truncate string * * @param $str * @param int $limit * @param string $pad * * @return mixed|string */ function affcoups_truncate_string( $str, $limit = 200, $pad = '...' ) { $limit = intval( $limit ); if ( strlen( $str ) > $limit ) { $str = preg_replace( '/\s+?(\S+)?$/', '', substr( $str, 0, $limit + 1 ) ); $str = rtrim( $str, '.' ); $str = rtrim( $str, ',' ); $str = rtrim( $str, '-' ); $str .= $pad; } return $str; } // @codingStandardsIgnoreStart /** * Debug * * @param $args * @param bool $title */ function affcoups_debug( $args, $title = false ) { if ( $title ) { echo '

' . esc_html( $title ) . '

'; } if ( $args ) { echo '
';
		print_r( $args );
		echo '
'; } } /** * Debug log * * @param $log */ function affcoups_debug_log( $log ) { if ( ! affcoups_is_development() ) { return; } if ( is_array( $log ) || is_object( $log ) ) { error_log( print_r( $log, true ) ); } else { error_log( $log ); } } // @codingStandardsIgnoreEnd