本文整理汇总了PHP中ud_get_wp_property函数的典型用法代码示例。如果您正苦于以下问题:PHP ud_get_wp_property函数的具体用法?PHP ud_get_wp_property怎么用?PHP ud_get_wp_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ud_get_wp_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run Upgrade Process
*
* @param $old_version
* @param $new_version
*/
public static function run($old_version, $new_version)
{
self::do_backup($old_version, $new_version);
/**
* WP-Property 1.42.4 and less compatibility
*/
update_option("wpp_version", $new_version);
/**
* Specific upgrade conditions.
*/
switch (true) {
case version_compare($old_version, '2.1.1', '<'):
/*
* Enable Legacy Features
*/
$settings = get_option('wpp_settings');
if (!empty($settings['configuration'])) {
$settings['configuration']['enable_legacy_features'] = 'true';
}
update_option('wpp_settings', $settings);
break;
}
/* Additional stuff can be handled here */
do_action(ud_get_wp_property()->slug . '::upgrade', $old_version, $new_version);
}
示例2: meta
/**
* Get meta value
*
* @param int $post_id
* @param bool $saved
* @param array $field
*
* @return mixed
*/
static function meta($post_id, $saved, $field)
{
/**
* For special fields like 'divider', 'heading' which don't have ID, just return empty string
* to prevent notice error when displayin fields
*/
if (empty($field['id'])) {
return '';
}
/**
* Maybe set value from parent
*/
$post = get_post($post_id);
if ($post && $post->post_parent > 0) {
$property_inheritance = ud_get_wp_property('property_inheritance', array());
$type = get_post_meta($post_id, 'property_type', true);
if (isset($property_inheritance[$type]) && in_array($field['id'], $property_inheritance[$type])) {
$meta = get_post_meta($post->post_parent, $field['id'], !$field['multiple']);
}
}
if (!$meta) {
$meta = get_post_meta($post_id, $field['id'], !$field['multiple']);
}
// Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
$meta = !$saved && '' === $meta || array() === $meta ? $field['std'] : $meta;
// Escape attributes
$meta = call_user_func(array(RW_Meta_Box::get_class_name($field), 'esc_meta'), $meta);
return $meta;
}
示例3: form
/**
* Renders form based on Shortcode's params
*
* @param array $instance
*/
public function form($instance)
{
?>
<p>
<label class="widefat" for="<?php
echo $this->get_field_id('_widget_title');
?>
"><?php
_e('Title', ud_get_wp_property('domain'));
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('_widget_title');
?>
"
name="<?php
echo $this->get_field_name('_widget_title');
?>
" type="text"
value="<?php
echo !empty($instance['_widget_title']) ? $instance['_widget_title'] : '';
?>
"/>
<span class="description"><?php
_e('Widget\'s Title', ud_get_wp_property('domain'));
?>
</span>
</p>
<?php
parent::form($instance);
}
示例4: process_bulk_action
/**
* Handle Bulk Action's request
*
*/
public function process_bulk_action()
{
global $wpdb;
try {
switch ($this->current_action()) {
case 'unassign':
if (empty($_REQUEST['post_ids']) || !is_array($_REQUEST['post_ids'])) {
throw new \Exception(sprintf(__('Invalid request: no %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
}
$post_ids = $_REQUEST['post_ids'];
foreach ($post_ids as $post_id) {
$post_id = (int) $post_id;
if (!$post_id) {
throw new \Exception(sprintf(__('Invalid request: incorrect %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
}
$wpdb->query($wpdb->prepare("\n UPDATE {$wpdb->posts}\n SET post_parent = '0'\n WHERE ID = %d\n ", $post_id));
clean_post_cache($post_id);
}
$label = count($post_ids) > 1 ? __('Children', ud_get_wp_property('domain')) : __('Child', ud_get_wp_property('domain'));
$this->message = sprintf(__('Selected %s have been successfully un-assigned from current %s.', ud_get_wp_property('domain')), $label, \WPP_F::property_label());
break;
default:
//** Any custom action can be processed using action hook */
do_action('wpp::children_list_table::process_bulk_action', $this->current_action());
break;
}
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
}
示例5: run
/**
* Run Upgrade Process
*
* @param $old_version
* @param $new_version
*/
public static function run($old_version, $new_version)
{
self::do_backup($old_version, $new_version);
/**
* WP-Property 1.42.4 and less compatibility
*/
update_option("wpp_version", $new_version);
/**
* Specific upgrade conditions.
*/
switch (true) {
case version_compare($old_version, '2.1.1', '<'):
/*
* Enable Legacy Features
*/
$settings = get_option('wpp_settings');
if (!empty($settings['configuration'])) {
$settings['configuration']['enable_legacy_features'] = 'true';
}
update_option('wpp_settings', $settings);
case version_compare($old_version, '2.1.3', '<'):
/*
* Set default pagination type 'slider'
* to prevent issues on already existing sites.
*/
$settings = get_option('wpp_settings');
$settings['configuration']['property_overview']['pagination_type'] = 'slider';
update_option('wpp_settings', $settings);
}
/* Additional stuff can be handled here */
do_action(ud_get_wp_property()->slug . '::upgrade', $old_version, $new_version);
}
示例6: meta
/**
* Get meta value
*
* @param int $post_id
* @param bool $saved
* @param array $field
*
* @return mixed
*/
static function meta($post_id, $saved, $field)
{
$meta = array('value' => false, 'options' => array());
if (empty($field['id']) || ud_get_wp_property('configuration.address_attribute') !== $field['id']) {
return array();
}
/**
* Maybe set value from parent
*/
$post = get_post($post_id);
if ($post && $post->post_parent > 0) {
$property_inheritance = ud_get_wp_property('property_inheritance', array());
$type = get_post_meta($post_id, 'property_type', true);
if (!isset($property_inheritance[$type]) || !in_array($field['id'], $property_inheritance[$type])) {
return array();
}
$meta['value'] = get_post_meta($post->post_parent, $field['id'], true);
$attributes = array_keys(ud_get_wp_property('property_stats', array()));
foreach (self::$map as $k) {
// Ignore meta if property attribute with the same name exists
if (in_array($k, $attributes)) {
continue;
}
$meta['options'][$k] = get_post_meta($post->post_parent, $k, true);
}
}
return $meta;
}
示例7: __construct
/**
* init
*/
public function __construct()
{
$taxonomies = array();
$_taxonomies = ud_get_wp_property('taxonomies', array());
if (!empty($_taxonomies) && is_array($_taxonomies)) {
foreach ($_taxonomies as $k => $v) {
$taxonomies[$k] = !empty($v['label']) ? $v['label'] : $k;
}
}
$options = array('id' => 'property_terms', 'params' => array('property_id' => array('name' => sprintf(__('%s ID', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('If not empty, result will show particular %s, which ID is set.', ud_get_wp_property('domain')), \WPP_F::property_label()), 'type' => 'text', 'default' => ''), 'taxonomy' => array('name' => __('Taxonomy', ud_get_wp_property()->domain), 'description' => sprintf(__('Renders %s terms of particular taxonomy', ud_get_wp_property('domain')), \WPP_F::property_label()), 'type' => 'select', 'options' => $taxonomies)), 'description' => sprintf(__('Renders %s Terms for specific taxonomy', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
parent::__construct($options);
}
示例8: __construct
/**
* Init
*/
public function __construct()
{
$attributes = ud_get_wp_property('property_stats', array());
/*
$hidden_attributes = ud_get_wp_property( 'hidden_frontend_attributes', array() );
foreach( $attributes as $k => $v ) {
if( in_array( $k, $hidden_attributes ) ) {
unset( $attributes[$k] );
}
}
//*/
$options = array('id' => 'property_attributes', 'params' => array('sort_by_groups' => array('name' => __('Sort by groups', ud_get_wp_property()->domain), 'description' => __('Sort attributes by groups or not', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain))), 'display' => array('name' => __('Display', ud_get_wp_property()->domain), 'description' => __('The way of displaying attributes', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('list' => __('Simple List', ud_get_wp_property()->domain), 'dl_list' => __('Definitions List', ud_get_wp_property()->domain), 'plain_list' => __('Plain List', ud_get_wp_property()->domain), 'detail' => __('Detailed List', ud_get_wp_property()->domain))), 'show_true_as_image' => array('name' => __('Show "True" as image', ud_get_wp_property()->domain), 'description' => __('Display boolean attributes like checkbox image.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('false' => __('No', ud_get_wp_property()->domain), 'true' => __('Yes', ud_get_wp_property()->domain))), 'make_link' => array('name' => __('Make link', ud_get_wp_property()->domain), 'description' => __('Make URLs into clickable links', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain))), 'hide_false' => array('name' => __('Hide false', ud_get_wp_property()->domain), 'description' => __('Hide attributes with false value', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('false' => __('No', ud_get_wp_property()->domain), 'true' => __('Yes', ud_get_wp_property()->domain))), 'return_blank' => array('name' => __('Return Blank', ud_get_wp_property()->domain), 'description' => __('Omit blank values or not.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('false' => __('No', ud_get_wp_property()->domain), 'true' => __('Yes', ud_get_wp_property()->domain))), 'include' => array('name' => __('Include', ud_get_wp_property()->domain), 'description' => __('The list of attributes to be included. If no attribute checked, all available attributes will be shown.', ud_get_wp_property()->domain), 'type' => 'multi_checkbox', 'options' => $attributes), 'exclude' => array('name' => __('Exclude', ud_get_wp_property()->domain), 'description' => __('The list of attributes which will not be shown.', ud_get_wp_property()->domain), 'type' => 'multi_checkbox', 'options' => $attributes)), 'description' => sprintf(__('Renders %s Attributes List', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
parent::__construct($options);
}
示例9: get_template
/**
* Determines template and renders it
*
*
*/
public function get_template($template, $data, $output = true)
{
$name = apply_filters($this->id . '_template_name', array($template), $this);
/* Set possible pathes where templates could be stored. */
$path = apply_filters($this->id . '_template_path', array(ud_get_wp_property()->path('static/views', 'dir')));
$path = \UsabilityDynamics\Utility::get_template_part($name, $path, array('load' => false));
if ($output) {
extract($data);
include $path;
} else {
ob_start();
extract($data);
include $path;
return ob_get_clean();
}
}
示例10: call
/**
* @param string $atts
* @return string|void
*/
public function call($atts = "")
{
$atts = shortcode_atts(array('property_id' => '', 'include' => ''), $atts);
$meta = array();
if (!empty($atts['include'])) {
$include = explode(',', $atts['include']);
foreach ($include as $k) {
$k = trim($k);
$v = ud_get_wp_property("property_meta.{$k}");
if (!empty($v)) {
$meta[$k] = $v;
}
}
} else {
$meta = ud_get_wp_property('property_meta');
}
if (!empty($atts['property_id']) && is_numeric($atts['property_id'])) {
$post_id = $atts['property_id'];
} else {
global $post;
$post_id = $post->ID;
}
return $this->get_template('property-meta', array('meta' => $meta, 'post_id' => $post_id), false);
}
示例11: sprintf
}
?>
</ul>
</div><?php
// .wpp_right_column
?>
</div><?php
// .property_div
?>
<?php
}
/** end of the propertyloop. */
?>
</div><?php
// .all-properties
?>
</div><?php
// .wpp_row_view
} else {
?>
<div class="wpp_nothing_found">
<p><?php
echo sprintf(__('Sorry, no properties found - try expanding your search, or <a href="%s">view all</a>.', ud_get_wp_property()->domain), site_url() . '/' . $wp_properties['configuration']['base_slug']);
?>
</p>
</div>
<?php
}
示例12: do_action
?>
</label>
</li>
<?php
}
?>
<?php
do_action('wpp::types::inherited_attributes', $property_slug);
?>
</ul>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<td colspan='5'>
<input type="button" class="wpp_add_row button-secondary" value="<?php
_e('Add Row', ud_get_wp_property()->domain);
?>
"/>
</td>
</tr>
</tfoot>
</table>
示例13: process_bulk_action
/**
* Handle Bulk Action's request
*
*/
public function process_bulk_action()
{
try {
switch ($this->current_action()) {
case 'untrash':
if (empty($_REQUEST['post_ids']) || !is_array($_REQUEST['post_ids'])) {
throw new \Exception(sprintf(__('Invalid request: no %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
}
$post_ids = $_REQUEST['post_ids'];
foreach ($post_ids as $post_id) {
$post_id = (int) $post_id;
wp_untrash_post($post_id);
}
$this->message = sprintf(__('Selected %s have been successfully restored from Trash.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
break;
case 'delete':
if (empty($_REQUEST['post_ids']) || !is_array($_REQUEST['post_ids'])) {
throw new \Exception(sprintf(__('Invalid request: no %s IDs provided.', ud_get_wp_property('domain')), \WPP_F::property_label()));
}
$post_ids = $_REQUEST['post_ids'];
$trashed = 0;
$deleted = 0;
foreach ($post_ids as $post_id) {
$post_id = (int) $post_id;
if (get_post_status($post_id) == 'trash') {
$deleted++;
wp_delete_post($post_id);
} else {
$trashed++;
wp_trash_post($post_id);
}
}
if ($trashed > 0 && $deleted > 0) {
$this->message = sprintf(__('Selected %s have been successfully moved to Trash or deleted.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
} elseif ($trashed > 0) {
$this->message = sprintf(__('Selected %s have been successfully moved to Trash.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
} elseif ($deleted > 0) {
$this->message = sprintf(__('Selected %s have been successfully deleted.', ud_get_wp_property('domain')), \WPP_F::property_label('plural'));
} else {
throw new \Exception(sprintf(__('No one %s was deleted.', ud_get_wp_property('domain')), \WPP_F::property_label()));
}
break;
default:
//** Any custom action can be processed using action hook */
do_action('wpp::all_properties::process_bulk_action', $this->current_action());
break;
}
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
}
示例14: maybe_export_properties_to_scv
/**
* Exports all properties to CSV file
*/
public function maybe_export_properties_to_scv()
{
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpp_export_to_scv' && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'export_properties_to_scv')) {
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=properties.csv');
$headings = array('ID' => __('ID', ud_get_wp_property('domain')), 'post_title' => __('Title', ud_get_wp_property('domain')), 'post_content' => __('Content', ud_get_wp_property('domain')), 'post_date' => __('Date', ud_get_wp_property('domain')), 'post_modified' => __('Modified Date', ud_get_wp_property('domain')), 'post_parent' => __('Falls Under', ud_get_wp_property('domain')), 'menu_order' => __('Menu Order', ud_get_wp_property('domain')), 'post_author' => __('Author', ud_get_wp_property('domain')), 'property_type_label' => __('Property Type', ud_get_wp_property('domain')));
$headings = array_merge($headings, (array) ud_get_wp_property('property_stats', array()));
$headings = array_merge($headings, (array) ud_get_wp_property('property_meta', array()));
foreach ((array) ud_get_wp_property('geo_type_attributes', array()) as $k) {
$headings[$k] = \WPP_F::de_slug($k);
}
$headings['latitude'] = __('Latitude', ud_get_wp_property('domain'));
$headings['longitude'] = __('Longitude', ud_get_wp_property('domain'));
$headings['permalink'] = __('Permalink', ud_get_wp_property('domain'));
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array_values($headings));
$ids = \WPP_F::get_properties();
$keys = array_keys($headings);
foreach ($ids as $id) {
$property = Property_Factory::get($id, array('get_children' => 'false', 'load_gallery' => 'false', 'load_thumbnail' => 'true', 'load_parent' => 'false'));
$data = array();
foreach ($keys as $k) {
$v = isset($property[$k]) ? $property[$k] : '';
if (is_array($v)) {
$v = implode(',', $v);
}
switch ($k) {
case 'post_content':
$v = strip_shortcodes($v);
$v = apply_filters('the_content', $v);
$v = str_replace(']]>', ']]>', $v);
$v = wp_trim_words($v, 55, '...');
break;
case 'author':
$v = get_the_author_meta('display_name', $v);
break;
}
$data[$k] = $v;
}
fputcsv($output, $data);
}
exit;
}
}
示例15: add_meta_boxes
/**
* Add Meta Boxes to All Properties page.
*/
public function add_meta_boxes()
{
$screen = get_current_screen();
add_meta_box('posts_list', __('Overview', ud_get_wp_property('domain')), array($this, 'render_list_table'), $screen->id, 'normal');
add_meta_box('posts_filter', sprintf(__('%s Search', ud_get_wp_property('domain')), \WPP_F::property_label('plural')), array($this, 'render_filter'), $screen->id, 'side');
}