コード例 #1
0
/**
 * Output a select input box.
 * @param array $field
 */
function axiscomposer_wp_select($field)
{
    global $thepostid, $post;
    $thepostid = empty($thepostid) ? $post->ID : $thepostid;
    $field['class'] = isset($field['class']) ? $field['class'] : 'select short';
    $field['style'] = isset($field['style']) ? $field['style'] : '';
    $field['desc_class'] = isset($field['desc_class']) ? $field['desc_class'] : '';
    $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
    $field['value'] = isset($field['value']) ? $field['value'] : get_post_meta($thepostid, $field['id'], true);
    $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];
    // Custom attribute handling
    $custom_attributes = array();
    if (!empty($field['custom_attributes']) && is_array($field['custom_attributes'])) {
        foreach ($field['custom_attributes'] as $attribute => $value) {
            $custom_attributes[] = esc_attr($attribute) . '="' . esc_attr($value) . '"';
        }
    }
    // Description handling
    $description = '';
    if (!empty($field['description'])) {
        if (isset($field['desc_tip']) && false !== $field['desc_tip']) {
            $description = ac_help_tip($field['description']);
        } else {
            $description = '<span class="description ' . esc_attr($field['desc_class']) . '">' . wp_kses_post($field['description']) . '</span>';
        }
    }
    echo '<p class="form-field ' . esc_attr($field['id']) . '_field ' . esc_attr($field['wrapper_class']) . '"><label for="' . esc_attr($field['id']) . '">' . wp_kses_post($field['label']) . '</label>';
    if (isset($field['desc_side']) && true === $field['desc_side']) {
        echo $description;
    }
    echo '<select id="' . esc_attr($field['id']) . '" name="' . esc_attr($field['name']) . '" class="' . esc_attr($field['class']) . '" style="' . esc_attr($field['style']) . '" ' . implode(' ', $custom_attributes) . '>';
    foreach ($field['options'] as $key => $value) {
        echo '<option value="' . esc_attr($key) . '" ' . selected(esc_attr($field['value']), esc_attr($key), false) . '>' . esc_html($value) . '</option>';
    }
    echo '</select> ';
    if (isset($field['desc_side']) && false === $field['desc_side']) {
        echo $description;
    }
    echo '</p>';
}
コード例 #2
0
 /**
  * Get HTML for tooltips.
  *
  * @param  array $data
  * @return string
  */
 public function get_tooltip_html($data)
 {
     if ($data['desc_tip'] === true) {
         $tip = $data['description'];
     } elseif (!empty($data['desc_tip'])) {
         $tip = $data['desc_tip'];
     } else {
         $tip = '';
     }
     return $tip ? ac_help_tip($tip, true) : '';
 }
コード例 #3
0
 /**
  * Helper function to get the formated description and tip HTML for a
  * given form field. Plugins can call this when implementing their own custom
  * settings types.
  *
  * @param  array $value The form field value array
  * @return array The description and tip as a 2 element array
  */
 public static function get_field_description($value)
 {
     $description = '';
     $tooltip_html = '';
     if (true === $value['desc_tip']) {
         $tooltip_html = $value['desc'];
     } elseif (!empty($value['desc_tip'])) {
         $description = $value['desc'];
         $tooltip_html = $value['desc_tip'];
     } elseif (!empty($value['desc'])) {
         $description = $value['desc'];
     }
     if ($description && in_array($value['type'], array('textarea', 'radio'))) {
         $description = '<p style="margin-top:0">' . wp_kses_post($description) . '</p>';
     } elseif ($description && in_array($value['type'], array('checkbox'))) {
         $description = wp_kses_post($description);
     } elseif ($description) {
         $description = '<span class="description">' . wp_kses_post($description) . '</span>';
     }
     if ($tooltip_html && in_array($value['type'], array('checkbox'))) {
         $tooltip_html = '<p class="description">' . $tooltip_html . '</p>';
     } elseif ($tooltip_html) {
         $tooltip_html = ac_help_tip($tooltip_html);
     }
     return array('description' => $description, 'tooltip_html' => $tooltip_html);
 }
コード例 #4
0
</td>
			<td><?php 
    echo $parent_theme->{'Author URI'};
    ?>
</td>
		</tr>
		<?php 
}
?>
		<tr>
			<td data-export-label="AxisComposer Support"><?php 
_e('AxisComposer support', 'axiscomposer');
?>
:</td>
			<td class="help"><?php 
echo ac_help_tip(__('Displays whether or not the current active theme declares AxisComposer support.', 'axiscomposer'));
?>
</td>
			<td><?php 
if (!current_theme_supports('axiscomposer') && !in_array($active_theme->template, ac_get_core_supported_themes())) {
    echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __('Not declared', 'axiscomposer') . '</mark>';
} else {
    echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
}
?>
</td>
		</tr>
	</tbody>
</table>

<?php