コード例 #1
0
 public function testSetProperty()
 {
     $category = new AcCategory();
     $privatePropertyName = 'privateProperty';
     set_property($category, $privatePropertyName, 'updated private property');
     $this->assertNotEquals('private property', get_property($category, $privatePropertyName));
     $this->assertEquals('updated private property', get_property($category, $privatePropertyName));
 }
コード例 #2
0
 /**
  * @param string $atts
  * @return string|void
  */
 public function call($atts = "")
 {
     $data = shortcode_atts(array('width' => '100%', 'height' => '450px', 'zoom_level' => '13', 'hide_infobox' => 'false', 'property_id' => ''), $atts);
     if (!empty($data['property_id']) && is_numeric($data['property_id'])) {
         $data['property'] = get_property($data['property_id'], array('get_children' => 'false', 'return_object' => 'false', 'load_gallery' => 'false', 'load_thumbnail' => 'false', 'load_parent' => 'false'));
     } else {
         global $post, $property;
         $data['property'] = isset($property) ? (array) $property : (array) $post;
     }
     wp_enqueue_script('google-maps');
     return $this->get_template('property-map', $data, false);
 }
コード例 #3
0
 function compact_property($instance, $properties)
 {
     $properties = array_slice(func_get_args(), 1);
     $compactArray = [];
     foreach ($properties as $property) {
         if (property_exists($instance, $property)) {
             ${$property} = get_property($instance, $property);
             $compactArray = array_merge($compactArray, compact($property));
         }
     }
     return $compactArray;
 }
コード例 #4
0
 /**
  * Remove all of the Authority-Controller event listeners of the specified controller.
  * If $controllerName == '*', it removes all the Authority-Controller events
  * of every Controllers of the application.
  *
  *   \App\Http\Controllers\Controller::flushAuthorityEvents('*'); // Remove all Authority-Controller events of every Controllers
  *   \App\Http\Controllers\ProjectsController::flushAuthorityEvents(); // Remove all Authority-Controller events of ProjectsController
  *
  * @param string Controller name. If null it get the current Controller name.
  * @return void
  */
 public static function flushAuthorityEvents($controllerName = null)
 {
     $controllerName = $controllerName ?: get_called_class();
     $events = app('events');
     $listeners = (array) get_property($events, 'listeners');
     foreach ($listeners as $eventName => $listener) {
         $remove = false;
         // flag
         if ($controllerName === "*") {
             // All Controllers
             if (starts_with($eventName, "router.filter: controller.")) {
                 $remove = true;
             }
         } elseif (preg_match("/^router\\.filter: controller\\.[^.]+?\\.{$controllerName}/", $eventName)) {
             $remove = true;
         }
         if ($remove) {
             $events->forget($eventName);
         }
     }
 }
