コード例 #1
0
 function rt_generate_woo_products_box($theGroupID, $theTemplateID, $options, $randomClass)
 {
     $boxName = __("WooCommerce Products", "rt_theme_admin");
     $contet_type = "woo_products_box";
     $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID);
     $isNewBox = trim($randomClass) == "" ? false : true;
     $opacity = 1;
     $layout = "one passive_module";
     $position = $isNewBox ? 'open minus' : 'plus';
     $data_position = 'display: none;';
     $item_width = $isNewBox ? '' : $options['item_width'];
     $pagination = isset($options['pagination']) ? $options['pagination'] : "";
     $categories = isset($options['categories']) ? $options['categories'] : "";
     $list_orderby = $isNewBox ? '' : $options['list_orderby'];
     $list_order = $isNewBox ? '' : $options['list_order'];
     $item_per_page = $isNewBox ? '' : $options['item_per_page'];
     echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">';
     echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>';
     echo $this->module_controls($isNewBox);
     echo '</div><div class="ItemData" style="' . $data_position . '">';
     echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">';
     $options = array(array("desc" => __("This module displays WooCommerce products following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Select a WooCommerce Product Category", 'rt_theme_admin'), "desc" => __("You need to select a woocommerce product category from the list below. ", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[categories]", "options" => RTTheme::rt_get_woo_product_categories(), "purpose" => "sidebar", "type" => "select", "class" => $randomClass, "default" => $categories, "value" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the woocommerce products within the product list by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("type" => "td_col"), array("name" => __("Amount of products", 'rt_theme_admin'), "desc" => __("Set the amount of products to be displayed within this module box.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for the listed products.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "type" => "select"), array("type" => "table_end"));
     echo $this->rt_generate_forms($options);
     echo '</div></div></div></li>';
 }
コード例 #2
0
 function rt_generate_wcproduct_carousel($theGroupID, $theTemplateID, $options, $randomClass)
 {
     $boxName = __("WooCommerce Products Carousel", "rt_theme_admin");
     $contet_type = "wcproduct_carousel";
     $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID);
     $isNewBox = trim($randomClass) == "" ? false : true;
     $opacity = 1;
     $layout = "one passive_module";
     $position = $isNewBox ? 'open minus' : 'plus';
     $data_position = 'display: none;';
     $values = isset($options['values']) ? $options['values'] : array();
     $item_width = $max_item = $crop = $list_order = $list_orderby = $categories = $heading_icon = $heading = "";
     extract($values);
     echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">';
     echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>';
     echo $this->module_controls($isNewBox);
     echo '</div><div class="ItemData" style="' . $data_position . '">';
     echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">';
     $options = array(array("desc" => __("This module displays product items as a carousel following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Heading", 'rt_theme_admin'), "desc" => __('Enter a title to be displayed above the product carousel.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][heading]", "value" => $heading, "type" => "text"), array("name" => __("Heading Icon", 'rt_theme_admin'), "desc" => __('Select and set a icon to precede the product carousel title.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][heading_icon]", "class" => "icon_selection", "value" => $heading_icon, "type" => "text"), array("name" => __("Select Product Categories", 'rt_theme_admin'), "desc" => __("Select and set categories to filter (shorten) the amount of product items presented in the carousel. If you don't select and set a category, this module will show all product items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][categories][]", "options" => RTTheme::rt_get_woo_product_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("type" => "td_col"), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the product items within the product carousel by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("name" => __("Carousel Style", 'rt_theme_admin'), "desc" => __('Select and set the carousel style.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][style]", "options" => array("plain_carousel" => "Plain Box", "rounded_carousel" => "With Borders"), "default" => "1", "value" => $item_width, "type" => "select"), array("name" => __("Maximum product", 'rt_theme_admin'), "desc" => __("Set the amount of product items to be displayed within the carousel.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][max_item]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $max_item, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for the carousel.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_wcproduct_carousel[values][item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "type" => "select"), array("type" => "table_end"));
     echo $this->rt_generate_forms($options);
     echo '</div></div></div></li>';
 }
