Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rilwis/meta-box
base: b701510915
...
head fork: rilwis/meta-box
compare: 69606fa382
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 1 file changed
  • 0 commit comments
  • 3 contributors
Commits on Nov 01, 2012
@rilwis Fix `time` and `datetime` field 181f80a
@rilwis Changes for `select_advanced`:
- change folder name to `select2` only
- make it a child field of `select` so we can forget about how it save/get data
- make `placeholder` work
1f6db55
@rilwis version 4.2.2 a693b71
@rilwis Add changes to readme e2cfac2
@funkedgeek funkedgeek Added URL Field
Url field automatically validates and sanitizes url's.
68b6881
Commits on Nov 02, 2012
@funkedgeek funkedgeek URL now inherits from Text field 4a54c15
Commits on Nov 03, 2012
@rilwis Merge pull request #171 from funkedgeek/master
Added URL field
69606fa
Showing with 49 additions and 0 deletions.
  1. +49 −0 inc/fields/url.php
View
49 inc/fields/url.php
@@ -0,0 +1,49 @@
+<?php
+// Prevent loading this file directly
+defined( 'ABSPATH' ) || exit;
+
+// Make sure "text" field is loaded
+require_once RWMB_FIELDS_DIR . 'text.php';
+
+if ( ! class_exists( 'RWMB_URL_Field' ) )
+{
+ class RWMB_URL_Field
+ {
+ /**
+ * Get field HTML
+ *
+ * @param string $html
+ * @param mixed $meta
+ * @param array $field
+ *
+ * @return string
+ */
+ static function html( $html, $meta, $field )
+ {
+ return sprintf(
+ '<input type="url" class="rwmb-url" name="%s" id="%s" value="%s" size="%s" />',
+ $field['field_name'],
+ $field['id'],
+ $meta,
+ $field['size']
+ );
+ }
+
+
+ /**
+ * Sanitizes url
+ *
+ * @param $post_id
+ * @param $field
+ * @param $old
+ * @param $new
+ *
+ * @return $new
+ */
+ static function value( $new, $old, $post_id, $field)
+ {
+ $new = esc_url($new);
+ return $new;
+ }
+ }
+}

No commit comments for this range

Something went wrong with that request. Please try again.