コード例 #5
0
ファイル: Postgresql.php プロジェクト: ekowabaka/cfx
 protected function localGet($params = null, $mode = model::MODE_ASSOC, $explicit_relations = false, $resolve = true)
 {
     $fields = isset($params["fields"]) ? $params["fields"] : null;
     if (isset($params['conditions'])) {
         throw new Exception("Use of conditions in queries deprecated");
     }
     $conditions = isset($params['filter']) ? $params['filter'] : null;
     if ($this->fixedConditions != "") {
         $conditions = "(" . ($conditions == "" ? "" : $conditions . ") AND (") . $this->fixedConditions . ")";
     }
     $bindData = $params['bind'];
     $rows = array();
     $sorting = null;
     if ($resolve) {
         $references = $this->referencedFields;
         //getReferencedFields();
     } else {
         $references = array();
     }
     $joins = "";
     //$do_join = count($references)>0?true:false;
     $fieldList = $this->getExpandedFieldList($fields, $references, $resolve);
     $field_list = $fieldList["fields"];
     $expanded_fields = $fieldList["expandedFields"];
     $do_join = $fieldList["doJoin"];
     $sortFields = isset($params["sort_field"]) ? $params["sort_field"] : null;
     if (is_array($sortFields)) {
         if (count($sortFields) > 0) {
             $orderClauses = array();
             foreach ($sortFields as $sortField) {
                 $orderClauses[] = "{$sortField["field"]} {$sortField["type"]}";
             }
             $sorting = " ORDER BY " . implode(", ", $orderClauses);
         }
     } else {
         if ($sortFields != "") {
             $sorting = " ORDER BY {$sortFields} {$params["sort_type"]}";
         }
     }
     $joined_tables = array();
     foreach ($references as $reference) {
         if (array_search($reference["table"], $joined_tables) === false) {
             $joins .= " LEFT JOIN {$reference["table"]} ON {$this->database}.{$reference["referencing_field"]} = {$reference["table"]}.{$reference["referenced_field"]} ";
             $joined_tables[] = $reference["table"];
         }
     }
     if ($this->database != "") {
         $from = " FROM {$this->database} ";
     }
     if (get_property($params, "enumerate") === true) {
         $query = sprintf("SELECT " . ($params["distinct"] === true ? "DISTINCT" : "") . " COUNT(*) as \"count\" {$from} ") . ($do_join ? $joins : "") . ($conditions != null ? " WHERE " . $conditions : "") . $sorting;
     } else {
         $query = sprintf("SELECT " . (get_property($params, "distinct") === true ? "DISTINCT" : "") . " {$field_list} {$from} ") . ($do_join ? $joins : "") . ($conditions != null ? " WHERE " . $conditions : "") . $sorting;
     }
     if (isset($params["limit"])) {
         $query .= " LIMIT ?";
         $bindData[] = $params['limit'];
     }
     if (isset($params["offset"])) {
         $query .= " OFFSET ?";
         $bindData[] = $params['offset'];
     }
     $rows = $this->query($query, $mode, $bindData, $params['cache_key']);
     if (isset($params['cache_key'])) {
         Cache::add($params['cache_key'], $query);
     }
     // Retrieve all explicitly related data
     if ($explicit_relations) {
         foreach ($this->explicitRelations as $explicitRelation) {
             foreach ($rows as $i => $row) {
                 $model = Model::load((string) $explicitRelation);
                 $data = $model->get(array("filter" => $model->getDatabase() . "." . $this->getKeyField() . "= ?", "bind" => [$row[$this->getKeyField()]]), SQLDatabaseModel::MODE_ASSOC, false, false);
                 $rows[$i][(string) $explicitRelation] = $data;
             }
         }
     }
     return $rows;
 }
コード例 #6
0
 protected function fetchParent($name)
 {
     $name = camel_case($name);
     if (property_exists($this->controller, $name)) {
         return get_property($this->controller, $name);
     } elseif (respond_to($this->controller, "get" . studly_case($name))) {
         $name = "get" . studly_case($name);
         return $this->controller->{$name}();
     } elseif (respond_to($this->controller, $name)) {
         return $this->controller->{$name}();
     }
 }
コード例 #7
0
ファイル: Postgresql.php プロジェクト: rocksyne/wyf
 public function get($params = null, $mode = model::MODE_ASSOC, $explicit_relations = false, $resolve = true)
 {
     $fields = isset($params["fields"]) ? $params["fields"] : null;
     $conditions = isset($params["conditions"]) ? $params["conditions"] : null;
     $rows = array();
     $joined = null;
     $sorting = null;
     if ($resolve) {
         $references = $this->referencedFields;
         //getReferencedFields();
     } else {
         $references = array();
     }
     $joins = "";
     //$do_join = count($references)>0?true:false;
     $fieldList = $this->getExpandedFieldList($fields, $references, $resolve);
     $field_list = $fieldList["fields"];
     $expanded_fields = $fieldList["expandedFields"];
     $do_join = $fieldList["doJoin"];
     $sortFields = isset($params["sort_field"]) ? $params["sort_field"] : null;
     if (is_array($sortFields)) {
         if (count($sortFields) > 0) {
             $orderClauses = array();
             foreach ($sortFields as $sortField) {
                 $orderClauses[] = "{$sortField["field"]} {$sortField["type"]}";
             }
             $sorting = " ORDER BY " . implode(", ", $orderClauses);
         }
     } else {
         if ($sortFields != "") {
             $sorting = " ORDER BY {$sortFields} {$params["sort_type"]}";
         }
     }
     $joined_tables = array();
     foreach ($references as $reference) {
         if (array_search($reference["table"], $joined_tables) === false) {
             $joins .= " LEFT JOIN {$reference["table"]} ON {$this->database}.{$reference["referencing_field"]} = {$reference["table"]}.{$reference["referenced_field"]} ";
             $joined_tables[] = $reference["table"];
         }
     }
     if ($this->database != "") {
         $from = " FROM {$this->database} ";
     }
     if (get_property($params, "enumerate") === true) {
         $query = sprintf("SELECT " . ($params["distinct"] === true ? "DISTINCT" : "") . " COUNT(*) as \"count\" {$from} ") . ($do_join ? $joins : "") . ($conditions != null ? " WHERE " . $conditions : "") . $sorting;
     } else {
         $query = sprintf("SELECT " . (get_property($params, "distinct") === true ? "DISTINCT" : "") . " {$field_list} {$from} ") . ($do_join ? $joins : "") . ($conditions != null ? " WHERE " . $conditions : "") . $sorting;
     }
     if (isset($params["limit"])) {
         $query .= " LIMIT {$params["limit"]}";
     }
     if (isset($params["offset"])) {
         $query .= " OFFSET {$params["offset"]}";
     }
     $rows = $this->query($query, $mode);
     // Retrieve all explicitly related data
     if ($explicit_relations) {
         foreach ($this->explicitRelations as $explicitRelation) {
             foreach ($rows as $i => $row) {
                 $model = Model::load((string) $explicitRelation);
                 $data = $model->get(array("conditions" => $model->getDatabase() . "." . $this->getKeyField() . "='" . $row[$this->getKeyField()] . "'"), SQLDatabaseModel::MODE_ASSOC, false, false);
                 $rows[$i][(string) $explicitRelation] = $data;
             }
         }
     }
     return $rows;
 }