コード例 #3
0
 function rt_generate_woo_products_extended($theGroupID, $theTemplateID, $options, $randomClass)
 {
     $boxName = __("WooCommerce Product Posts (Extended)", "rt_theme_admin");
     $contet_type = "woo_products_extended";
     $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID);
     $isNewBox = trim($randomClass) == "" ? false : true;
     $opacity = 1;
     $layout = "one passive_module";
     $position = $isNewBox ? 'open minus' : 'plus';
     $data_position = 'display: none;';
     $values = isset($options['values']) ? $options['values'] : array();
     $heading = $pagination = $item_width = $list_orderby = $list_orderby = $list_order = $item_per_page = $categories = $display_descriptions = $display_price = $display_titles = $with_borders = $with_effect = $no_top_border = $no_bottom_border = "";
     extract($values);
     echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">';
     echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>';
     echo $this->module_controls($isNewBox);
     echo '</div><div class="ItemData" style="' . $data_position . '">';
     echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">';
     $options = array(array("desc" => __("This module displays product items following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Embedded Heading", 'rt_theme_admin'), "desc" => __('Enter a title to be displayed as embedded to the grid.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][heading]", "value" => $heading, "type" => "text"), array("name" => __("Select Product Categories", 'rt_theme_admin'), "desc" => __("Select and set categories to filter (shorten) the amount of product items presented in the productlist. If you don't select and set a category, this module will list all product items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][categories][]", "options" => RTTheme::rt_get_woo_product_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the product items within the product list by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("name" => __("Amount of product post per page", 'rt_theme_admin'), "desc" => __("Set the amount of product items to display at once per page.<br /><strong>Note</strong> : works in conjunction with the pagination settings.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Pagination", 'rt_theme_admin'), "desc" => __("Enable (if checked) the pagination ability for the product items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][pagination]", "type" => "checkbox2", "class" => $randomClass, "value" => $pagination, "default" => "off", "std" => "false"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for listing the product items. (<strong>Note</strong> : when used in a column module which is f.e. set to a 1/5 column it is better to set the content layout to a 1/1 layout.)', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "type" => "select"), array("type" => "td_col"), array("name" => __("Display as Grid", 'rt_theme_admin'), "desc" => __("Enable (if checked) the list will be displayed in grid style.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][with_borders]", "type" => "checkbox2", "class" => $randomClass, "value" => $with_borders, "std" => "false"), array("name" => __("Enable Sliding Info", 'rt_theme_admin'), "desc" => __("Enable (if checked) the mouse over sliding info for the items.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][with_effect]", "type" => "checkbox2", "class" => $randomClass, "value" => $with_effect, "default" => "off", "std" => "false"), array("name" => __("Remove Top Borders of the Grid", 'rt_theme_admin'), "desc" => __("Enable (if checked) to remove the top borders of the grid will be removed. In some cases you may need this option checked to make your design much beatuiful.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][no_top_border]", "type" => "checkbox2", "class" => $randomClass, "value" => $no_top_border, "std" => "false"), array("name" => __("Remove Bottom Borders of the Grid", 'rt_theme_admin'), "desc" => __("Enable (if checked) to remove the bottom borders of the grid will be removed. In some cases you may need this option checked to make your design much beatuiful.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_extended[values][no_bottom_border]", "type" => "checkbox2", "class" => $randomClass, "value" => $no_bottom_border, "std" => "false"), array("type" => "table_end"));
     echo $this->rt_generate_forms($options);
     echo '</div></div></div></li>';
 }
