Ejemplo n.º 1
0
 /**
  * Gets the content of a post, its excerpt as well as its title and returns it as an array
  *
  * @param string $content_type
  * @param string $excerpt_type
  * @param int    $trid
  * @param string $lang
  *
  * @return array containing all the fields information
  */
 public static function copy_from_original_fields($content_type, $excerpt_type, $trid, $lang)
 {
     global $wpdb;
     $post_id = $wpdb->get_var($wpdb->prepare("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $trid, $lang));
     $post = get_post($post_id);
     $fields_to_copy = array('content' => 'post_content', 'title' => 'post_title', 'excerpt' => 'post_excerpt');
     $fields_contents = array();
     if (!empty($post)) {
         foreach ($fields_to_copy as $editor_key => $editor_field) {
             //loops over the three fields to be inserted into the array
             if ($editor_key === 'content' || $editor_key === 'excerpt') {
                 //
                 if ($editor_key === 'content') {
                     $editor_var = $content_type;
                     //these variables are supplied by a javascript call in scripts.js icl_copy_from_original(lang, trid)
                 } elseif ($editor_key === 'excerpt') {
                     $editor_var = $excerpt_type;
                 }
                 if ($editor_var === 'rich') {
                     $html_pre = wp_richedit_pre($post->{$editor_field});
                 } else {
                     $html_pre = wp_htmledit_pre($post->{$editor_field});
                 }
                 $fields_contents[$editor_key] = htmlspecialchars_decode($html_pre);
             } elseif ($editor_key === 'title') {
                 $fields_contents[$editor_key] = strip_tags($post->{$editor_field});
             }
         }
         $fields_contents['customfields'] = apply_filters('wpml_copy_from_original_custom_fields', self::copy_from_original_custom_fields($post));
     } else {
         $fields_contents['error'] = __('Post not found', 'sitepress');
     }
     do_action('icl_copy_from_original', $post_id);
     return $fields_contents;
 }
 function test_wp_htmledit_pre_charset_utf_8()
 {
     add_filter('pre_option_blog_charset', array($this, '_charset_utf_8'));
     $utf8 = 'Fran' . chr(195) . chr(167) . 'ais';
     $this->assertEquals($utf8, wp_htmledit_pre($utf8));
     remove_filter('pre_option_blog_charset', array($this, '_charset_utf_8'));
 }
Ejemplo n.º 3
0
function vrev_post_meta()
{
    global $post_ID;
    if (!current_user_can('edit_post', $post_ID)) {
        return;
    }
    $meta = get_post_meta($post_ID, '_ice_revisions_content');
    $meta = (string) array_pop($meta);
    $meta = wp_htmledit_pre($meta);
    ?>
	<div class="hidden"><textarea name="ice-revisions-content" id="ice-revisions-content"><?php 
    echo $meta;
    ?>
</textarea></div>
	<?php 
    wp_enqueue_script('mce-revisions', plugin_dir_url(__FILE__) . 'js/mce-revisions.js', array('jquery'), '1.0', true);
}
Ejemplo n.º 4
0
/**
 * Prints step 2 for Network installation process.
 *
 * @since 3.0.0
 */
function network_step2($errors = false)
{
    global $base, $wpdb;
    $hostname = get_clean_basedomain();
    // Wildcard DNS message.
    if (is_wp_error($errors)) {
        echo '<div class="error">' . $errors->get_error_message() . '</div>';
    }
    if ($_POST) {
        $vhost = !allow_subdomain_install() ? false : (bool) $_POST['subdomain_install'];
    } else {
        if (is_multisite()) {
            $vhost = is_subdomain_install();
            ?>
	<div class="updated"><p><strong><?php 
            _e('Notice: The Network feature is already enabled.');
            ?>
</strong> <?php 
            _e('The original configuration steps are shown here for reference.');
            ?>
</p></div>
<?php 
        } else {
            $vhost = (bool) $wpdb->get_var("SELECT meta_value FROM {$wpdb->sitemeta} WHERE site_id = 1 AND meta_key = 'subdomain_install'");
            ?>
	<div class="error"><p><strong><?php 
            _e('Warning:');
            ?>
</strong> <?php 
            _e('An existing WordPress network was detected.');
            ?>
</p></div>
	<p><?php 
            _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.');
            ?>
</p>
<?php 
        }
    }
    if ($_POST || !is_multisite()) {
        ?>
		<h3><?php 
        esc_html_e('Enabling the Network');
        ?>
</h3>
		<p><?php 
        _e('Complete the following steps to enable the features for creating a network of sites.');
        ?>
</p>
		<div class="updated inline"><p><?php 
        _e('<strong>Caution:</strong> We recommend you backup your existing <code>wp-config.php</code> and <code>.htaccess</code> files.');
        ?>
</p></div>
<?php 
    }
    ?>
		<ol>
			<li><p><?php 
    printf(__('Create a <code>blogs.dir</code> directory in <code>%s</code>. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.'), WP_CONTENT_DIR);
    ?>
</p></li>
			<li><p><?php 
    printf(__('Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:'), ABSPATH);
    ?>
</p>
				<textarea class="code" readonly="readonly" cols="100" rows="7">
define( 'MULTISITE', true );
define( 'VHOST', '<?php 
    echo $vhost ? 'yes' : 'no';
    ?>
' );
$base = '<?php 
    echo $base;
    ?>
';
define( 'DOMAIN_CURRENT_SITE', '<?php 
    echo $hostname;
    ?>
' );
define( 'PATH_CURRENT_SITE', '<?php 
    echo $base;
    ?>
' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );</textarea>
<?php 
    $keys_salts = array('AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '');
    foreach ($keys_salts as $c => $v) {
        if (defined($c)) {
            unset($keys_salts[$c]);
        }
    }
    if (!empty($keys_salts)) {
        $from_api = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
        if (is_wp_error($from_api)) {
            foreach ($keys_salts as $c => $v) {
                $keys_salts[$c] = wp_generate_password(64, true, true);
            }
        } else {
            $from_api = explode("\n", wp_remote_retrieve_body($from_api));
            foreach ($keys_salts as $c => $v) {
                $keys_salts[$c] = substr(array_shift($from_api), 28, 64);
            }
        }
        $num_keys_salts = count($keys_salts);
        ?>
	<p><?php 
        echo _n('This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts);
        ?>
 <?php 
        _e('To make your installation more secure, you should also add:');
        ?>
</p>
	<textarea class="code" readonly="readonly" cols="100" rows="<?php 
        echo $num_keys_salts;
        ?>
"><?php 
        foreach ($keys_salts as $c => $v) {
            echo "\ndefine( '{$c}', '{$v}' );";
        }
        ?>
</textarea>
<?php 
    }
    ?>
</li>
<?php 
    // Construct an htaccess file.
    $htaccess_file = 'RewriteEngine On
RewriteBase ' . $base . '
RewriteRule ^index\\.php$ - [L]

# uploaded files
RewriteRule ^' . ($vhost ? '' : '([_0-9a-zA-Z-]+/)?') . 'files/(.+) wp-includes/ms-files.php?file=$' . ($vhost ? 1 : 2) . ' [L]' . "\n";
    if (!$vhost) {
        $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n";
    }
    $htaccess_file .= "\n" . 'RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]';
    // @todo custom content dir.
    if (!$vhost) {
        $htaccess_file .= "\n" . 'RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\\.php)$ $2 [L]';
    }
    $htaccess_file .= "\nRewriteRule . index.php [L]";
    ?>
			<li><p><?php 
    printf(__('Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:'), ABSPATH);
    ?>
</p>
				<textarea class="code" readonly="readonly" cols="100" rows="<?php 
    echo $vhost ? 11 : 16;
    ?>
">
<?php 
    echo wp_htmledit_pre($htaccess_file);
    ?>
</textarea></li>
		</ol>
<?php 
    if (!is_multisite()) {
        ?>
		<p><?php 
        printf(__('Once you complete these steps, your network is enabled and configured.'));
        ?>
 <a href="<?php 
        echo esc_url(admin_url());
        ?>
"><?php 
        _e('Return to Dashboard');
        ?>
</a></p>
<?php 
    }
}
    public function display_setting($args = array())
    {
        extract($args);
        $options = get_option('ds106banker_options');
        if (!isset($options[$id]) && $type != 'checkbox') {
            $options[$id] = $std;
        } elseif (!isset($options[$id])) {
            $options[$id] = 0;
        }
        $options['new_types'] = 'New Type Name';
        // always reset
        $field_class = '';
        if ($class != '') {
            $field_class = ' ' . $class;
        }
        switch ($type) {
            case 'heading':
                echo '</td></tr><tr valign="top"><td colspan="2"><h4 style="margin-bottom:0;">' . $desc . '</h4><p style="margin-top:0">' . $std . '</p>';
                break;
            case 'checkbox':
                echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="ds106banker_options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
                break;
            case 'select':
                echo '<select class="select' . $field_class . '" name="ds106banker_options[' . $id . ']">';
                foreach ($choices as $value => $label) {
                    echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'radio':
                $i = 0;
                foreach ($choices as $value => $label) {
                    echo '<input class="radio' . $field_class . '" type="radio" name="ds106banker_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    if ($i < count($options) - 1) {
                        echo '<br />';
                    }
                    $i++;
                }
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'textarea':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="ds106banker_options[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'medialoader':
                echo '<div id="uploader_' . $id . '">';
                if (strpos($options[$id], 'http') !== false) {
                    echo '<img id="previewimage_' . $id . '" src="' . $options[$id] . '" width="' . THUMBW . '" height="' . THUMBH . '" alt="default thumbnail" />';
                } else {
                    echo '<img id="previewimage_' . $id . '" src="http://placehold.it/' . THUMBW . 'x' . THUMBH . '" alt="default thumbnail" />';
                }
                echo '<input type="hidden" name="ds106banker_options[' . $id . ']" id="' . $id . '" value="' . esc_attr($options[$id]) . '" />
  <br /><input type="button" class="upload_image_button button-primary" name="_ds106banker_button' . $id . '" id="_ds106banker_button' . $id . '" data-options_id="' . $id . '" data-uploader_title="Set ' . THINGNAME . ' Thumbnail" data-uploader_button_text="Select Thumbnail" value="Set/Change Thumbnail" />
</div><!-- uploader -->';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'password':
                echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="ds106banker_options[' . $id . ']" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'text':
            default:
                echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="ds106banker_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    if ($id == 'def_thumb') {
                        $desc .= '<br /><a href="' . $options[$id] . '" target="_blank"><img src="' . $options[$id] . '" style="overflow: hidden;" width="' . $options["index_thumb_w"] . '"></a>';
                    }
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
        }
    }
Ejemplo n.º 6
0
 function filter_excerpt_field_content_copy($elements)
 {
     if ($elements['post_type'] == 'product') {
         $elements['excerpt']['editor_type'] = 'editor';
     }
     if (function_exists('format_for_editor')) {
         // WordPress 4.3 uses format_for_editor
         $elements['excerpt']['value'] = htmlspecialchars_decode(format_for_editor($elements['excerpt']['value'], $_POST['excerpt_type']));
     } else {
         // Backwards compatible for WordPress < 4.3
         if ($_POST['excerpt_type'] == 'rich') {
             $elements['excerpt']['value'] = htmlspecialchars_decode(wp_richedit_pre($elements['excerpt']['value']));
         } else {
             $elements['excerpt']['value'] = htmlspecialchars_decode(wp_htmledit_pre($elements['excerpt']['value']));
         }
     }
     return $elements;
 }
Ejemplo n.º 7
0
            $options_to_update[] = $option->option_name;
            $class = 'all-options';
        } else {
            $value = 'SERIALIZED DATA';
            $disabled = true;
            $class = 'all-options disabled';
        }
    } else {
        $value = $option->option_value;
        $options_to_update[] = $option->option_name;
        $class = 'all-options';
    }
    $name = esc_attr($option->option_name);
    echo "\n<tr>\n\t<th scope='row'><label for='{$name}'>" . esc_html($option->option_name) . "</label></th>\n<td>";
    if (strpos($value, "\n") !== false) {
        echo "<textarea class='{$class}' name='{$name}' id='{$name}' cols='30' rows='5'>" . wp_htmledit_pre($value) . "</textarea>";
    } else {
        echo "<input class='regular-text {$class}' type='text' name='{$name}' id='{$name}' value='" . esc_attr($value) . "'" . disabled($disabled, true, false) . " />";
    }
    echo "</td>\n</tr>";
}
?>
  </table>
<p class="submit"><input type="hidden" name="page_options" value="<?php 
echo esc_attr(implode(',', $options_to_update));
?>
" /><input type="submit" name="Update" value="<?php 
esc_attr_e('Save Changes');
?>
" class="button-primary" /></p>
  </form>
Ejemplo n.º 8
0
</textarea>
					<br />
					<?php 
_e('The first page on a new site.');
?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="first_comment"><?php 
_e('First Comment');
?>
</label></th>
				<td>
					<textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text">
<?php 
echo wp_htmledit_pre(stripslashes(get_site_option('first_comment')));
?>
</textarea>
					<br />
					<?php 
_e('The first comment on a new site.');
?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><label for="first_comment_author"><?php 
_e('First Comment Author');
?>
</label></th>
				<td>
					<input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php 
Ejemplo n.º 9
0
    function create_field($field)
    {
        global $wp_version;
        // vars
        $id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
        ?>
        <div id="wp-<?php 
        echo $id;
        ?>
-wrap" class="acf_wysiwyg wp-editor-wrap"
             data-toolbar="<?php 
        echo $field['toolbar'];
        ?>
" data-upload="<?php 
        echo $field['media_upload'];
        ?>
">
            <?php 
        if (user_can_richedit() && $field['media_upload'] == 'yes') {
            ?>
                <?php 
            if (version_compare($wp_version, '3.3', '<')) {
                ?>
                    <div id="editor-toolbar">
                        <div id="media-buttons" class="hide-if-no-js">
                            <?php 
                do_action('media_buttons');
                ?>
                        </div>
                    </div>
                <?php 
            } else {
                ?>
                    <div id="wp-<?php 
                echo $id;
                ?>
-editor-tools" class="wp-editor-tools">
                        <div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="hide-if-no-js wp-media-buttons">
                            <?php 
                do_action('media_buttons');
                ?>
                        </div>
                    </div>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
            <div id="wp-<?php 
        echo $id;
        ?>
-editor-container" class="wp-editor-container">
				<textarea id="<?php 
        echo $id;
        ?>
" class="wp-editor-area" name="<?php 
        echo $field['name'];
        ?>
"><?php 
        if (user_can_richedit()) {
            echo wp_richedit_pre($field['value']);
        } else {
            echo wp_htmledit_pre($field['value']);
        }
        ?>
</textarea>
            </div>
        </div>

        <?php 
    }
Ejemplo n.º 10
0
 public function display_setting($args = array(), $options)
 {
     extract($args);
     $do_return = false;
     switch ($type) {
         case 'heading':
             if (!empty($desc)) {
                 echo '<h3>' . $desc . '</h3>';
             }
             $do_return = true;
             break;
         case 'expand_begin':
             if (!empty($desc)) {
                 echo '<h3>' . $desc . '</h3>';
             }
             echo '<a id="' . $this->get_field_id($id) . '" style="cursor:pointer;" onclick="jQuery( \'div#' . $this->get_field_id($id) . '\' ) . slideToggle();">' . __('Expand/Collapse', 'testimonials-widget') . ' &raquo;</a>';
             echo '<div id="' . $this->get_field_id($id) . '" style="display:none">';
             $do_return = true;
             break;
         case 'expand_end':
             echo '</div>';
             $do_return = true;
             break;
         default:
             break;
     }
     if ($do_return) {
         return;
     }
     if (!isset($options[$id]) && $type != 'checkbox') {
         $options[$id] = $std;
     } elseif (!isset($options[$id])) {
         $options[$id] = 0;
     }
     $field_class = '';
     if (!empty($class)) {
         $field_class = ' ' . $class;
     }
     echo '<p>';
     switch ($type) {
         case 'checkbox':
             echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" value="1" ' . checked($options[$id], 1, false) . ' /> ';
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             break;
         case 'select':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<select id="' . $this->get_field_id($id) . '"class="select' . $field_class . '" name="' . $this->get_field_name($id) . '">';
             foreach ($choices as $value => $label) {
                 echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
             }
             echo '</select>';
             break;
         case 'radio':
             $i = 0;
             $count_options = count($options) - 1;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="' . $this->get_field_name($id) . '" id="' . $this->get_field_name($id . $i) . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $this->get_field_name($id . $i) . '">' . $label . '</label>';
                 if ($i < $count_options) {
                     echo '<br />';
                 }
                 $i++;
             }
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             break;
         case 'textarea':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<textarea class="widefat' . $field_class . '" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
             break;
         case 'password':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<input class="widefat' . $field_class . '" type="password" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" value="' . esc_attr($options[$id]) . '" />';
             break;
         case 'readonly':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<input class="widefat' . $field_class . '" type="text" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" value="' . esc_attr($options[$id]) . '" readonly="readonly" />';
             break;
         case 'text':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<input class="widefat' . $field_class . '" type="text" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
             break;
         default:
             break;
     }
     if (!empty($desc)) {
         echo '<br /><span class="setting-description"><small>' . $desc . '</small></span>';
     }
     echo '</p>';
 }
Ejemplo n.º 11
0
                ?>
</th>
									<td><textarea class="<?php 
                echo $class;
                ?>
" rows="5" cols="40" name="option[<?php 
                echo esc_attr($option->option_name);
                ?>
]" id="<?php 
                echo esc_attr($option->option_name);
                ?>
"<?php 
                disabled($disabled);
                ?>
><?php 
                wp_htmledit_pre($option->option_value);
                ?>
</textarea></td>
								</tr>
							<?php 
            } else {
                ?>
								<tr class="form-field">
									<th scope="row"><?php 
                esc_html_e(ucwords(str_replace("_", " ", $option->option_name)));
                ?>
</th>
									<?php 
                if ($is_main_site && in_array($option->option_name, array('siteurl', 'home'))) {
                    ?>
									<td><code><?php 
 /**
  * Escape string to prevent against nasty things.
  *
  * This is a wrapper function to add some additional measures for making
  * sure users don't break things
  *
  * @since 3.0.3.3
  * @param string $string The string to be escaped
  * @param string $type The type of escaping to do
  * @return string
  */
 function esc($string, $type = 'js')
 {
     global $wp_filter, $merged_filters;
     // Some themes and plugins hook into these filters and muck things up
     // Remove all filters attached and then restore afterwards
     $filters = compact($wp_filter, $merged_filters);
     remove_all_filters('js_escape');
     remove_all_filters('htmledit_pre');
     remove_all_filters('attribute_escape');
     $string = strip_tags($string);
     switch ($type) {
         case 'attr':
             $string = esc_attr($string);
             break;
         case 'htmledit':
             $string = wp_htmledit_pre($string);
             break;
         case 'js':
         default:
             $string = esc_js($string);
             break;
     }
     // Restore filters that were removed above
     extract($filters);
     return $string;
 }
Ejemplo n.º 13
0
    /**
     * HTML output callback for fields
     *
     * @since 1.0
     */
    public function display_setting($args = array())
    {
        extract($args);
        $options = get_option($this->options_name);
        if (!isset($options[$id]) && $type != 'checkbox') {
            $options[$id] = $std;
        } elseif (!isset($options[$id])) {
            $options[$id] = 0;
        }
        $field_class = '';
        if ($class != '') {
            $field_class = ' ' . $class;
        }
        switch ($type) {
            case 'heading':
                echo '</td></tr><tr valign="top"><td colspan="2" class="' . $class . '"><h2>' . $std . '</h2>';
                echo '<p>' . $desc . '</p>';
                break;
            case 'paragraph':
                echo '<p>' . $desc . '</p>';
                break;
            case 'checkbox':
                if (!empty($choices)) {
                    if (!is_array($options[$id]) && is_array($std)) {
                        $options[$id] = array();
                        foreach ($std as $default) {
                            $options[$id][$default] = 1;
                        }
                    }
                    foreach ($choices as $val => $label) {
                        echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $this->options_name . '[' . $id . '][' . $val . ']" value="1" ' . @checked($options[$id][$val], 1, false) . '  /> <label for="' . $id . '">' . $label . '</label><br>';
                    }
                } else {
                    echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $this->options_name . '[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
                }
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'select':
                echo '<select class="select' . $field_class . '" name="' . $this->options_name . '[' . $id . ']"';
                if ($disabled == 'yes') {
                    echo ' disabled="disabled" ';
                }
                echo '>';
                foreach ($choices as $value => $label) {
                    echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'radio':
                $i = 0;
                foreach ($choices as $value => $label) {
                    echo '<input class="radio' . $field_class . '" type="radio" name="' . $this->options_name . '[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    if ($i < count($options) - 1) {
                        echo '<br />';
                    }
                    $i++;
                }
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'textarea':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="' . $this->options_name . '[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30"';
                if ($disabled == 'yes') {
                    echo ' disabled="disabled" ';
                }
                echo '>' . wp_htmledit_pre($options[$id]) . '</textarea>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'html':
                $text = $options[$id] == '' ? $std : $options[$id];
                wp_editor(apply_filters('the_content', html_entity_decode($text)), $id, array('textarea_name' => $this->options_name . '[' . $id . ']', 'media_buttons' => false, 'quicktags' => false, 'textarea_rows' => 15));
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'disabled':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="' . $this->options_name . '[' . $id . ']" disabled="disabled"  rows="5" cols="30">' . $std . '</textarea>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'password':
                echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="' . $this->options_name . '[' . $id . ']" value="' . esc_attr($options[$id]) . '"';
                if ($disabled == 'yes') {
                    echo ' disabled="disabled" ';
                }
                echo ' />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'button':
                echo '<button class="button-primary' . $field_class . '" id="' . $id . '" name="' . $this->options_name . '[' . $id . ']" value="' . esc_attr($options[$id]) . '" onclick="' . $onclick . '">' . $std . '</button>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'color':
                echo '<input class="regular-text' . $field_class . ' colorpicker" type="text" id="' . $id . '" rel="color-' . $id . '" name="' . $this->options_name . '[' . $id . ']" placeholder="' . $std . '" value="';
                echo esc_attr($options[$id]) != '' ? esc_attr($options[$id]) : $std;
                echo '" /><div id="color-' . $id . '"></div>';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'code':
                echo '<div style="width:550px"><textarea class="code-area ' . $field_class . '" id="code-' . $id . '" name="' . $this->options_name . '[' . $id . ']" placeholder="' . $std . '">';
                echo esc_attr($options[$id]) != '' ? esc_attr($options[$id]) : $std;
                echo '</textarea></div>';
                echo '<script type="text/javascript">
				 				var editor_' . $id . ' = CodeMirror.fromTextArea(document.getElementById("code-' . $id . '"), {lineNumbers: true, matchBrackets: true});
		 			</script>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'sortable':
                if ($disabled == '') {
                    wp_enqueue_script('jquery-ui-sortable');
                    echo '<script>
					  jQuery(function($) {
					    $( ".sortable-list" ).sortable({
					    	placeholder: "ui-state-highlight",
							stop: function( event, ui ) {
								var order="";
								$("#sortable-form span").each(function(){
									order += $(this).text()+",";
								});
								$.post(ajaxurl, {"action": "wsi_order", "order": order.replace(/^,|,$/g,"")} )
							}
					    });
					    $( ".sortable-list" ).disableSelection();
					  });
					  </script>';
                }
                echo '<div id="sortable-form"><ul class="sortable-list">';
                foreach (WP_Social_Invitations::get_providers() as $p => $p_name) {
                    echo '<li class="' . $p . '"><span style="display:none">' . $p . '</span>' . $p_name . '</li>';
                }
                echo '</ul><div style="clear:both;"></div></div>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'text':
            default:
                echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . $this->options_name . '[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '"';
                if ($disabled == 'yes') {
                    echo ' disabled="disabled" ';
                }
                echo ' />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
        }
    }
Ejemplo n.º 14
0
</textarea>
					<br />
					<?php 
_e('If you want to limit site registrations to certain domains. One domain per line.');
?>
				</td>
			</tr>

			<tr valign="top">
				<th scope="row"><label for="banned_email_domains"><?php 
_e('Banned Email Domains');
?>
</label></th>
				<td>
					<textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5"><?php 
echo wp_htmledit_pre(get_site_option('banned_email_domains') == '' ? '' : implode("\n", (array) get_site_option('banned_email_domains')));
?>
</textarea>
					<br />
					<?php 
_e('If you want to ban domains from site registrations. One domain per line.');
?>
				</td>
			</tr>

		</table>
		<h3><?php 
_e('New Site Settings');
?>
</h3>
		<table class="form-table">
Ejemplo n.º 15
0
    /**
     * HTML output for text field
     *
     * @since 1.0
     */
    public function buildOptions($args = array())
    {
        extract($args);
        $options = get_option('fullscreen_options');
        if (empty($options)) {
            $options[$id] = $std;
        } elseif (!isset($options[$id])) {
            $options[$id] = 0;
        }
        $field_class = '';
        if ($class != '') {
            $field_class = ' ' . $class;
        }
        switch ($type) {
            case 'heading':
                echo '</td></tr><tr valign="top"><td colspan="2"><h4>' . $desc . '</h4>';
                break;
            case 'checkbox':
                echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="fullscreen_options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
                break;
            case 'select':
                echo '<select class="select' . $field_class . '" name="fullscreen_options[' . $id . ']">';
                foreach ($choices as $value => $label) {
                    echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'multiselect':
                echo '<select class="select' . $field_class . '" name="fullscreen_options[' . $id . '][]" multiple="multiple">';
                foreach ($choices as $value => $label) {
                    /**
                     * If the user has saved options use them
                     * or use what is set in the std value
                     */
                    if (is_array($options[$id]) && in_array($value, $options[$id])) {
                        $selected = 'selected="selected"';
                    } else {
                        $selected = null;
                    }
                    echo '<option value="' . esc_attr($value) . '"' . $selected . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'multicheck':
                $i = 0;
                foreach ($choices as $value => $label) {
                    /**
                     * If the user has saved options use them
                     * or use what is set in the std value
                     */
                    if (is_array($options[$id]) && in_array($value, $options[$id])) {
                        $selected = 'checked="checked"';
                    } else {
                        $selected = null;
                    }
                    echo '<input class="checkbox' . $field_class . '" type="checkbox" name="fullscreen_options[' . $id . '][]" id="' . $id . $i . '" value="' . esc_attr($value) . '"' . $selected . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    echo '<br />';
                    $i++;
                }
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'radio':
                $i = 0;
                foreach ($choices as $value => $label) {
                    echo '<input class="radio' . $field_class . '" type="radio" name="fullscreen_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    //if ( $i < count( $options ) - 1 )
                    echo '<br />';
                    $i++;
                }
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'radio_img':
                echo '<fieldset>';
                $i = 0;
                $i++;
                foreach ($choices as $k => $v) {
                    $selected = checked($options[$id], $k, false) != '' ? ' gpp-radio-img-selected' : '';
                    echo '<label class="gpp-radio-img' . $selected . ' gpp-radio-img-' . $options[$id] . '" for="' . $id . '_' . $i . '">';
                    echo '<input type="radio" id="' . $id . '_' . $i . '" name="fullscreen_options[' . $id . ']" ' . $field_class . ' value="' . $k . '" ' . checked($options[$id], $k, false) . '/>';
                    echo '<img src="' . $v['img'] . '" alt="' . $v['title'] . '" onclick="jQuery:gpp_radio_img_select(\'' . $id . '_' . $i . '\', \'' . $options[$id] . '\');" />';
                    echo '<br/><span>' . $v['title'] . '</span>';
                    echo '</label>';
                    $i++;
                }
                //foreach
                echo isset($options[$desc]) && !empty($options[$desc]) ? '<br/><span class="description">' . $options[$desc] . '</span>' : '';
                echo '</fieldset>';
                break;
            case 'textarea':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="fullscreen_options[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'password':
                echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="fullscreen_options[' . $id . ']" value="' . esc_attr($options[$id]) . '" autocomplete="off" />';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'upload':
                echo '<input id="' . $id . '" class="upload-url' . $field_class . '" type="hidden" name="fullscreen_options[' . $id . ']" value="' . esc_attr($options[$id]) . '" /><div class="imgpreview">';
                if ($options[$id] != '') {
                    echo '<img class="gpp-screenshot" id="gpp-screenshot-' . $id . '" src="' . esc_attr($options[$id]) . '" />';
                }
                echo "</div>";
                if ($options[$id] == '') {
                    $remove = ' style="display:none;"';
                    $upload = '';
                } else {
                    $remove = '';
                    $upload = ' style="display:none;"';
                }
                echo '<a href="javascript:void(0);" class="upload_button button-secondary"' . $upload . ' rel-id="' . $id . '">' . __('Browse', 'fullscreen') . '</a>';
                echo '<a href="javascript:void(0);" class="upload_button_remove"' . $remove . ' rel-id="' . $id . '">' . __('Remove Upload', 'fullscreen') . '</a>';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
            case 'html':
                echo $html;
                break;
            case 'color':
                echo '<div class="farb-popup-wrapper">';
                echo '<input class="popup-colorpicker' . $field_class . '" type="text" id="' . $id . '" name="fullscreen_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />
				<div class="farb-popup"><div class="farb-popup-inside"><div id="' . $id . 'picker" class="color-picker"></div></div>';
                echo '</div>';
                break;
            case 'slide':
                if ($desc != '') {
                    echo '<span class="description slide-desc' . $field_class . '">' . $desc . '</span>';
                }
                echo '<br /><span id="slides-details-button"></span>';
                echo '<ul id="slideshow_list">';
                if ($options[$id] != '') {
                    $slides = array();
                    foreach ($options[$id]['title'] as $k => $v) {
                        $slides[] = array('title' => $v, 'link' => $options[$id]['link'][$k], 'caption' => $options[$id]['caption'][$k], 'image' => $options[$id]['image'][$k]);
                    }
                    $i = 1;
                    foreach ($slides as $slide) {
                        echo '<li class="slide">';
                        echo '<span class="description">' . __('Slide Title', 'fullscreen') . '</span>';
                        echo '<input class="regular-text' . $field_class . '" name="fullscreen_options[' . $id . '][title][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="' . $slide['title'] . '" type="text" />';
                        echo '<span class="description">' . __('Slide Link', 'fullscreen') . '</span>';
                        echo '<input class="regular-text' . $field_class . '" name="fullscreen_options[' . $id . '][link][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="' . $slide['link'] . '" type="text" />';
                        echo '<span class="description">' . __('Slide Caption', 'fullscreen') . '</span>';
                        echo '<textarea class="' . $field_class . '" name="fullscreen_options[' . $id . '][caption][]" id="' . $id . '_caption_' . $i . '" cols="40" rows="4">' . $slide['caption'] . '</textarea>';
                        echo '<span class="description">' . __('Slide Image', 'fullscreen') . '</span>';
                        echo '<input class="upload-input-text src" name="fullscreen_options[' . $id . '][image][]" id="' . $id . '_image_' . $i . '" type="text" value="' . $slide['image'] . '" type="text" />
						<a href="' . get_option('siteurl') . '/wp-admin/admin-ajax.php?action=choice&width=150&height=100" id="' . $id . '_button" class="button upbutton">' . __('Upload', 'fullscreen') . '</a>';
                        echo '<div class="clear"></div><div class="previewimg">';
                        if ($slide['image'] != "") {
                            echo '<img class="uploadedimg" id="image_' . $id . '_image_' . $i . '" src="' . $slide['image'] . '" />';
                        }
                        echo '</div>';
                        echo '<a class="remove_slide submitdelete">' . __('Delete Slide', 'fullscreen') . '</a>';
                        echo '</li>';
                        $i++;
                    }
                } else {
                    $i = 1;
                    echo '<li class="slide">';
                    echo '<span class="description">' . __('Slide Title', 'fullscreen') . '</span>';
                    echo '<input class="regular-text' . $field_class . '" name="fullscreen_options[' . $id . '][title][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="" type="text" />';
                    echo '<span class="description">' . __('Slide Link', 'fullscreen') . '</span>';
                    echo '<input class="regular-text' . $field_class . '" name="fullscreen_options[' . $id . '][link][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="" type="text" />';
                    echo '<span class="description">' . __('Slide Caption', 'fullscreen') . '</span>';
                    echo '<textarea class="' . $field_class . '" name="fullscreen_options[' . $id . '][caption][]" id="' . $id . '_caption_' . $i . '" cols="40" rows="4"></textarea>';
                    echo '<span class="description">' . __('Slide Image', 'fullscreen') . '</span>';
                    echo '<input class="upload-input-text src" name="fullscreen_options[' . $id . '][image][]" id="' . $id . '_image_' . $i . '" type="text" value="" type="text" />
					<a href="' . get_option('siteurl') . '/wp-admin/admin-ajax.php?action=choice&width=150&height=100" id="' . $id . '_button" class="button upbutton">' . __('Upload', 'fullscreen') . '</a>';
                    echo '<div class="clear"></div><div class="previewimg">';
                    echo '</div>';
                    echo '<a class="remove_slide submitdelete">' . __('Delete Slide', 'fullscreen') . '</a>';
                    echo '</li>';
                }
                echo '</ul>';
                break;
            case 'text':
            default:
                echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="fullscreen_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" autocomplete="off" />';
                if ($desc != '') {
                    echo '<span class="description">' . $desc . '</span>';
                }
                break;
        }
    }
Ejemplo n.º 16
0
function oxygen_theme_meta_box()
{
    ?>

	<table class="form-table">
	    
		<!-- Favicon upload -->
		<tr class="favicon_url">
			<th>
				<label for="<?php 
    echo hybrid_settings_field_id('oxygen_favicon_url');
    ?>
"><?php 
    _e('Favicon:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo hybrid_settings_field_id('oxygen_favicon_url');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_favicon_url');
    ?>
" value="<?php 
    echo esc_attr(hybrid_get_setting('oxygen_favicon_url'));
    ?>
" />
				<input id="oxygen_favicon_upload_button" class="button" type="button" value="Upload" />
				<br />
				<span class="description"><?php 
    _e('Upload favicon image (recommended max size: 32x32).', hybrid_get_parent_textdomain());
    ?>
</span>
				
				<?php 
    /* Display uploaded image */
    if (hybrid_get_setting('oxygen_favicon_url')) {
        ?>
                    <p><img src="<?php 
        echo hybrid_get_setting('oxygen_favicon_url');
        ?>
" alt=""/></p>
				<?php 
    }
    ?>
			</td>
		</tr>
		
		<!-- Logo upload -->
		<tr class="logo_url">
			<th>
				<label for="<?php 
    echo hybrid_settings_field_id('oxygen_logo_url');
    ?>
"><?php 
    _e('Logo:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo hybrid_settings_field_id('oxygen_logo_url');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_logo_url');
    ?>
" value="<?php 
    echo esc_attr(hybrid_get_setting('oxygen_logo_url'));
    ?>
" />
				<input id="oxygen_logo_upload_button" class="button" type="button" value="Upload" />
				<br />
				<span class="description"><?php 
    _e('Upload logo image.', hybrid_get_parent_textdomain());
    ?>
</span>
				
				<?php 
    /* Display uploaded image */
    if (hybrid_get_setting('oxygen_logo_url')) {
        ?>
                    <p><img src="<?php 
        echo hybrid_get_setting('oxygen_logo_url');
        ?>
" alt=""/></p>
				<?php 
    }
    ?>
			</td>
		</tr>		
		
		<!-- Title font family -->
		<tr>
			<th>
				<label for="<?php 
    echo hybrid_settings_field_id('oxygen_font_family');
    ?>
"><?php 
    _e('Title font family:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
			    <select id="<?php 
    echo hybrid_settings_field_id('oxygen_font_family');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_font_family');
    ?>
">
				<option value="Abel" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Abel' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Abel', hybrid_get_parent_textdomain());
    ?>
 </option>				
				<option value="Oswald" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Oswald' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Oswald', hybrid_get_parent_textdomain());
    ?>
 </option>				
				<option value="Terminal Dosis" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Terminal Dosis' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Terminal Dosis', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="Bitter" <?php 
    echo hybrid_get_setting('oxygen_font_family', 'Bitter') == 'Bitter' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Bitter', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="Georgia" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Georgia' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Georgia', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="Droid Serif" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Droid Serif' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Droid Serif', hybrid_get_parent_textdomain());
    ?>
 </option>				
				<option value="Helvetica" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Helvetica' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Helvetica', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="Arial" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Arial' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Arial', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="Droid Sans" <?php 
    echo hybrid_get_setting('oxygen_font_family') == 'Droid Sans' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('Droid Sans', hybrid_get_parent_textdomain());
    ?>
 </option>
			    </select>
				<span class="description"><?php 
    _e('Choose a font for the titles.', hybrid_get_parent_textdomain());
    ?>
</span>
			</td>
		</tr>
		
		<!-- Font size -->
		<tr>
			<th>
			    <label for="<?php 
    echo hybrid_settings_field_id('oxygen_font_size');
    ?>
"><?php 
    _e('Font size:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
			    <select id="<?php 
    echo hybrid_settings_field_id('oxygen_font_size');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_font_size');
    ?>
">
				<option value="16" <?php 
    echo hybrid_get_setting('oxygen_font_size', '16') == '16' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('default', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="17" <?php 
    echo hybrid_get_setting('oxygen_font_size', '17') == '17' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('17', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="16" <?php 
    echo hybrid_get_setting('oxygen_font_size', '16') == '16' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('16', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="15" <?php 
    echo hybrid_get_setting('oxygen_font_size') == '15' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('15', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="14" <?php 
    echo hybrid_get_setting('oxygen_font_size') == '14' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('14', hybrid_get_parent_textdomain());
    ?>
 </option>				
				<option value="13" <?php 
    echo hybrid_get_setting('oxygen_font_size') == '13' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('13', hybrid_get_parent_textdomain());
    ?>
 </option>
				<option value="12" <?php 
    echo hybrid_get_setting('oxygen_font_size') == '12' ? 'selected="selected"' : '';
    ?>
> <?php 
    echo __('12', hybrid_get_parent_textdomain());
    ?>
 </option>
			    </select>
			    <span class="description"><?php 
    _e('The base font size in pixels.', hybrid_get_parent_textdomain());
    ?>
</span>
			</td>
		</tr>		
	    
		<!-- Link color -->
		<tr>
			<th>
				<label for="<?php 
    echo hybrid_settings_field_id('oxygen_link_color');
    ?>
"><?php 
    _e('Link color:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo hybrid_settings_field_id('oxygen_link_color');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_link_color');
    ?>
" size="8" value="<?php 
    echo hybrid_get_setting('oxygen_link_color') ? esc_attr(hybrid_get_setting('oxygen_link_color')) : '#0da4d3';
    ?>
" data-hex="true" />
				<div id="colorpicker_link_color"></div>
				<span class="description"><?php 
    _e('Set the theme link color.', hybrid_get_parent_textdomain());
    ?>
</span>
			</td>
		</tr>
		
		<!-- Slider Timeout -->
		<tr>
			<th>
				<label for="<?php 
    echo hybrid_settings_field_id('oxygen_slider_timeout');
    ?>
"><?php 
    _e('Slider Timeout:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo hybrid_settings_field_id('oxygen_slider_timeout');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_slider_timeout');
    ?>
" value="<?php 
    echo hybrid_get_setting('oxygen_slider_timeout') ? esc_attr(hybrid_get_setting('oxygen_slider_timeout')) : '6000';
    ?>
" />
				<span class="description"><?php 
    _e('The time interval between slides in milliseconds.', hybrid_get_parent_textdomain());
    ?>
</span>
			</td>
		</tr>		

		<!-- Custom CSS -->
		<tr>
			<th>
				<label for="<?php 
    echo hybrid_settings_field_id('oxygen_custom_css');
    ?>
"><?php 
    _e('Custom CSS:', hybrid_get_parent_textdomain());
    ?>
</label>
			</th>
			<td>
				<textarea id="<?php 
    echo hybrid_settings_field_id('oxygen_custom_css');
    ?>
" name="<?php 
    echo hybrid_settings_field_name('oxygen_custom_css');
    ?>
" cols="60" rows="8"><?php 
    echo wp_htmledit_pre(stripslashes(hybrid_get_setting('oxygen_custom_css')));
    ?>
</textarea>
				<span class="description"><?php 
    _e('Add your custom CSS here. It would overwrite any default or custom theme settings.', hybrid_get_parent_textdomain());
    ?>
</span>
			</td>
		</tr>

		<!-- End custom form elements. -->
	</table><!-- .form-table --><?php 
}
Ejemplo n.º 17
0
         if (isset($iclsettings)) {
             $this->save_settings($iclsettings);
         }
     }
     echo '1|';
     break;
 case 'copy_from_original':
     $post_id = $wpdb->get_var($wpdb->prepare("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $_POST['trid'], $_POST['lang']));
     $post = get_post($post_id);
     $error = false;
     $json = array();
     if (!empty($post)) {
         if ($_POST['editor_type'] == 'rich') {
             $json['body'] = htmlspecialchars_decode(wp_richedit_pre($post->post_content));
         } else {
             $json['body'] = htmlspecialchars_decode(wp_htmledit_pre($post->post_content));
         }
     } else {
         $json['error'] = __('Post not found', 'sitepress');
     }
     do_action('icl_copy_from_original', $post_id);
     echo json_encode($json);
     break;
 case 'save_user_preferences':
     $user_preferences = $this->get_user_preferences();
     $this->set_user_preferences(array_merge_recursive($user_preferences, $_POST['user_preferences']));
     $this->save_user_preferences();
     break;
 case 'wpml_cf_translation_preferences':
     if (empty($_POST['custom_field'])) {
         echo '<span style="color:#FF0000;">' . __('Error: No custom field', 'wpml') . '</span>';
 /**
  *
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function display_setting($args = array(), $options)
 {
     extract($args);
     if (empty($widget)) {
         echo '<div style="display:none;">';
     }
     $do_return = false;
     switch ($type) {
         case 'heading':
             if (!empty($desc)) {
                 echo '<h3>' . $desc . '</h3>';
             }
             $do_return = true;
             break;
         case 'expand_all':
             if (!empty($desc)) {
                 echo '<h3>' . $desc . '</h3>';
             }
             echo '<a id="' . $this->get_field_id($id) . '-expand" style="cursor:pointer;" onclick="jQuery( \'.af-collapsible-control\' ).slideToggle(); jQuery( \'.af-collapsible\' ).slideToggle(); jQuery( this ).hide(); jQuery( \'#' . $this->get_field_id($id) . '-collapse\' ).show();">&raquo; ' . esc_html__('Expand All Options') . '</a>';
             echo '<a id="' . $this->get_field_id($id) . '-collapse" style="cursor:pointer; display: none;" onclick="jQuery( \'.af-collapsible-control\' ).slideToggle(); jQuery( \'.af-collapsible\' ).slideToggle(); jQuery( this ).hide(); jQuery( \'#' . $this->get_field_id($id) . '-expand\' ).show();">&laquo; ' . esc_html__('Collapse All Options') . '</a>';
             $do_return = true;
             break;
         case 'expand_begin':
             if (!empty($desc)) {
                 echo '<h3>' . $desc . '</h3>';
             }
             echo '<span class="af-collapsible-control">';
             echo '<a id="' . $this->get_field_id($id) . '-expand" style="cursor:pointer;" onclick="jQuery( \'div#' . $this->get_field_id($id) . '\' ).slideToggle(); jQuery( this ).hide(); jQuery( \'#' . $this->get_field_id($id) . '-collapse\' ).show();">&raquo; ' . esc_html__('Expand') . '</a>';
             echo '<a id="' . $this->get_field_id($id) . '-collapse" style="cursor:pointer; display: none;" onclick="jQuery( \'div#' . $this->get_field_id($id) . '\' ).slideToggle(); jQuery( this ).hide(); jQuery( \'#' . $this->get_field_id($id) . '-expand\' ).show();">&laquo; ' . esc_html__('Collapse') . '</a>';
             echo '</span>';
             echo '<div id="' . $this->get_field_id($id) . '" style="display:none" class="af-collapsible">';
             $do_return = true;
             break;
         case 'expand_end':
             echo '</div>';
             $do_return = true;
             break;
         default:
             break;
     }
     if ($do_return) {
         if (empty($widget)) {
             echo '</div>';
         }
         return;
     }
     if (!isset($options[$id]) && 'checkbox' != $type) {
         $options[$id] = $std;
     } elseif (!isset($options[$id])) {
         $options[$id] = 0;
     }
     $field_class = '';
     if (!empty($class)) {
         $field_class = ' ' . $class;
     }
     echo '<p>';
     switch ($type) {
         case 'checkbox':
             echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" value="1" ' . checked($options[$id], 1, false) . ' /> ';
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             break;
         case 'select':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<select id="' . $this->get_field_id($id) . '"class="select' . $field_class . '" name="' . $this->get_field_name($id) . '">';
             foreach ($choices as $value => $label) {
                 echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
             }
             echo '</select>';
             break;
         case 'radio':
             $i = 0;
             $count_options = count($options) - 1;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="' . $this->get_field_name($id) . '" id="' . $this->get_field_name($id . $i) . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $this->get_field_name($id . $i) . '">' . $label . '</label>';
                 if ($i < $count_options) {
                     echo '<br />';
                 }
                 $i++;
             }
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             break;
         case 'textarea':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             if (function_exists('format_for_editor')) {
                 echo '<textarea class="widefat' . $field_class . '" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" placeholder="' . $std . '" rows="5" cols="30">' . format_for_editor($options[$id]) . '</textarea>';
             } else {
                 echo '<textarea class="widefat' . $field_class . '" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
             }
             break;
         case 'password':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<input class="widefat' . $field_class . '" type="password" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" value="' . esc_attr($options[$id]) . '" />';
             break;
         case 'readonly':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             echo '<input class="widefat' . $field_class . '" type="text" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" value="' . esc_attr($options[$id]) . '" readonly="readonly" />';
             break;
         case 'text':
             echo '<label for="' . $this->get_field_id($id) . '">' . $title . '</label>';
             $suggest_id = 'suggest_' . self::$suggest_id++;
             echo '<input class="widefat' . $field_class . ' ' . $suggest_id . '" type="text" id="' . $this->get_field_id($id) . '" name="' . $this->get_field_name($id) . '" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
             if ($suggest) {
                 echo static::get_suggest($id, $suggest_id);
             }
             break;
         default:
             break;
     }
     if (!empty($desc)) {
         echo '<br /><span class="setting-description"><small>' . $desc . '</small></span>';
     }
     echo '</p>';
     if (empty($widget)) {
         echo '</div>';
     }
 }
Ejemplo n.º 19
0
</textarea>
							<br />
							<?php 
    _e('A list of parameters (in a JavaScript object) that will be passed to a flash &lt;object&gt;. For a partial list of available parameters, see <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701">this page</a>. Only one parameter is specified by default: bgcolor. Defaults to {bgcolor:"#000000", allowFullScreen:true}.', 'shadowbox-js');
    ?>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row">
							<?php 
    _e('Flash Vars', 'shadowbox-js');
    ?>
						</th>
						<td>
							<textarea name="shadowbox[flashVars]" rows="10" cols="50"><?php 
    echo wp_htmledit_pre($this->get_option('flashVars'));
    ?>
</textarea>
							<br />
							<?php 
    _e('A list of variables (in a JavaScript object) that will be passed to a flash movie as <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16417">FlashVars</a>. Defaults to {}.', 'shadowbox-js');
    ?>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row">
							<?php 
    _e('Flash Version', 'shadowbox-js');
    ?>
						</th>
						<td>
Ejemplo n.º 20
0
 /**
  * Options Validate Pseudo-Callback
  *
  * @ Since 1.0.0
  * @ Updated 1.2.6
  */
 function MenuOptionsValidate($newinput, $oldinput, $optiondetails)
 {
     $valid_input = $oldinput;
     $type = isset($optiondetails['type']) ? $optiondetails['type'] : '';
     // Validate checkbox fields
     if ('checkbox' == $type) {
         // If input value is set and is true, return true; otherwise return false
         $valid_input = isset($newinput) && true == $newinput ? true : false;
     } else {
         if ('radio' == $type) {
             // Get the list of valid options
             $valid_options = $optiondetails['valid_options'];
             // Only update setting if input value is in the list of valid options
             $valid_input = array_key_exists($newinput, $valid_options) ? $newinput : $valid_input;
         } else {
             if ('select' == $type || 'select-trigger' == $type) {
                 // Get the list of valid options
                 $valid_options = $optiondetails['valid_options'];
                 // Only update setting if input value is in the list of valid options
                 $valid_input = isset($newinput) && is_array($valid_options) && array_key_exists($newinput, $valid_options) ? $newinput : $valid_input;
             } else {
                 if ('range' == $type) {
                     // Only update setting if input value is in the list of valid options
                     $max = isset($optiondetails['max']) ? $optiondetails['max'] : 100;
                     $min = isset($optiondetails['min']) ? $optiondetails['min'] : 0;
                     $valid_input = $newinput >= $min && $newinput <= $max ? $newinput : $valid_input;
                 } else {
                     if ('text' == $type || 'textarea' == $type || 'image-upload' == $type) {
                         $valid_input = strip_tags($newinput);
                         $sanatize = isset($optiondetails['sanitize']) ? $optiondetails['sanitize'] : '';
                         // Validate no-HTML content
                         // nospaces option offers additional filters
                         if ('nospaces' == $sanatize) {
                             // Pass input data through the wp_filter_nohtml_kses filter
                             $valid_input = wp_filter_nohtml_kses($newinput);
                             // Remove specified character(s)
                             if (isset($optiondetails['remove'])) {
                                 if (is_array($optiondetails['remove'])) {
                                     foreach ($optiondetails['remove'] as $remove) {
                                         $valid_input = str_replace($remove, '', $valid_input);
                                     }
                                 } else {
                                     $valid_input = str_replace($optiondetails['remove'], '', $valid_input);
                                 }
                             }
                             // Switch or encode characters
                             if (isset($optiondetails['encode']) && is_array($optiondetails['encode'])) {
                                 foreach ($optiondetails['encode'] as $find => $replace) {
                                     $valid_input = str_replace($find, $replace, $valid_input);
                                 }
                             }
                             // Replace spaces with provided character or just remove spaces
                             if (isset($optiondetails['replace'])) {
                                 $valid_input = str_replace(array('  ', ' '), $optiondetails['replace'], $valid_input);
                             } else {
                                 $valid_input = str_replace(' ', '', $valid_input);
                             }
                         } elseif ('numeric' == $sanatize && is_numeric(wp_filter_nohtml_kses($newinput))) {
                             // Pass input data through the wp_filter_nohtml_kses filter
                             $valid_input = wp_filter_nohtml_kses($newinput);
                             if (isset($optiondetails['min']) && $valid_input < $optiondetails['min']) {
                                 $valid_input = $optiondetails['min'];
                             }
                             if (isset($optiondetails['max']) && $valid_input > $optiondetails['max']) {
                                 $valid_input = $optiondetails['max'];
                             }
                         } elseif ('int' == $sanatize && is_numeric(wp_filter_nohtml_kses($newinput))) {
                             // Pass input data through the wp_filter_nohtml_kses filter
                             $valid_input = round(wp_filter_nohtml_kses($newinput));
                             if (isset($optiondetails['min']) && $valid_input < $optiondetails['min']) {
                                 $valid_input = $optiondetails['min'];
                             }
                             if (isset($optiondetails['max']) && $valid_input > $optiondetails['max']) {
                                 $valid_input = $optiondetails['max'];
                             }
                         } elseif ('tag' == $sanatize) {
                             // Pass input data through the wp_filter_nohtml_kses filter
                             $valid_input = wp_filter_nohtml_kses($newinput);
                             $valid_input = str_replace(' ', '-', $valid_input);
                         } elseif ('nohtml' == $sanatize) {
                             // Pass input data through the wp_filter_nohtml_kses filter
                             $valid_input = wp_filter_nohtml_kses($newinput);
                             $valid_input = str_replace(' ', '', $valid_input);
                         } elseif ('html' == $sanatize) {
                             // Pass input data through the wp_filter_kses filter using allowed post tags
                             $valid_input = wp_kses_post($newinput);
                         } elseif ('url' == $sanatize) {
                             $valid_input = esc_url($newinput);
                         } elseif ('css' == $sanatize) {
                             $valid_input = wp_htmledit_pre(stripslashes($newinput));
                         } elseif ('stripslashes' == $sanatize) {
                             $valid_input = stripslashes($newinput);
                         }
                     } else {
                         if ('wp-textarea' == $type) {
                             // Text area filter
                             $valid_input = wp_kses_post(force_balance_tags($newinput));
                         } elseif ('color' == $type) {
                             $value = wp_filter_nohtml_kses($newinput);
                             if ('#' == $value) {
                                 $valid_input = '';
                             } else {
                                 $valid_input = $value;
                             }
                         }
                     }
                 }
             }
         }
     }
     return $valid_input;
 }
 function filter_excerpt_field_content_copy($elements)
 {
     if ($elements['post_type'] == 'product') {
         $elements['excerpt']['editor_type'] = 'editor';
     }
     if ($_POST['excerpt_type'] == 'rich') {
         $elements['excerpt']['value'] = htmlspecialchars_decode(wp_richedit_pre($elements['excerpt']['value']));
     } else {
         $elements['excerpt']['value'] = htmlspecialchars_decode(wp_htmledit_pre($elements['excerpt']['value']));
     }
     return $elements;
 }
Ejemplo n.º 22
0
 /**
  * HTML output for text field
  */
 public function display_setting($args = array())
 {
     extract($args);
     $options = get_option('leafletmapsmarker_options');
     if (!isset($options[$id]) && $type != 'checkbox') {
         $options[$id] = $std;
     } elseif (!isset($options[$id])) {
         $options[$id] = 0;
     }
     $field_class = '';
     if ($class != '') {
         $field_class = ' ' . $class;
     }
     switch ($type) {
         case 'heading':
             echo '</td></tr><tr valign="top"><td colspan="2" rowspan="2"><h3 class="h3-lmm-settings">' . $desc . '</h3>';
             break;
         case 'helptext':
             echo '</td></tr><tr valign="top"><td colspan="2">' . $desc . '';
             break;
         case 'helptext-twocolumn':
             echo $desc;
             break;
         case 'checkbox':
             echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
             break;
         case 'checkbox-pro':
             echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' disabled="disabled" /> <label for="' . $id . '">' . $desc . '</label>';
             break;
         case 'checkbox-readonly':
             echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' disabled="disabled" /> <label for="' . $id . '">' . $desc . '</label>';
             break;
         case 'select':
             echo '<select class="select' . $field_class . '" name="leafletmapsmarker_options[' . $id . ']">';
             foreach ($choices as $value => $label) {
                 echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
             }
             echo '</select>';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'select-pro':
             echo '<select class="select' . $field_class . '" name="leafletmapsmarker_options[' . $id . ']">';
             foreach ($choices as $value => $label) {
                 echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . ' disabled="disabled">' . $label . '</option>';
             }
             echo '</select>';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'radio':
             $i = 0;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="leafletmapsmarker_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                 if ($i < count($options) - 1) {
                     echo '<br />';
                 }
                 $i++;
             }
             if ($desc != '') {
                 echo '<span class="description">' . $desc . '</span>';
             }
             break;
         case 'radio-reverse':
             if ($desc != '') {
                 echo '<span class="description">' . $desc . '</span><br/>';
             }
             $i = 0;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="leafletmapsmarker_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                 if ($i < count($options) - 1) {
                     echo '<br />';
                 }
                 $i++;
             }
             break;
         case 'radio-pro':
             $i = 0;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="leafletmapsmarker_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . ' disabled="disabled"> <label for="' . $id . $i . '">' . $label . '</label>';
                 if ($i < count($options) - 1) {
                     echo '<br />';
                 }
                 $i++;
             }
             if ($desc != '') {
                 echo '<span class="description">' . $desc . '</span>';
             }
             break;
         case 'radio-reverse-pro':
             if ($desc != '') {
                 echo '<span class="description">' . $desc . '</span><br/>';
             }
             $i = 0;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="leafletmapsmarker_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . ' disabled="disabled"> <label for="' . $id . $i . '">' . $label . '</label>';
                 if ($i < count($options) - 1) {
                     echo '<br />';
                 }
                 $i++;
             }
             break;
         case 'textarea':
             echo '<textarea class="' . $field_class . '" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'textarea-pro':
             echo '<textarea class="' . $field_class . '" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30" disabled="disabled">' . wp_htmledit_pre($options[$id]) . '</textarea>';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'password':
             echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" value="' . esc_attr($options[$id]) . '" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'text':
         default:
             echo '<input class="regular-text' . $field_class . '" style="width:30em;" type="text" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'text-reverse':
             if ($desc != '') {
                 echo '<span class="description">' . $desc . '</span><br />';
             }
             echo '<input class="regular-text' . $field_class . '" style="width:30em;" type="text" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
             break;
         case 'text-pro':
             echo '<input class="regular-text' . $field_class . '" style="width:30em;" type="text" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" disabled="disabled" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'text-reverse-pro':
             if ($desc != '') {
                 echo '<span class="description">' . $desc . '</span><br/>';
             }
             echo '<input class="regular-text' . $field_class . '" style="width:30em;" type="text" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" disabled="disabled" />';
             break;
         case 'text-readonly':
             echo '<input readonly="readonly" class="regular-text' . $field_class . '" style="width:60em;" type="text" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'text-deletable':
             echo '<input class="regular-text' . $field_class . '" style="width:60em;" type="text" id="' . $id . '" name="leafletmapsmarker_options[' . $id . ']" value="' . esc_attr($options[$id]) . '" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
     }
 }
Ejemplo n.º 23
0
    function create_field($field)
    {
        global $q_config, $wp_version;
        $languages = qtrans_getSortedLanguages(true);
        $values = qtrans_split($field['value'], $quicktags = true);
        $currentLanguage = $this->plugin->get_active_language();
        echo '<div class="multi-language-field multi-language-field-wysiwyg">';
        foreach ($languages as $language) {
            $class = $language === $currentLanguage ? 'wp-switch-editor current-language' : 'wp-switch-editor';
            echo '<a class="' . $class . '" data-language="' . $language . '">' . $q_config['language_name'][$language] . '</a>';
        }
        foreach ($languages as $language) {
            $value = $values[$language];
            $id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
            $name = $field['name'] . "[{$language}]";
            $class = $language === $currentLanguage ? 'acf_wysiwyg wp-editor-wrap current-language' : 'acf_wysiwyg wp-editor-wrap';
            ?>
			<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="<?php 
            echo $class;
            ?>
" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
" data-language="<?php 
            echo $language;
            ?>
">
				<?php 
            if (user_can_richedit() && $field['media_upload'] == 'yes') {
                ?>
					<?php 
                if (version_compare($wp_version, '3.3', '<')) {
                    ?>
						<div id="editor-toolbar">
							<div id="media-buttons" class="hide-if-no-js">
								<?php 
                    do_action('media_buttons');
                    ?>
							</div>
						</div>
					<?php 
                } else {
                    ?>
						<div id="wp-<?php 
                    echo $id;
                    ?>
-editor-tools" class="wp-editor-tools">
							<div id="wp-<?php 
                    echo $id;
                    ?>
-media-buttons" class="hide-if-no-js wp-media-buttons">
								<?php 
                    do_action('media_buttons');
                    ?>
							</div>
						</div>
					<?php 
                }
                ?>
				<?php 
            }
            ?>
				<div id="wp-<?php 
            echo $id;
            ?>
-editor-container" class="wp-editor-container">
					<textarea id="<?php 
            echo $id;
            ?>
" class="qtx-wp-editor-area" name="<?php 
            echo $name;
            ?>
" ><?php 
            if (user_can_richedit()) {
                echo wp_richedit_pre($field['value']);
            } else {
                echo wp_htmledit_pre($field['value']);
            }
            ?>
</textarea>
				</div>
			</div>
		<?php 
        }
        echo '</div>';
    }
function hatch_theme_meta_box()
{
    ?>

	<table class="form-table">
	    
		<!-- Favicon upload -->
		<tr class="favicon_url">
			<th>
				<label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_favicon_url'));
    ?>
"><?php 
    _e('Favicon:', 'hatch');
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_favicon_url'));
    ?>
" name="<?php 
    echo esc_attr(hybrid_settings_field_name('hatch_favicon_url'));
    ?>
" value="<?php 
    echo esc_url(hybrid_get_setting('hatch_favicon_url'));
    ?>
" />
				<input id="hatch_favicon_upload_button" class="button" type="button" value="Upload" />
				<br />
				<span class="description"><?php 
    _e('Upload favicon image (recommended max size: 32x32).', 'hatch');
    ?>
</span>
				
				<?php 
    /* Display uploaded image */
    if (hybrid_get_setting('hatch_favicon_url')) {
        ?>
                    <p><img src="<?php 
        echo esc_url(hybrid_get_setting('hatch_favicon_url'));
        ?>
" alt="" /></p>
				<?php 
    }
    ?>
			</td>
		</tr>
		
		<!-- Logo upload -->
		<tr class="logo_url">
			<th>
				<label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_logo_url'));
    ?>
"><?php 
    _e('Logo:', 'hatch');
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_logo_url'));
    ?>
" name="<?php 
    echo esc_attr(hybrid_settings_field_name('hatch_logo_url'));
    ?>
" value="<?php 
    echo esc_url(hybrid_get_setting('hatch_logo_url'));
    ?>
" />
				<input id="hatch_logo_upload_button" class="button" type="button" value="Upload" />
				<br />
				<span class="description"><?php 
    _e('Upload logo image (recommended max width: 200px).', 'hatch');
    ?>
</span>
				
				<?php 
    /* Display uploaded image */
    if (hybrid_get_setting('hatch_logo_url')) {
        ?>
                    <p><img src="<?php 
        echo esc_url(hybrid_get_setting('hatch_logo_url'));
        ?>
" alt="" /></p>
				<?php 
    }
    ?>
			</td>
		</tr>
		
		<!-- Author Description -->
		<tr>
			<th>
				<label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_author_bio'));
    ?>
"><?php 
    _e('Author:', 'hatch');
    ?>
</label>
			</th>
			<td>
				
				<?php 
    /* Set arguments for the authors dropdown list */
    $author_bio_id = hybrid_settings_field_id('hatch_author_bio');
    $author_bio_name = hybrid_settings_field_name('hatch_author_bio');
    $author_bio_selected = hybrid_get_setting('hatch_author_bio');
    $args = array('id' => $author_bio_id, 'name' => $author_bio_name, 'selected' => $author_bio_selected);
    /* Display the authors dropdown list */
    wp_dropdown_users($args);
    ?>
				
				<span class="description"><?php 
    _e('Whose biography to display on the home page?', 'hatch');
    ?>
</span>
				
			</td>
		</tr>		
		
		<!-- Font family -->
		<tr>
			<th>
				<label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_font_family'));
    ?>
"><?php 
    _e('Font family:', 'hatch');
    ?>
</label>
			</th>
			<td>
			    <select id="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_font_family'));
    ?>
" name="<?php 
    echo esc_attr(hybrid_settings_field_name('hatch_font_family'));
    ?>
">
				<option value="Arial" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Arial');
    ?>
> <?php 
    echo __('Arial', 'hatch');
    ?>
 </option>
				<option value="Verdana" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Verdana');
    ?>
> <?php 
    echo __('Verdana', 'hatch');
    ?>
 </option>				
				<option value="Bitter" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Bitter');
    ?>
> <?php 
    echo __('Bitter', 'hatch');
    ?>
 </option>
				<option value="Georgia" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Georgia');
    ?>
> <?php 
    echo __('Georgia', 'hatch');
    ?>
 </option>
				<option value="Droid Serif" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Droid Serif');
    ?>
> <?php 
    echo __('Droid Serif', 'hatch');
    ?>
 </option>				
				<option value="Helvetica" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Helvetica');
    ?>
> <?php 
    echo __('Helvetica', 'hatch');
    ?>
 </option>
				<option value="Istok Web" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Istok Web');
    ?>
> <?php 
    echo __('Istok Web', 'hatch');
    ?>
 </option>			
				<option value="Lucida Sans Unicode" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Lucida Sans Unicode');
    ?>
> <?php 
    echo __('Lucida Sans Unicode', 'hatch');
    ?>
 </option>
				<option value="Droid Sans" <?php 
    selected(hybrid_get_setting('hatch_font_family'), 'Droid Sans');
    ?>
> <?php 
    echo __('Droid Sans', 'hatch');
    ?>
 </option>
			    </select>
			</td>
		</tr>
		
		<!-- Font size -->
		<tr>
			<th>
			    <label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_font_size'));
    ?>
"><?php 
    _e('Font size:', 'hatch');
    ?>
</label>
			</th>
			<td>
			    <select id="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_font_size'));
    ?>
" name="<?php 
    echo esc_attr(hybrid_settings_field_name('hatch_font_size'));
    ?>
">
				<option value="16" <?php 
    selected(hybrid_get_setting('hatch_font_size'), '16');
    ?>
> <?php 
    echo __('default', 'hatch');
    ?>
 </option>
				<option value="17" <?php 
    selected(hybrid_get_setting('hatch_font_size'), '17');
    ?>
> <?php 
    echo __('17', 'hatch');
    ?>
 </option>
				<option value="16" <?php 
    selected(hybrid_get_setting('hatch_font_size'), '16');
    ?>
> <?php 
    echo __('16', 'hatch');
    ?>
 </option>
				<option value="15" <?php 
    selected(hybrid_get_setting('hatch_font_size'), '15');
    ?>
> <?php 
    echo __('15', 'hatch');
    ?>
 </option>
				<option value="14" <?php 
    selected(hybrid_get_setting('hatch_font_size'), '14');
    ?>
> <?php 
    echo __('14', 'hatch');
    ?>
 </option>
			    </select>
			    <span class="description"><?php 
    _e('The base font size in pixels.', 'hatch');
    ?>
</span>
			</td>
		</tr>		
	    
		<!-- Link color -->
		<tr>
			<th>
				<label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_link_color'));
    ?>
"><?php 
    _e('Link color:', 'hatch');
    ?>
</label>
			</th>
			<td>
				<input type="text" id="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_link_color'));
    ?>
" name="<?php 
    echo esc_attr(hybrid_settings_field_name('hatch_link_color'));
    ?>
" size="8" value="<?php 
    echo hybrid_get_setting('hatch_link_color') ? esc_attr(hybrid_get_setting('hatch_link_color')) : '#64a2d8';
    ?>
" data-hex="true" />
				<div id="colorpicker_link_color"></div>
				<span class="description"><?php 
    _e('Set the theme link color.', 'hatch');
    ?>
</span>
			</td>
		</tr>	    

		<!-- Custom CSS -->
		<tr>
			<th>
				<label for="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_custom_css'));
    ?>
"><?php 
    _e('Custom CSS:', 'hatch');
    ?>
</label>
			</th>
			<td>
				<textarea id="<?php 
    echo esc_attr(hybrid_settings_field_id('hatch_custom_css'));
    ?>
" name="<?php 
    echo esc_attr(hybrid_settings_field_name('hatch_custom_css'));
    ?>
" cols="60" rows="8"><?php 
    echo wp_htmledit_pre(stripslashes(hybrid_get_setting('hatch_custom_css')));
    ?>
</textarea>
				<span class="description"><?php 
    _e('Add your custom CSS here. It would overwrite any default or custom theme settings.', 'hatch');
    ?>
</span>
			</td>
		</tr>

		<!-- End custom form elements. -->
	</table><!-- .form-table --><?php 
}
Ejemplo n.º 25
0
					jQuery('#extra-fields').html('');
				});
				jQuery('.close').click(function() {
					jQuery('#extra-fields').hide();
					jQuery('#extra-fields').html('');
				});
			/* ]]> */
			</script>
			<div class="postbox">
				<h2><label for="embed-code"><?php 
            _e('Embed Code');
            ?>
</label></h2>
				<div class="inside">
					<textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php 
            echo wp_htmledit_pre($selection);
            ?>
</textarea>
					<p id="options"><a href="#" class="select button"><?php 
            _e('Insert Video');
            ?>
</a> <a href="#" class="close button"><?php 
            _e('Cancel');
            ?>
</a></p>
				</div>
			</div>
			<?php 
            break;
        case 'photo_thickbox':
            ?>
Ejemplo n.º 26
0
							$disabled = false;
							$class = 'all-options';
							if ( is_serialized( $option->option_value ) ) {
								if ( is_serialized_string( $option->option_value ) ) {
									$option->option_value = esc_html( maybe_unserialize( $option->option_value ), 'single' );
								} else {
									$option->option_value = 'SERIALIZED DATA';
									$disabled = true;
									$class = 'all-options disabled';
								}
							}
							if ( strpos( $option->option_value, "\n" ) !== false ) {
							?>
								<tr class="form-field">
									<th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
									<td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php echo wp_htmledit_pre( $option->option_value ) ?></textarea></td>
								</tr>
							<?php
							} else {
							?>
								<tr class="form-field">
									<th scope="row"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th>
									<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
									<td><code><?php echo esc_html( $option->option_value ) ?></code></td>
									<?php } else { ?>
									<td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
									<?php } ?>
								</tr>
							<?php
							}
						} // End foreach
			/* <![CDATA[ */
				jQuery('.select').click(function() {
					append_editor(jQuery('#embed-code').val());
					jQuery('#extra-fields').hide();
					jQuery('#extra-fields').html('');
				});
				jQuery('.close').click(function() {
					jQuery('#extra-fields').hide();
					jQuery('#extra-fields').html('');
				});
			/* ]]> */
			</script>
			<div class="postbox">
				<h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
				<div class="inside">
					<textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo wp_htmledit_pre( $selection ); ?></textarea>
					<p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p>
				</div>
			</div>
			<?php break;

		case 'photo_thickbox': ?>
			<script type="text/javascript" charset="utf-8">
				/* <![CDATA[ */
				jQuery('.cancel').click(function() {
					tb_remove();
				});
				jQuery('.select').click(function() {
					image_selector();
				});
				/* ]]> */
Ejemplo n.º 28
0
    /**
     * HTML output for text field
     *
     * @since 1.0
     */
    public function display_setting($args = array())
    {
        extract($args);
        $name = $this->theme_safename;
        $options = get_option($name . '-options');
        if (!isset($options[$id])) {
            $options[$id] = $std;
        } elseif (!isset($options[$id])) {
            $options[$id] = 0;
        }
        $field_class = '';
        if ($class != '') {
            $field_class = ' ' . $class;
        }
        switch ($type) {
            case 'description':
                echo '<span class="description' . $field_class . '">' . $desc . '</span>';
                break;
            case 'heading':
                echo '</td></tr><tr valign="top"><td colspan="2"><h4>' . $desc . '</h4>';
                break;
            case 'checkbox':
                echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $name . '-options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
                break;
            case 'select':
                echo '<select class="select' . $field_class . '" name="' . $name . '-options[' . $id . ']">';
                foreach ($choices as $value => $label) {
                    echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'radio':
                $i = 0;
                foreach ($choices as $value => $label) {
                    echo '<input class="radio' . $field_class . '" type="radio" name="' . $name . '-options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    if ($i < count($options) - 1) {
                        echo '<br />';
                    }
                    $i++;
                }
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'textarea':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="' . $name . '-options[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'password':
                echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="' . $name . '-options[' . $id . ']" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'email':
                echo '<input class="regular-text' . $field_class . '" type="email" id="' . $id . '" name="' . $name . '-options[' . $id . ']" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'url':
                echo '<input class="regular-text' . $field_class . '" type="url" id="' . $id . '" name="' . $name . '-options[' . $id . ']" value="' . esc_url($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'upload':
                echo '<input id="' . $id . '" class="upload-url' . $field_class . '" type="text" name="' . $name . '-options[' . $id . ']" value="' . esc_url($options[$id]) . '" /> 
				<input id="' . $id . '-upload_button" class="upload_button button-secondary" type="button" name="' . $name . '-upload_button" value="Upload" />
				<input id="' . $id . '-remove_button" class="remove_button button-secondary" type="button" name="' . $name . '-remove_button" value="Remove" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                echo '<br /><div class="media-preview"><img id="' . $id . '-preview" class="upload-preview" src="' . esc_url($options[$id]) . '" /></div>';
                break;
            case 'styles':
                $choices = $this->alt_css;
                echo '<select class="select' . $field_class . '" name="' . $name . '-options[' . $id . ']">';
                foreach ($choices as $value => $label) {
                    echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'color':
                echo '<input class="regular-text color' . $field_class . '" type="text" id="' . $id . '" name="' . $name . '-options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" data-default-color="' . $std . '" style="border-bottom: 6px solid ' . $std . '" />';
                echo '<input type="button" class="button-secondary color-reset" value="Reset" />';
                if ($desc != '') {
                    echo '<br/><span class="description">' . $desc . '</span>';
                }
                //echo '<div class="booho"></div> ';
                //echo '<div class="color-preview" style="width: 50px;>&nbsp;</div> ';
                break;
            case 'text':
            default:
                echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . $name . '-options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
        }
    }
Ejemplo n.º 29
0
 /**
  * HTML output for text field
  */
 public function display_setting($args = array())
 {
     extract($args);
     $options = get_option('t3i_options');
     if (!isset($options[$id]) && $type != 'checkbox') {
         $options[$id] = $std;
     } elseif (!isset($options[$id])) {
         $options[$id] = 0;
     }
     $field_class = '';
     if ($class != '') {
         $field_class = ' ' . $class;
     }
     switch ($type) {
         case 'heading':
             echo '</td></tr><tr valign="top"><td colspan="2"><h4>' . $desc . '</h4>';
             break;
         case 'checkbox':
             echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="t3i_options[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
             break;
         case 'select':
             echo '<select class="select' . $field_class . '" name="t3i_options[' . $id . ']">';
             foreach ($choices as $value => $label) {
                 echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
             }
             echo '</select>';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'radio':
             $i = 0;
             foreach ($choices as $value => $label) {
                 echo '<input class="radio' . $field_class . '" type="radio" name="t3i_options[' . $id . ']" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                 if ($i < count($options) - 1) {
                     echo '<br />';
                 }
                 $i++;
             }
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'textarea':
             echo '<textarea class="' . $field_class . '" id="' . $id . '" name="t3i_options[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'password':
             echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="t3i_options[' . $id . ']" value="' . esc_attr($options[$id]) . '" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
         case 'text':
         default:
             echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="t3i_options[' . $id . ']" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
             if ($desc != '') {
                 echo '<br /><span class="description">' . $desc . '</span>';
             }
             break;
     }
 }
Ejemplo n.º 30
0
    public function display_setting($args = array())
    {
        global $shortname;
        $shortname_options = $shortname . '_options';
        extract($args);
        $options = get_option($shortname . '_options');
        if (empty($options)) {
            $options[$id] = $std;
        } elseif (!isset($options[$id])) {
            $options[$id] = 0;
        }
        $field_class = '';
        if ($class != '') {
            $field_class = ' class="' . $class . '"';
        }
        switch ($type) {
            case 'heading':
                echo '</td></tr><tr valign="top"><td colspan="2"><h4>' . $desc . '</h4>';
                break;
            case 'checkbox':
                echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" value="1" ' . checked($options[$id], 1, false) . ' /> <label for="' . $id . '">' . $desc . '</label>';
                break;
            case 'select':
                echo '<select class="select' . $field_class . '" name="' . $shortname_options . '[' . $id . ']' . '">';
                foreach ($choices as $value => $label) {
                    echo '<option value="' . esc_attr($value) . '"' . selected($options[$id], $value, false) . '>' . $label . '</option>';
                }
                echo '</select>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'radio':
                $i = 0;
                foreach ($choices as $value => $label) {
                    echo '<input class="radio' . $field_class . '" type="radio" name="' . $shortname_options . '[' . $id . ']' . '" id="' . $id . $i . '" value="' . esc_attr($value) . '" ' . checked($options[$id], $value, false) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    if ($i < count($options) - 1) {
                        echo '<br />';
                    }
                    $i++;
                }
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'textarea':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre($options[$id]) . '</textarea>';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'password':
                echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'text':
            default:
                echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" placeholder="' . $std . '" value="' . esc_attr($options[$id]) . '" />';
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'html':
            default:
                echo $std;
                if ($desc != '') {
                    echo '<br /><span class="description">' . $desc . '</span>';
                }
                break;
            case 'upload':
            default:
                echo '<input id="' . $id . '" class="upload-url' . $field_class . '" type="text" name="' . $shortname_options . '[' . $id . ']' . '" value="' . esc_attr($options[$id]) . '" /><input id="st_upload_button" class="st_upload_button" type="button" name="upload_button" value="Upload" />';
                if ($desc != '') {
                    echo '
				   <span class="description">' . $desc . '</span>';
                }
                echo '<div class="upload-img-preview">';
                if (esc_attr($options[$id] != '')) {
                    echo '<img class="upload-img-preview" src=' . esc_attr($options[$id]) . ' />';
                    echo '<a class="removeupload">' . __('Delete Image', 'icore') . '</a>';
                }
                echo '</div>';
                break;
            case 'slide':
                if ($desc != '') {
                    echo '<span class="description' . $field_class . '">' . $desc . '</span>';
                }
                echo '<br /><span id="slides-details-button"></span>';
                echo '<ul id="slideshow_list">';
                if ($options['slider'] != '') {
                    $slides = array();
                    foreach ($options[$id]['title'] as $k => $v) {
                        $slides[] = array('title' => $v, 'link' => $options[$id]['link'][$k], 'caption' => $options[$id]['caption'][$k], 'image' => $options[$id]['image'][$k]);
                    }
                    $i = 1;
                    foreach ($slides as $slide) {
                        echo '<li class="slide">';
                        echo '<a class="editslideimage">edit</a>';
                        echo '<div class="image-details slidedetails">';
                        echo '<span class="description">' . __('Slide Title', 'icore') . '</span>';
                        echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . '][title][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="' . $slide['title'] . '" type="text" />';
                        echo '<span class="description">' . __('Slide Link', 'icore') . '</span>';
                        echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . '][link][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="' . $slide['link'] . '" type="text" />';
                        echo '<span class="description">' . __('Slide Caption', 'icore') . '</span>';
                        echo '<textarea class="' . $field_class . '" name="' . $shortname_options . '[' . $id . '][caption][]" id="' . $id . '_caption_' . $i . '" cols="40" rows="4">' . $slide['caption'] . '</textarea>';
                        echo '<span class="description">' . __('Slide Image', 'icore') . '</span>';
                        echo '<input class="upload-input-text src" name="' . $shortname_options . '[' . $id . '][image][]" id="' . $id . '_image_' . $i . '" type="text" value="' . $slide['image'] . '" type="text" />
								<a href="' . get_option('siteurl') . '/wp-admin/admin-ajax.php?action=choice&width=150&height=100" id="' . $id . '_button" class="button upbutton">' . __('Upload') . '</a>';
                        echo '<a class="doneslideimage">Done</a>';
                        echo '</div>';
                        echo '<div class="clear"></div><div class="upload-img-preview">';
                        if ($slide['image'] != "") {
                            echo '<img class="upload-img-preview" id="image_' . $id . '_image_' . $i . '" src="' . $slide['image'] . '" />';
                        }
                        echo '</div>';
                        echo '<a class="remove_slide submitdelete">' . __('Delete Slide', 'icore') . '</a>';
                        echo '</li>';
                        $i++;
                    }
                } else {
                    $i = 1;
                    echo '<li class="slide">';
                    echo '<span class="description">' . __('Slide Title', 'icore') . '</span>';
                    echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . '][title][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="" type="text" />';
                    echo '<span class="description">' . __('Slide Link', 'icore') . '</span>';
                    echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . '][link][]" placeholder="' . $std . '" id="' . $id . '_title_' . $i . '"  value="" type="text" />';
                    echo '<span class="description">' . __('Slide Caption', 'icore') . '</span>';
                    echo '<textarea class="' . $field_class . '" name="' . $shortname_options . '[' . $id . '][caption][]" id="' . $id . '_caption_' . $i . '" cols="40" rows="4"></textarea>';
                    echo '<span class="description">' . __('Slide Image', 'icore') . '</span>';
                    echo '<input class="upload-input-text src" name="' . $shortname_options . '[' . $id . '][image][]" id="' . $id . '_image_' . $i . '" type="text" value="" type="text" />
							<a href="' . get_option('siteurl') . '/wp-admin/admin-ajax.php?action=choice&width=150&height=100" id="' . $id . '_button" class="button upbutton">' . __('Upload', 'icore') . '</a>';
                    echo '<div class="clear"></div><div class="upload-img-preview">';
                    echo '</div>';
                    echo '<a class="remove_slide submitdelete">' . __('Delete Slide') . '</a>';
                    echo '</li>';
                }
                echo '</ul>';
                break;
        }
    }