コード例 #8
0
ファイル: property.php プロジェクト: BackupTheBerlios/quh
function get_property_int($filename, $propname)
{
    return get_property($filename, $propname, 0);
}
コード例 #9
0
 public function getProperty($object, $propertyName)
 {
     return get_property($object, $propertyName);
 }
コード例 #10
0
 /**
  * Quick and bulk edit saving
  *
  * @access public
  * @param int $post_id
  * @param WP_Post $post
  * @return int
  */
 public function bulk_and_quick_edit_save_post($post_id, $post)
 {
     // If this is an autosave, our form has not been submitted, so we don't want to do anything.
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     // Don't save revisions and autosaves
     if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) {
         return $post_id;
     }
     // Check post type is product
     if ('property' != $post->post_type) {
         return $post_id;
     }
     // Check user permission
     if (!current_user_can('edit_post', $post_id)) {
         return $post_id;
     }
     // Check nonces
     if (!isset($_REQUEST['propertyhive_quick_edit_nonce']) && !isset($_REQUEST['propertyhive_bulk_edit_nonce'])) {
         return $post_id;
     }
     if (isset($_REQUEST['propertyhive_quick_edit_nonce']) && !wp_verify_nonce($_REQUEST['propertyhive_quick_edit_nonce'], 'propertyhive_quick_edit_nonce')) {
         return $post_id;
     }
     if (isset($_REQUEST['propertyhive_bulk_edit_nonce']) && !wp_verify_nonce($_REQUEST['propertyhive_bulk_edit_nonce'], 'propertyhive_bulk_edit_nonce')) {
         return $post_id;
     }
     // Get the product and save
     $property = get_property($post);
     if (!empty($_REQUEST['propertyhive_quick_edit'])) {
         $this->quick_edit_save($post_id, $property);
     } else {
         $this->bulk_edit_save($post_id, $property);
     }
     // Clear transient
     //ph_delete_property_transients( $post_id );
     return $post_id;
 }