コード例 #4
0
ファイル: page_layouts.php プロジェクト: nikolaev-k/alwadi
 function generate_template_forms()
 {
     //remove module if woocommerce not installed
     if (!class_exists('Woocommerce')) {
         unset($this->rt_modules["woo_products_box"]);
     }
     //remove module if layerslider not installed
     if (!rt_check_layer_slider()) {
         unset($this->rt_modules["layerslider_box"]);
     }
     //remove module if revslider not installed
     if (!class_exists('RevSlider')) {
         unset($this->rt_modules["revslider_box"]);
     }
     // Pages
     $rt_getpages = RTTheme::rt_get_pages();
     // Categories
     $rt_getcat = RTTheme::rt_get_categories();
     // Product Categories
     $rt_product_getcat = RTTheme::rt_get_product_categories();
     // Woo Product Categories
     if (class_exists('Woocommerce')) {
         $rt_woo_product_getcat = RTTheme::rt_get_woo_product_categories();
     }
     // reset query
     wp_reset_query();
     // get saved tempalates list
     $savedTemplatesList = get_option(RT_THEMESLUG . '_template_names_array');
     // costruct form arrays
     $options = array();
     //template builder info text
     array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('Template Builder is a build-in tool that lets you create custom page templates to use with your pages or posts. You are free to edit the default templates or create as many new templates as you wish. In order to use the templates edit a page or post and select the template name from the list under "RT-THEME TEMPLATE OPTIONS" box and save the page. To learn more, go to <a href="admin.php?page=rt_setup_assistant">Setup Assistant</a> and read "How To Use Template Builder".', 'rt_theme_admin'), "hr" => "true", "type" => "info"));
     if ($savedTemplatesList) {
         foreach ($savedTemplatesList as $TemplateID => $templateData) {
             // get saved templates list
             $savedTemplates = get_option(RT_THEMESLUG . '_template_names_array');
             // get this tempalate data
             $thisTemplate = $this->get_template_data($TemplateID);
             if (is_object($thisTemplate)) {
                 // init the form
                 foreach ($thisTemplate->templates as $template) {
                     //tempalte name
                     $template_name = $templateData["name"];
                     //Start Form
                     array_push($options, array("type" => "form_start", "template_id" => $TemplateID, "form_class" => "template_builder_form", "template_name" => $template_name));
                     //Hidden Value
                     array_push($options, array("type" => "hidden", "id" => "templateBuilder", "value" => "true"));
                     //End Form
                     array_push($options, array("type" => "form_end"));
                 }
             }
         }
     }
     // New Template
     $randomnumber = rand(1000, 1000000);
     $TemplateID = 'templateid_' . $randomnumber;
     $templateName = $TemplateID . '_template_name';
     //Start Form
     array_push($options, array("type" => "form_start", "template_id" => $TemplateID, "form_class" => "template_builder_form", "template_name" => __("New Template #" . $randomnumber, 'rt_theme_admin')));
     //Start header row
     array_push($options, array("id" => "templateid_" . $TemplateID . "_1_grid", "options" => array('group_id' => 1, 'part' => 'full', 'header_purpose' => true, 'footer_purpose' => false, 'newtemplate' => true), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item"));
     //Start grid
     array_push($options, array("id" => "templateid_" . $TemplateID . "_2_grid", "options" => array('group_id' => 2, 'part' => 'full', 'header_purpose' => false, 'footer_purpose' => false), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item"));
     //Start footer row
     array_push($options, array("id" => "templateid_" . $TemplateID . "_3_grid", "options" => array('group_id' => 3, 'part' => 'full', 'header_purpose' => false, 'footer_purpose' => true, 'newtemplate' => true), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item"));
     //End Form
     array_push($options, array("type" => "form_end"));
     //template builder list templates
     array_push($options, array("type" => "list_templates", "templateID" => $TemplateID));
     $this->rt_generate_form_page($options, 'template_builder', $TemplateID);
 }
コード例 #5
0
 function rt_generate_woo_products_box($theGroupID, $theTemplateID, $options, $randomClass)
 {
     $boxName = __("WooCommerce Products", "rt_theme_admin");
     $contet_type = "woo_products_box";
     $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID);
     $options['ajax_scroller'] = isset($options['ajax_scroller']) ? $options['ajax_scroller'] : "";
     $options['pagination'] = isset($options['pagination']) ? $options['pagination'] : "";
     $options['categories'] = isset($options['categories']) ? $options['categories'] : "";
     $isNewBox = trim($randomClass) == "" ? false : true;
     $opacity = 1;
     $layout = $isNewBox ? 'full expanded"' : $options['layout'];
     $position = $isNewBox ? 'open minus' : 'plus';
     $data_position = $isNewBox ? '' : 'display: none;';
     $pagination = $isNewBox ? '' : $options['pagination'];
     $item_width = $isNewBox ? '' : $options['item_width'];
     $categories = $isNewBox ? '' : $options['categories'];
     $list_orderby = $isNewBox ? '' : $options['list_orderby'];
     $list_order = $isNewBox ? '' : $options['list_order'];
     $item_per_page = $isNewBox ? '' : $options['item_per_page'];
     $ajax_scroller = $isNewBox ? '' : $options['ajax_scroller'];
     echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">';
     echo '<div class="box_shadow"><div class="Itemholder"> <div class="Itemheader"><h5>' . $boxName . '</h5>';
     echo '<div class="expand ' . $position . '"></div><div class="move"></div></div> <div class="ItemData" style="' . $data_position . '">';
     echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">';
     $options = array(array("desc" => __("This module displays WooCommerce products according the options below.", 'rt_theme_admin'), "hr" => "true", "type" => "info_text_only"), array("name" => __("Column Width", 'rt_theme_admin'), "desc" => __("Please select a column size for this module.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[layout]", "options" => array("one" => "Full Width", "two" => "1:2 - One Second", "three" => "1:3 - One Third", "four" => "1:4 - One Fourth", "five" => "1:5 - One Fifth", "two-three" => "2:3 - Second Third", "three-four" => "3:4 - Third Fourth", "four-five" => "4:5 - Four Fifth"), "default" => "one", "value" => $layout, "class" => "layout_selector", "hr" => "true", "type" => "select"), array("name" => __("Select a WooCommerce Product Category", 'rt_theme_admin'), "desc" => __("You need to select a category from the list below. ", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[categories]", "options" => RTTheme::rt_get_woo_product_categories(), "purpose" => "sidebar", "type" => "select", "class" => $randomClass, "default" => $categories, "value" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("sort your portfolio by this parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "hr" => true, "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Designates the ascending or descending order of the ORDERBY parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "hr" => true, "type" => "select"), array("name" => __("Amount of products", 'rt_theme_admin'), "desc" => __("How many product do you want to display in this box?", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "hr" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __("Please select a layout for the contents that will be displayed in this column.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_woo_products_box[item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "hr" => "true", "type" => "select"), array("name" => __("delete", 'rt_theme_admin'), "id" => "_delete", "class" => "deleteButton template_box_delete", "purpose" => "page_template", "type" => "button"), array("name" => __("close", 'rt_theme_admin'), "id" => "_close", "class" => "closeButton template_box_close", "purpose" => "page_template", "type" => "button"));
     echo $this->rt_generate_forms($options);
     echo '</div></div></div></li>';
 }
コード例 #6
0
 function __construct()
 {
     // Items
     $rt_items = array("slider_box" => "Slider", "revolution_box" => "Revolution Slider", "blog_box" => "Blog Posts", "contact_info_box" => "Contact Info", "contact_form" => "Contact Form", "google_map" => "Google Map", "all_content_boxes" => "Home Page Content", "portfolio_box" => "Portfolio", "product_box" => "Product", "woo_products_box" => "WooCommerce Products", "sidebar_box" => "Widget Area - Sidebar", "default_content" => "Default Content + Page Title", "banner_box" => "Banner Box", "heading_bar" => "Heading Bar", "code_box" => "Code Box");
     //remove module if woocommerce not installed
     if (!class_exists('Woocommerce')) {
         unset($rt_items["woo_products_box"]);
     }
     // Pages
     $rt_getpages = RTTheme::rt_get_pages();
     // Categories
     $rt_getcat = RTTheme::rt_get_categories();
     // Product Categories
     $rt_product_getcat = RTTheme::rt_get_product_categories();
     // Woo Product Categories
     if (class_exists('Woocommerce')) {
         $rt_woo_product_getcat = RTTheme::rt_get_woo_product_categories();
     }
     // reset query
     wp_reset_query();
     // get saved values
     $savedTemplates = get_option('rt_page_layouts');
     // costruct form arrays
     $options = array();
     //template builder info text
     array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('Template Builder is a built-in tool that lets you create custom page templates to use with your pages or posts. You are free to edit the default templates or create a new one as you wish. In order to use this templates edit a page or post and select the template name from the list under "RT-THEME TEMPLATE OPTIONS" box and save the page.  To learn more, go to <a href="admin.php?page=rt_setup_assistant">Setup Assistant</a> and read "How To Use Template Builder".', 'rt_theme_admin'), "hr" => "true", "type" => "info"));
     if ($savedTemplates) {
         foreach ($savedTemplates->templates as $template) {
             $TemplateID = $template->templateID;
             $template_name = $template->templateName;
             $lineUp = isset($template->lineup) ? $template->lineup : "";
             //Temlates Div
             array_push($options, array("id" => "div_" . $TemplateID, "name" => $template_name, "type" => "div"));
             //Template Name
             array_push($options, array("name" => __("Template Name", 'rt_theme_admin'), "value" => $template_name, "id" => $TemplateID . "_template_name", "class" => "sidebar_name saved", "hr" => "true", "type" => "text"));
             //Sidebar selection
             array_push($options, array("name" => __("Select a Page Layout", 'rt_theme_admin'), "id" => $TemplateID . "_sidebarSelection", "options" => array("full" => "Full Width", "left" => "Left Sidebar", "right" => "Right Sidebar"), "value" => $template->sidebar, "purpose" => "page_layouts", "hr" => "true", "class" => "layout_selector", "type" => "radio"));
             //Create Item Select List
             array_push($options, array("name" => __("Module List", 'rt_theme_admin'), "id" => $TemplateID . "_item_list", "options" => $rt_items, "default" => "", "purpose" => "sidebar", "sidebuttonName" => "Add", "sidebuttonClass" => "rt_template_item_add_button add_button", "type" => "select"));
             //Heading
             array_push($options, array("name" => __("Modules", 'rt_theme_admin'), "id" => $TemplateID . "_header", "default" => "", "purpose" => "page_layouts", "type" => "heading"));
             //Create Grid First Part
             array_push($options, array("id" => $TemplateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "first"));
             if (isset($template->contents) && is_array($template->contents)) {
                 foreach ($template->contents as $templateContents) {
                     //possible empty values - fix php warnings
                     $templateContents->categories = isset($templateContents->categories) ? $templateContents->categories : "";
                     $templateContents->thumbs_width = isset($templateContents->thumbs_width) ? $templateContents->thumbs_width : "";
                     $templateContents->thumbs_height = isset($templateContents->thumbs_height) ? $templateContents->thumbs_height : "";
                     $templateContents->filterable = isset($templateContents->filterable) ? $templateContents->filterable : "";
                     $templateContents->list_order = isset($templateContents->list_order) ? $templateContents->list_order : "";
                     //Call Home Page Box
                     if ($templateContents->content_type == "home_page_box") {
                         array_push($options, array("id" => $TemplateID . "_home_page_contents", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'content_id' => $templateContents->content_id), "purpose" => "page_layouts", "content_type" => "home_page_box", "type" => "template_item"));
                     }
                     //Call Portfolio Posts
                     if ($templateContents->content_type == "portfolio_box") {
                         array_push($options, array("id" => $TemplateID . "_portfolio_posts", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'categories' => @$templateContents->categories, 'pagination' => $templateContents->pagination, 'item_width' => $templateContents->item_width, 'portf_list_orderby' => $templateContents->portf_list_orderby, 'portf_list_order' => $templateContents->portf_list_order, 'item_per_page' => $templateContents->item_per_page, 'filterable' => $templateContents->filterable), "purpose" => "page_layouts", "content_type" => "portfolio_box", "type" => "template_item"));
                     }
                     //Call Sidebar Box
                     if ($templateContents->content_type == "sidebar_box") {
                         array_push($options, array("id" => $TemplateID . "_sidebar_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'sidebar_id' => $templateContents->sidebar_id, 'widget_box_width' => $templateContents->widget_box_width), "purpose" => "page_layouts", "content_type" => "sidebar_box", "type" => "template_item"));
                     }
                     //Call Default Content Box
                     if ($templateContents->content_type == "default_content") {
                         array_push($options, array("id" => $TemplateID . "_default_content", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => $templateContents->heading), "purpose" => "page_layouts", "content_type" => "default_content", "type" => "template_item"));
                     }
                     //Call All content boxes
                     if ($templateContents->content_type == "all_content_boxes") {
                         array_push($options, array("id" => $TemplateID . "_all_content_boxes", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'content_id' => $templateContents->content_id, 'item_width' => $templateContents->item_width, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order), "purpose" => "page_layouts", "content_type" => "all_content_boxes", "type" => "template_item"));
                     }
                     //Call banner boxes
                     if ($templateContents->content_type == "banner_box") {
                         array_push($options, array("id" => $TemplateID . "_banner_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'text' => stripslashes($templateContents->text), 'button_text' => $templateContents->button_text, 'button_link' => $templateContents->button_link), "purpose" => "page_layouts", "content_type" => "banner_box", "type" => "template_item"));
                     }
                     //Call slider boxes
                     if ($templateContents->content_type == "slider_box") {
                         array_push($options, array("id" => $TemplateID . "_slider_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'slider_script' => $templateContents->slider_script, 'content_id' => $templateContents->content_id, 'slider_timeout' => $templateContents->slider_timeout, 'slider_height' => $templateContents->slider_height, 'image_resize' => $templateContents->image_resize, 'image_crop' => $templateContents->image_crop, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'slider_buttons' => $templateContents->slider_buttons, 'slider_thumbs' => $templateContents->slider_thumbs, 'thumbs_width' => $templateContents->thumbs_width, 'thumbs_height' => $templateContents->thumbs_height, 'slider_effect' => $templateContents->slider_effect), "purpose" => "page_layouts", "content_type" => "slider_box", "type" => "template_item"));
                     }
                     //Call revolution slider boxes
                     if ($templateContents->content_type == "revolution_box") {
                         array_push($options, array("id" => $TemplateID . "_revolution_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'slider_id' => $templateContents->slider_id), "purpose" => "page_layouts", "content_type" => "revolution_box", "type" => "template_item"));
                     }
                     //Call product boxes
                     if ($templateContents->content_type == "product_box") {
                         array_push($options, array("id" => $TemplateID . "_product_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'item_width' => $templateContents->item_width, 'ajax_scroller' => @$templateContents->ajax_scroller, 'pagination' => $templateContents->pagination, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "product_box", "type" => "template_item"));
                     }
                     if (class_exists('Woocommerce')) {
                         //Call woo product boxes
                         if ($templateContents->content_type == "woo_products_box") {
                             array_push($options, array("id" => $TemplateID . "_woo_products_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'item_width' => $templateContents->item_width, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "woo_products_box", "type" => "template_item"));
                         }
                     }
                     //Call blog boxes
                     if ($templateContents->content_type == "blog_box") {
                         array_push($options, array("id" => $TemplateID . "_blog_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'pagination' => $templateContents->pagination, 'list_orderby' => $templateContents->list_orderby, 'list_order' => @$templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "blog_box", "type" => "template_item"));
                     }
                     //Call google map
                     if ($templateContents->content_type == "google_map") {
                         array_push($options, array("id" => $TemplateID . "_google_map", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'map_url' => stripslashes($templateContents->map_url), 'height' => $templateContents->height), "purpose" => "page_layouts", "content_type" => "google_map", "type" => "template_item"));
                     }
                     //Call contact form
                     if ($templateContents->content_type == "contact_form") {
                         array_push($options, array("id" => $TemplateID . "_contact_form", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'title' => stripslashes($templateContents->title), 'email' => $templateContents->email, 'shortcode' => stripslashes($templateContents->shortcode), 'description' => stripslashes($templateContents->description)), "purpose" => "page_layouts", "content_type" => "contact_form", "type" => "template_item"));
                     }
                     //Call contact info box
                     if ($templateContents->content_type == "contact_info_box") {
                         array_push($options, array("id" => $TemplateID . "_contact_info_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'contact_title' => stripslashes($templateContents->contact_title), 'contact_text' => stripslashes($templateContents->contact_text), 'address' => stripslashes($templateContents->address), 'phone' => stripslashes($templateContents->phone), 'email' => stripslashes($templateContents->email), 'support_email' => stripslashes($templateContents->support_email), 'fax' => stripslashes($templateContents->fax)), "purpose" => "page_layouts", "content_type" => "contact_info_box", "type" => "template_item"));
                     }
                     //Call heading bar
                     if ($templateContents->content_type == "heading_bar") {
                         array_push($options, array("id" => $TemplateID . "_heading_bar", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => stripslashes($templateContents->heading)), "purpose" => "page_layouts", "content_type" => "heading_bar", "type" => "template_item"));
                     }
                     //Call code box
                     if ($templateContents->content_type == "code_box") {
                         array_push($options, array("id" => $TemplateID . "_code_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => stripslashes($templateContents->heading), 'code_space' => stripslashes($templateContents->code_space), 'transparent' => stripslashes($templateContents->transparent), 'no_padding' => stripslashes($templateContents->no_padding)), "purpose" => "page_layouts", "content_type" => "code_box", "type" => "template_item"));
                     }
                 }
             }
             //Create Grid Second Part
             array_push($options, array("id" => $TemplateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "second"));
             //Delete Button
             if ($TemplateID != "templateid_001" && $TemplateID != "templateid_002" && $TemplateID != "templateid_003" && $TemplateID != "templateid_004" && $TemplateID != "templateid_005") {
                 array_push($options, array("name" => __("Delete Template", 'rt_theme_admin'), "id" => $TemplateID . "_delete", "class" => "deleteButton deteleTemplateButton", "purpose" => "sidebar", "type" => "button"));
             }
             //Sidebar Divend
             array_push($options, array("id" => "", "type" => "divend"));
         }
     }
     // New Sidebar
     $templateID = 'templateid_' . rand(1000, 1000000);
     $templateName = $templateID . '_template_name';
     //Sidebar Div
     array_push($options, array("name" => __("Create New Template", 'rt_theme_admin'), "id" => "div_" . $templateID, "class" => "new_sidebar", "type" => "div"));
     //Template Names
     array_push($options, array("name" => __("Template Name", 'rt_theme_admin'), "value" => "", "class" => "sidebar_name", "hr" => "true", "id" => $templateName, "type" => "text"));
     //Sidebar selection
     array_push($options, array("name" => __("Select a Page Layout", 'rt_theme_admin'), "id" => $templateID . "_sidebarSelection", "options" => array("full" => "Full Width", "left" => "Left Sidebar", "right" => "Right Sidebar"), "value" => "full", "purpose" => "page_layouts", "class" => "layout_selector", "hr" => "true", "type" => "radio"));
     //Create Item Select List
     array_push($options, array("name" => __("Module List", 'rt_theme_admin'), "id" => $templateID . "_item_list", "options" => $rt_items, "default" => "", "purpose" => "sidebar", "sidebuttonName" => "Add", "sidebuttonClass" => "rt_template_item_add_button add_button", "type" => "select"));
     //Heading
     array_push($options, array("name" => __("Modules", 'rt_theme_admin'), "id" => $templateID . "_header", "default" => "", "purpose" => "page_layouts", "type" => "heading"));
     //Create Grid
     array_push($options, array("id" => $templateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "full"));
     //Send button
     array_push($options, array("name" => __("Create Template", 'rt_theme_admin'), "id" => $templateID . "_send_button", "class" => "create_button", "purpose" => "page_layouts", "type" => "send_button"));
     //Sidebar Divend
     array_push($options, array("id" => "", "type" => "divend"));
     $this->rt_generate_form_page($options);
 }