public function render_editor($node) { $page = dynamic_cast($node, 'Page'); $data = array(); if (_POST('action') == 'save') { $this->def_save_node($data, $page); } $this->fill_def_form_data($data, $page); $avail_types = array('text' => Loc::get('page/type/text'), 'transfer' => Loc::get('page/type/transfer'), 'redirect' => Loc::get('page/type/redirect')); $data['rows'][] = array('id' => 'page_type', 'label' => Loc::get('page/label/page-type'), 'type' => 'dropdown', 'value' => $page->page_type, 'options' => $avail_types); $data['auto_submit'] = array('page_type'); switch ($page->page_type) { case 'transfer': $data['rows'][] = array('id' => 'transfer_path', 'label' => Loc::get('page/label/transfer-path'), 'type' => 'text', 'value' => $page->transfer_path); break; case 'redirect': $data['rows'][] = array('id' => 'redirect_url', 'label' => 'URL', 'type' => 'text', 'value' => $page->redirect_url); break; default: $data['rows'][] = array('id' => 'use_html_editor', 'label' => Loc::get('page/label/use-html-editor'), 'type' => 'checkbox', 'value' => $page->use_html_editor); $data['rows'][] = array('id' => 'content', 'label' => Loc::get('page/label/content'), 'type' => $page->use_html_editor ? 'editor' : 'textarea', 'value' => $page->content); $data['auto_submit'][] = 'use_html_editor'; break; } return $this->render_form($data); }
public function render_editor($node) { $node = dynamic_cast($node, 'CustomList'); $data = array(); if (_POST('action') == 'save') { $this->def_save_node($data, $node); } $this->fill_def_form_data($data, $node); return $this->render_form($data); }
public function render_editor($node) { $node = dynamic_cast($node, 'Settings'); $data = array(); if (_POST('action') == 'save') { $this->def_save_node($data, $node, BaseAdminModule::UPDATE_TYPE_NONE); } $this->fill_def_form_data($data, $node, null, BaseAdminModule::PATH_TYPE_HIDDEN_ALL); return $this->render_form($data); }
public function render_editor($node) { $node = dynamic_cast($node, 'CustomListItem'); $avail_fields = $node->parent_node->get_avail_fields(); $data = array(); if (_POST('action') == 'save') { foreach ($avail_fields as $name => $label) { $node->set_attr("f_{$name}", _POST("f_{$name}")); } $this->def_save_node($data, $node); } $this->fill_def_form_data($data, $node, null, BaseAdminModule::PATH_TYPE_NAME); foreach ($avail_fields as $name => $label) { $data['rows'][] = array('id' => "f_{$name}", 'label' => $label, 'type' => 'textarea', 'rows' => 4, 'value' => $node->attr("f_{$name}")); } return $this->render_form($data); }
public function render_editor($node) { $node = dynamic_cast($node, 'User'); $data = array(); if (_POST('action') == 'save') { // TODO: сделать астоматическую чекалку на основе полей 'validate' в $data['rows'] if (strlen(_POST('_img_data')) && strlen(_POST('_chb_data')) && _POST('_img_data') != _POST('_chb_data')) { $data['errors']['_chb_data'] = Loc::get('user/should-be-same-as-password'); } if ((!isset($data['errors']) || !count($data['errors'])) && strlen(_POST('_img_data'))) { $node->pwd_hash = User::password_to_hash(_POST('_img_data')); $data['extra']['update_tree'] = true; } $this->def_save_node($data, $node); } $this->fill_def_form_data($data, $node, Loc::get('user/label/login'), BaseAdminModule::PATH_TYPE_NAME); if (!strlen($node->pwd_hash)) { $data['rows'][] = array('type' => 'html', 'value' => '<span class="err-row">' . Loc::get('user/empty-password') . '</span>'); } $data['rows'][] = array('id' => '_img_data', 'label' => Loc::get('user/label/password'), 'type' => 'password'); $data['rows'][] = array('id' => '_chb_data', 'label' => Loc::get('user/label/confirm-password'), 'type' => 'password', 'validate' => array(array('SValidators.compare', '_img_data'))); return $this->render_form($data); }
* @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ /** * PBO: SKU after other meta(s) and only if exists */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly } global $post, $product; $cat_count = sizeof(get_the_terms($post->ID, 'product_cat')); $tag_count = sizeof(get_the_terms($post->ID, 'product_tag')); if (class_exists('WC_Product_Ex')) { $product_ex = dynamic_cast('WC_Product_Ex', $product); //$product_ex = new WC_Product_Ex($product); } else { $product_ex = $product; } ?> <div class="product_meta"> <?php do_action('woocommerce_product_meta_start'); ?> <?php echo $product_ex->get_categories(', ', '<span class="posted_in">' . _n('Category:', 'Categories:', $cat_count, 'woocommerce') . ' ', '</span>', 'menu_order'); ?>
public function render_def_editor($node, $class_name, $path_type = 0, $update_type = 0, $separate_title = false) { $node = dynamic_cast($node, $class_name); $data = array(); if (_POST('action') == 'save') { $this->def_save_node($data, $node, $update_type); } $this->fill_def_form_data($data, $node, null, $path_type, $separate_title); return $this->render_form($data); }
public static function get_by_model_path($model, $path) { $node = self::get_node(constant("{$model}::Root") . '/' . $path); return $node == null ? null : dynamic_cast($node, $model); }