コード例 #11
0
 /**
  * Register all meta boxes here.
  *
  */
 public function register_meta_boxes($meta_boxes)
 {
     $_meta_boxes = array();
     /* May be determine property_type to know which attributes should be hidden and which ones just readable. */
     $post = new \WP_Post(new \stdClass());
     $post_id = isset($_REQUEST['post']) && is_numeric($_REQUEST['post']) ? $_REQUEST['post'] : false;
     if (!$post_id && !empty($_REQUEST['post_ID']) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'editpost') {
         $post_id = $_REQUEST['post_ID'];
     }
     if ($post_id) {
         $p = get_property($post_id, array('get_children' => 'true', 'return_object' => 'true', 'load_gallery' => 'false', 'load_thumbnail' => 'false', 'load_parent' => 'true', 'cache' => 'false'));
         if (!empty($p)) {
             $post = $p;
         }
     }
     /* Register 'General Information' metabox for Edit Property page */
     $meta_box = $this->get_property_meta_box(array('name' => __('General', ud_get_wp_property()->domain)), $post);
     $groups = ud_get_wp_property('property_groups', array());
     $property_stats_groups = ud_get_wp_property('property_stats_groups', array());
     if ($meta_box) {
         $_meta_boxes[] = $meta_box;
     }
     /* Register Meta Box for every Attributes Group separately */
     if (!empty($groups) && !empty($property_stats_groups)) {
         foreach ($groups as $slug => $group) {
             $meta_box = $this->get_property_meta_box(array_filter(array_merge($group, array('id' => $slug))), $post);
             if ($meta_box) {
                 $_meta_boxes[] = $meta_box;
             }
         }
     }
     /**
      * Allow to customize our meta boxes via external add-ons ( modules, or whatever else ).
      */
     $_meta_boxes = apply_filters('wpp::meta_boxes', $_meta_boxes);
     if (!is_array($_meta_boxes)) {
         return $meta_boxes;
     }
     /** Get rid of meta box without fields data. */
     foreach ($_meta_boxes as $k => $meta_box) {
         if (empty($meta_box['fields'])) {
             unset($_meta_boxes[$k]);
         }
     }
     /**
      *  Probably convert Meta Boxes to single one with tabs
      */
     $_meta_boxes = $this->maybe_convert_to_tabs($_meta_boxes);
     if (is_array($meta_boxes)) {
         $meta_boxes = $meta_boxes + $_meta_boxes;
     }
     return $meta_boxes;
 }
コード例 #12
0
/**
 * Adds extra post classes for properties
 *
 * @since 1.0.0
 * @param array $classes
 * @param string|array $class
 * @param int $post_id
 * @return array
 */
function ph_property_post_class($classes, $class = '', $post_id = '')
{
    if (!$post_id || get_post_type($post_id) !== 'property') {
        return $classes;
    }
    $property = get_property($post_id);
    if ($property) {
        if ($property->is_featured()) {
            $classes[] = 'featured';
        }
    }
    if (($key = array_search('hentry', $classes)) !== false) {
        unset($classes[$key]);
    }
    return $classes;
}
コード例 #13
0
ファイル: common_function.php プロジェクト: listar/php_common
 function array_sort($arr, $keys, $type = 'desc', $limit = 0, $returnKey = null)
 {
     $keysvalue = $new_array = array();
     foreach ($arr as $k => $v) {
         $keysvalue[$k] = get_property($v, $keys);
     }
     if ($type == 'asc') {
         asort($keysvalue);
     } else {
         arsort($keysvalue);
     }
     reset($keysvalue);
     $i = 0;
     foreach ($keysvalue as $k => $v) {
         if ($returnKey == null) {
             $new_array[] = $arr[$k];
         } else {
             $new_array[] = get_property($arr[$k], $returnKey);
         }
         if ($limit > 0) {
             if (++$i >= $limit) {
                 break;
             }
         }
     }
     return $new_array;
 }
コード例 #14
0
        /**
         * Get field HTML
         *
         * @param mixed $meta
         * @param array $field
         *
         * @return string
         */
        static function html($meta, $field)
        {
            global $post, $wp_properties;
            $property = get_property($post->ID, array('get_children' => 'false', 'return_object' => 'true', 'load_gallery' => 'false', 'load_thumbnail' => 'false', 'load_parent' => 'false'));
            $html = '<div class="rwmb-map-field">';
            $html .= sprintf('<button class="button rwmb-map-goto-address-button" value="%s">%s</button>', $field['field_name'], __('Show Address on Map', 'meta-box'));
            $html .= sprintf('<div class="rwmb-map-canvas" data-default-loc="%s"></div>
				<input type="hidden" name="wpp_data[meta][location_map_coordinates]" class="rwmb-map-coordinate" value="%s">', esc_attr(implode(',', $wp_properties['default_coords'])), esc_attr(!empty($property->latitude) ? $property->latitude . ',' . $property->longitude : implode(',', $wp_properties['default_coords'])));
            $html .= '</div>';
            ob_start();
            ?>
      <div class="wpp_attribute_row_address">
        <?php 
            printf('<input type="text" data-field-type="wpp-address" class="rwmb-text" name="wpp_data[meta][%s]" id="%s" value="%s" placeholder="%s" size="%s" %s>', $field['field_name'], $field['id'], $meta, $field['placeholder'], $field['size'], $field['datalist'] ? "list='{$field['datalist']['id']}'" : '');
            echo $field['desc'] ? "<p id='{$field['id']}_description' class='description'>{$field['desc']}</p>" : '';
            ?>
        <?php 
            if (!empty($property) && current_user_can('manage_wpp_settings')) {
                ?>
          <div class="wpp_attribute_row_address_options">
            <input type="hidden" name="wpp_data[meta][manual_coordinates]" value="false"/>
            <input type="checkbox" id="wpp_manual_coordinates" name="wpp_data[meta][manual_coordinates]" value="true" <?php 
                echo isset($property->manual_coordinates) && in_array($property->manual_coordinates, array('true', '1')) ? 'checked="checked"' : '';
                ?>
 />
            <label for="wpp_manual_coordinates"><?php 
                _e('Set Coordinates Manually.', ud_get_wp_property()->domain);
                ?>
</label>
            <div id="wpp_coordinates" style="<?php 
                echo !empty($property->manual_coordinates) && in_array($property->manual_coordinates, array('true', '1')) ? '' : 'display:none;';
                ?>
">
              <ul>
                <li>
                  <input type="text" id="wpp_meta_latitude" name="wpp_data[meta][latitude]" value="<?php 
                echo isset($property->latitude) ? $property->latitude : '';
                ?>
"/>
                  <label><?php 
                _e('Latitude', ud_get_wp_property()->domain);
                ?>
</label>
                  <div class="wpp_clear"></div>
                </li>
                <li>
                  <input type="text" id="wpp_meta_longitude" name="wpp_data[meta][longitude]" value="<?php 
                echo isset($property->longitude) ? $property->longitude : '';
                ?>
"/>
                  <label><?php 
                _e('Longitude', ud_get_wp_property()->domain);
                ?>
</label>
                  <div class="wpp_clear"></div>
                </li>
              </ul>
            </div>
          </div>
        <?php 
            }
            ?>
      </div>
      <?php 
            return ob_get_clean() . $html;
        }
コード例 #15
0
                    }
                }
        }
    }
}
include_once '../../db_connect.php';
//подключаемся к базе
$dbh = mysql_connect(host, user, pswd) or die("Не могу соединиться с MySQL.");
mysql_select_db(SCAD) or die("Не могу подключиться к базе.");
$res = mysql_query("SET NAMES utf8");
//формируем список имен свойств
get_prop_list(member_group, $prop_list);
get_prop_list(member_group_for_steel, $prop_list);
//чтение свойств
get_property(member_group, $_POST['mas_group'], $prop_list);
get_property(member_group_for_steel, $_POST['mas_group_for_steel'], $prop_list);
//удаляем ненужные элементы
foreach ($prop_list as $key => $value) {
    if ($value == NULL) {
        unset($prop_list[$key]);
    }
}
//загружаем переводы в массив
$translator = array();
$sql = "SELECT * FROM " . translate_group;
mysql_query($sql);
switch (mysql_errno()) {
    case 1146:
        echo "<b>Table " . translate_group . " doesn't exist. Please create DB.</b><br>";
        break;
    default:
コード例 #16
0
 * @version 1.4
 * @author Andy Potanin <*****@*****.**>
 * @package WP-Property
*/
if ($properties) {
    ?>
<ul class="<?php 
    wpp_css('property_overview_plain_list::row_view', "wpp_row_view");
    ?>
">
    <?php 
    foreach ($properties as $property_id) {
        ?>

    <?php 
        $property = prepare_property_for_display(get_property($property_id, $show_children ? "get_property['children']={$show_property['children']}" : ""));
        ?>

    <li class="<?php 
        wpp_css('property_overview_plain_list::property_div', "property_div");
        ?>
">
      <a href="<?php 
        echo $property['permalink'];
        ?>
"><?php 
        echo $property['post_title'];
        ?>
</a>
      <?php 
        if ($show_children && $property['children']) {