Plugin Directory

Changeset 1228715


Ignore:
Timestamp:
08/23/2015 07:13:30 PM (10 years ago)
Author:
gdurtan
Message:

Adding nex version from github

Location:
wp-results/trunk
Files:
39 added
6 edited

Legend:

Unmodified
Added
Removed
  • wp-results/trunk/README.md

    r1184158 r1228715  
    1 # Results
     1# WP RESULTS WordPress plugin
     2
     3The mission of this project is to enable creating web applications by only few clicks.
     4"Wp Results" consists of two main modules:
     5
     61. Form to input and process data.
     72. Composer to display stored data. 
     8
     9Ultimately, I would like to publish kits based on "Wp Results" which enable building almost any app and portal. I am going to show it on examples like: work portals, photostocks, event portals, complex ecommerce apps and web solutions. In order to present possibilities of "Wp Results" each portal will have its own, dedicated CRM module.
     10
     11At first I'll try show how to create [work portal](https://github.com/dadmor/Results/wiki/WorkPortal-Example).
     12
     13PS. Project are still in progress and waiting to contributors ;)
     14
     15# Main concept
     16
     17<img src="https://github.com/dadmor/Results/blob/master/github-assets/wp_result_concept.png">
     18
     19# Create grid
     20
     21<img src="https://github.com/dadmor/Results/blob/master/github-assets/screen1.png">
     22
     23# Add grid to WordPress page
     24
     25go to WP customizer: Dashboard > Appearance > Customize
     26
     27<img src="https://github.com/dadmor/Results/blob/master/github-assets/screen2.png">
     28
     29# Form and data process builder
     30
     31Forms component is developed on anothers repo:
     32[alpacajs-ux-form-editor](https://github.com/dadmor/alpacajs-ux-form-editor),
     33[wp-alpaca-options-class](https://github.com/dadmor/wp-alpaca-options-class),
     34[WP_Executor](https://github.com/dadmor/WP_Executor)
     35
     36
     37<img src="https://github.com/dadmor/Results/blob/master/github-assets/executable-form.png">
     38<hr>
     39
     40This form after collect and send create new post with post_meta data.
     41
     42# More details
     43
     44To read more details go to plugin [Overview](https://github.com/dadmor/Results/wiki/OVERVIEW)
  • wp-results/trunk/css/list-style.css

    r1184158 r1228715  
     1/* -- Filters -- */
     2select{
     3    padding: 4px 5px 5px;
     4    border: 1px solid #ccc;
     5    border-radius: 3px;
     6    font-size: 14px;
     7    background-color: #efefef;
     8}
     9button{
     10    font-size: 24px !important;
     11    padding: 11px 20px !important;
     12}
     13
     14/* -- lists -- */
    115.wp_list{
    216    display:table;
  • wp-results/trunk/inc/customize-controlls.php

    r1184158 r1228715  
    11<?php
     2function my_preview_js() {
     3    wp_enqueue_script( 'custom-grid-displayer', plugins_url().'/wp-results/js/custom-grid-displayer.js', array( 'customize-preview',  'jquery'  ) ,true);
     4        //wp_enqueue_script('customizer-slider', plugins_url('js/slider-ui.js', __FILE__), array('jquery-ui-slider'), '1.0', true);
     5        //wp_register_style('customizer-slider-styles', plugins_url('css/slider-ui.min.css', __FILE__)); 
     6        //wp_enqueue_style('customizer-slider-styles');
     7
     8}
     9add_action( 'customize_preview_init', 'my_preview_js' );
     10
     11
     12
    213
    314//if ( is_admin() ) {
    4       new theme_customizer();
     15$TC = new theme_customizer();
    516//}
    6    
    7 
    8 
     17 
    918class theme_customizer
    1019{
    11    
    12     private $gfxfiles = array();
    13    
     20   
    1421    public function __construct()
    1522    {
    16         add_action ('admin_menu', array(&$this, 'customizer_admin'));
    1723        add_action( 'customize_register', array(&$this, 'customize_manager_demo' ));
    18 
    19         $this -> gfxfiles['none'] = 'none';
    20 
    21         if ($handle = opendir(GFX_DIR)) {
    22             while (false !== ($entry = readdir($handle))) {
    23                 if ($entry != "." && $entry != "..") {
    24                     $this -> gfxfiles[$entry] = $entry;
    25                 }
    26             }
    27             closedir($handle);
    28         }
    29        
    3024    }
    3125
     
    4842    }
    4943
     44
    5045    public function demo_section( $wp_manager )
    5146    {
    5247
    53         /*$wp_manager->add_section( 'customiser_demo_section', array(
    54             'title'          => 'Theme Grid GFX',
     48        $wp_manager->add_section( 'template_parts_section', array(
     49            'title'          => 'WP Results Composer',
    5550            'priority'       => 35,
     51            //'panel' => 'template_parts_panel',
    5652        ) );
    5753
    58         $wp_manager->add_setting( 'wraper_footer_menu_style', array(
    59             'default'        => '',
    60         ) );
    61         $wp_manager->add_control( 'wraper_footer_menu_style', array(
    62             'label'   => 'Select wraper-footer_menu bg style',
    63             'section' => 'customiser_demo_section',
    64             'type'    => 'text',
    65             'priority' => 8
    66         ) );*/
     54        /* Template part Files */
     55        $template_parts_array = array(
     56            'index',
     57            'home',
     58            'category',
     59            'archive',
     60            'tag',
     61            'author',
     62            'date',
     63            'search',
     64            'page'
     65        );
     66
     67        global $GRIDS;
     68        $grids_list = array('original' => 'Original template');
     69        foreach ($GRIDS->options_group as $value) {
     70            $grids_list[$value] = $value;
     71        }
     72
     73        foreach ($template_parts_array as $template_part) {
    6774
    6875
    69         $wp_manager->add_section( 'customiser_google_fonts', array(
    70             'title'          => 'WP Results Composer',
    71             'priority'       => 35,
    72         ) );
    73          // Select wraper-header control
    74         $wp_manager->add_setting( 'font_name', array(
    75             'default'        => 'none',
    76         ) );
    77         $wp_manager->add_control( 'font_name', array(
    78             'label'   => 'Content template part',
    79             'section' => 'customiser_google_fonts',
    80             'type'    => 'select',
     76            $wp_manager->add_setting( 'template_'.$template_part, array(
     77                'default'        => 'none',
     78                //'sanitize_callback' => 'example_sanitize_text',
     79            ) );
     80            $wp_manager->add_control( 'template_'.$template_part, array(
     81                'input_attrs' => array('hierarchy_name' => $template_part),
     82                'label'   => 'Templatelate ('.$template_part.')',
     83                'section' => 'template_parts_section',
     84                'type'    => 'select',             
     85                'choices' => $grids_list,
     86                'priority' => 1
     87            ) );
     88           
     89            # code...
     90            // Select wraper-header control
     91            $wp_manager->add_setting( 'content_part_'.$template_part, array(
     92                'default'        => 'none',
     93                //'sanitize_callback' => 'example_sanitize_text',
     94            ) );
     95            $wp_manager->add_control( 'content_part_'.$template_part, array(
     96                'input_attrs' => array('hierarchy_name' => $template_part),
     97                'label'   => 'Content template part ('.$template_part.')',
     98                'section' => 'template_parts_section',
     99                'type'    => 'select',             
     100                'choices' => array(
     101                    'none' => 'Original content',
     102                    'tp-dynamic-table-ac' => 'Dynamic table (Admin columns)',
     103                    'tp-dynamic-cart-table-ac' => 'Dynamic table with CART (Admin columns)',
     104                    /*'template-part-1' => 'Template 1',
     105                    'template-part-2' => 'Template 2',
     106                    'template-part-3' => 'Template 3',     */               
     107                    ),
     108                'priority' => 1
     109            ) );
     110        }
     111    }
     112}
    81113
    82             'choices' => array(
    83                 'none' => 'Oryginal content',
    84                 'template-part-1' => 'Template 1',
    85                 'template-part-2' => 'Template 2',
    86                 'template-part-3' => 'Template 3',
    87                
    88                 ),
    89             'priority' => 1
    90         ) );
     114function title_tagline_control_filter( $active, $control ) {
    91115
     116    if ( $control->input_attrs['hierarchy_name'] === 'index'  ) {
     117        return is_front_page();
    92118    }
     119    if ( $control->input_attrs['hierarchy_name'] === 'home'  ) {
     120        return is_home();
     121    }
     122    if ( $control->input_attrs['hierarchy_name'] === 'category'  ) {
     123        return is_category();
     124    }
     125    if ( $control->input_attrs['hierarchy_name'] === 'archive'  ) {
     126        return is_archive();
     127    }
     128    if ( $control->input_attrs['hierarchy_name'] === 'tag'  ) {
     129        return is_tag();
     130    }
     131    if ( $control->input_attrs['hierarchy_name'] === 'author'  ) {
     132        return is_author();
     133    }
     134    if ( $control->input_attrs['hierarchy_name'] === 'date'  ) {
     135        return is_date();
     136    }
     137    if ( $control->input_attrs['hierarchy_name'] === 'search'  ) {
     138        return is_search();
     139    }
     140    return true;
    93141
    94142}
    95 
    96 
    97 
    98 
    99 
    100 ?>
     143add_filter( 'customize_control_active', 'title_tagline_control_filter', 10, 2 );
  • wp-results/trunk/readme.txt

    r1184170 r1228715  
    2424
    2525== Changelog ==
     26= 0.0.2 =
     27* add grid creator.
     28* add search and filter widget.
     29* integrate with wp-columns.
     30
    2631= 0.0.1 =
    2732* initial commit, files and templates.
  • wp-results/trunk/vtpl/simple-v-tpl.php

    r1184158 r1228715  
    1515            <?php while ( have_posts() ) : the_post(); $theID = $post->ID; ?>
    1616
    17                 <?php $VT->get_template_part( get_theme_mod( 'font_name' ) ); ?>
     17                <?php $VT->get_template_part( get_theme_mod( 'content_part_'.$VT -> tfname ) ); ?>
    1818
    1919            <?php endwhile; ?>
  • wp-results/trunk/wp-results.php

    r1184170 r1228715  
    33Plugin Name: WP Results
    44Plugin URI: https://github.com/dadmor/Results
    5 Description: Display wp query on frontend as templated lists
     5Description: Results will be amazing!!!
    66Author: gdurtan
    77Author URI: https://pl.linkedin.com/pub/grzegorz-durtan/11/b74/296
    8 Version: 0.0.2
     8Version: 0.0.5
    99License: GPL2
    1010*/
    1111
    12 class R_Lists_widget extends WP_Widget {
     12define("PLUGIN_SANDF_DIR", dirname(__FILE__));
     13define("PLUGIN_SANDF_URI", plugin_dir_url( __FILE__ ));
    1314
    14     private $list_data = array();
     15/* Include better manage wp options */
     16include plugin_dir_path( __FILE__ ).'class/wp-options-manager.class.php';
     17$R_OPTIONS = new wp_options_manager();
     18$R_OPTIONS -> register_ajax_methods();
    1519
    16     function __construct() {
    17         parent::__construct(
    18             'R_Lists_widget', // Base ID
    19             __( 'Results list ', 'text_domain' ), // Name
    20             array( 'description' => __( 'Display wp query on frontend as templated lists', 'text_domain' ), ) // Args
    21         );
    22     }
     20include plugin_dir_path( __FILE__ ).'class/admin-column-frontend.class.php';
     21$ACOL = new admin_column_frontend();
    2322
    24     private function set_dimention($width,$unit){
    25             $style = 'width: '.$width.''.$unit.'; ';
    26             return $style;
    27     }
     23/* Include class to inject custom templates int wordpress pages */
     24include plugin_dir_path( __FILE__ ).'class/virtual-template.class.php';
    2825
    29     private function array_equal($a, $b) {
    30         return (is_array($a) && is_array($b) && array_diff($a, $b) === array_diff($b, $a));
    31     }
     26/* Forms */
     27include plugin_dir_path( __FILE__ ).'class/wp-alpaca-options.class.php';
     28include plugin_dir_path( __FILE__ ).'inc/metabox-alpacajs-form.php';
    3229
    33     private function list_controller( $the_query, $post_type, $adv_query_options){ 
     30include plugin_dir_path( __FILE__ ).'class/wp-search-and-filter.class.php';
     31include plugin_dir_path( __FILE__ ).'inc/widget-filter-and-search.php';
    3432
    35             $prepare_resoult = array();
    36                
    37             $std_schema_data = get_option( 'cpac_options_'.$post_type);
     33/* Inclide search and filters class */
    3834
    39             if($std_schema_data == false){
    40                 require( plugin_dir_path( __FILE__ ) . '/std-data.php' );
    41             };
    42            
    43             while ( $the_query->have_posts() ) {
    44            
    45                 $the_query->the_post();
    4635
    47                 $parsed_data = array();
    48                 foreach ($std_schema_data as $key => $value) {
    49                     require( plugin_dir_path( __FILE__ ) . '/inc/data-parser.php' );
    50                 }
     36/* widget to display loop with sidebars */
     37/* result widget remove admin bar ??? */
     38//include plugin_dir_path( __FILE__ ).'inc/widget-result-list.php';
    5139
    52                 $prepare_resoult[$the_query->post->ID] = $parsed_data;
    53                 //$prepare_resoult[$the_query->post->ID]['id'] = $the_query->post->ID;
    54             }
    55             $this -> list_data = $prepare_resoult;
    56     }
    57 
    58     /**
    59      * Front-end display of widget.
    60      *
    61      */
    62 
    63     public function widget( $args, $instance ) {
    64 
    65         wp_register_style( 'fields-pack-style', plugins_url('/css/list-style.css', __FILE__) );
    66         wp_enqueue_style('fields-pack-style');
    67    
    68         echo $args['before_widget'];
    69 
    70         if ( ! empty( $instance['title'] ) ) {
    71             echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
    72         }
    73 
    74         $adv_query_options = json_decode( $instance['adv_query_options'], true );
    75 
    76         $adv_query_options['query_args']['post_type'] = $instance['post_type'];
    77 
    78         global $wp_query;
    79 
    80         include plugin_dir_path( __FILE__ ).'inc/query_support.class.php';
    81 
    82         $Q = new uigen_query();
    83 
    84         $Q -> run($adv_query_options['query_args'],true);
    85        
    86         $this -> list_controller( $Q->last_query, $instance['post_type'] , $adv_query_options);
    87 
    88         /* TEMPLATE */
    89         require( plugin_dir_path( __FILE__ ) . '/tpl/'.$instance['template'] );
    90    
    91         /* Restore original Post Data */
    92         wp_reset_postdata();
    93 
    94         // end Widget Body
    95         echo $args['after_widget'];
    96     }
    97 
    98     /**
    99      * Back-end widget form.
    100      *
    101      * @see WP_Widget::form()
    102      *
    103      * @param array $instance Previously saved values from database.
    104      */
    105     public function form( $instance ) {
    106                 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'New title', 'text_domain' );
    107                 $template = ! empty( $instance['template'] ) ? $instance['template'] : __( 'Template', 'text_domain' );
    108                 $post_type = ! empty( $instance['post_type'] ) ? $instance['post_type'] : __( 'post', 'text_domain' );
    109                 $adv_query_options = ! empty( $instance['adv_query_options'] ) ? $instance['adv_query_options'] : '{
    110 "query_args": {
    111         "posts_per_page":"-1"
    112     },
    113     "acf_map_name":"location"
    114 }';
    115         ?>
    116         <p>
    117         <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
    118         <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
    119         </p>
    120         <p>
    121         <label for="<?php echo $this->get_field_id( 'post_type' ); ?>"><?php _e( 'Post type' ); ?></label>
    122         <input class="widefat" id="<?php echo $this->get_field_id( 'post_type' ); ?>" name="<?php echo $this->get_field_name( 'post_type' ); ?>" type="text" value="<?php echo esc_attr( $post_type ); ?>">
    123         </p>
    124         <p>
    125         <select class='widefat' id="<?php echo $this->get_field_id('template'); ?>"
    126                 name="<?php echo $this->get_field_name('template'); ?>" type="text">
    127           <option value='list-main-page-1.php'<?php echo ($template=='list-main-page-1.php')?'selected':''; ?>>
    128             Main page list 1
    129           </option>
    130           <option value='list-table-1.php'<?php echo ($template=='list-table-1.php')?'selected':''; ?>>
    131             Table 1
    132           </option>
    133           <option value='list-main-page-2.php'<?php echo ($template=='list-main-page-2.php')?'selected':''; ?>>
    134              Main page list 2
    135           </option>
    136         </select>       
    137         </p>
    138         <p>
    139         <label for="<?php echo $this->get_field_id( 'adv_query_options' ); ?>"><?php _e( 'Adv query options:' ); ?></label>
    140         <textarea class="widefat" style="height:150px; font-size:11px" id="<?php echo $this->get_field_id( 'adv_query_options' ); ?>" name="<?php echo $this->get_field_name( 'adv_query_options' ); ?>" type="text"><?php echo esc_attr( $adv_query_options ); ?></textarea>
    141         </p>
    142         <?php
    143     }
    144 
    145     /**
    146      * Sanitize widget form values as they are saved.
    147      *
    148      */
    149     public function update( $new_instance, $old_instance ) {
    150         $instance = array();
    151         $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
    152         $instance['post_type'] = ( ! empty( $new_instance['post_type'] ) ) ? strip_tags( $new_instance['post_type'] ) : '';
    153         $instance['template'] = ( ! empty( $new_instance['template'] ) ) ? strip_tags( $new_instance['template'] ) : '';
    154         $instance['adv_query_options'] = ( ! empty( $new_instance['adv_query_options'] ) ) ? strip_tags( $new_instance['adv_query_options'] ) : '';
    155         return $instance;
    156     }
    157 
    158 }
    159 
    160 // register Results widget
    161 function register_R_Lists_widget() {
    162     register_widget( 'R_Lists_widget' );
    163 }
    164 add_action( 'widgets_init', 'register_R_Lists_widget' );
    165 
    166 /* -------------------------------------------------------------------- */
    167 
    168 include plugin_dir_path( __FILE__ ).'inc/virtual_template.class.php';
    169 
    170 function theme_name_scripts() {
    171     wp_enqueue_style( 'simple-grid', plugins_url().'/wp-results/css/simple-grid.css' );
    172 }
    173 
    174 add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
    175 
     40include plugin_dir_path( __FILE__ ).'inc/widget-paypal-cart.php';
    17641
    17742/* ADD CUSTOMIZE CONTROLLS TO THIS THEME */
    17843include plugin_dir_path( __FILE__ ).'inc/customize-controlls.php';
    17944
     45/* ADD ENDPOINT REST API */
     46include plugin_dir_path( __FILE__ ).'inc/rest-endpoint-api.php';
     47
     48
     49/* Register manu and display block */
     50function wp_results_menu()
     51
     52    add_menu_page('Results', 'Results', 'administrator', 'url_wp_results', 'wp_results_callback');
     53    add_submenu_page('url_wp_results', 'Results GRID', 'Results GRID', 'administrator', 'url_wp_results_grid', 'add_grid_callback');
     54    add_submenu_page('url_wp_results', 'Results TPL parts', 'Results TPL parts', 'administrator', 'url_wp_results_parts', 'add_parts_callback');
     55    add_submenu_page('url_wp_results', 'Results FORMS', 'Results FORMS', 'administrator', 'url_wp_results_forms', 'add_forms_callback');
     56}
     57add_action('admin_menu', 'wp_results_menu');
     58
     59function wp_results_callback() {
     60    wpr_admin_page( 'home' , 'WP Results plugin' );
     61}
     62
     63function add_grid_callback(){
     64    wpr_reg_styles( array('skeleton-grid-creator', 'grid-creator' ) );
     65    wpr_reg_scripts( array('jquery-tmpl.min','grid-creator','options-manager-helpers'));
     66    wpr_admin_page( 'grid', 'WP Results Grid Creator' );
     67}
     68
     69function add_parts_callback() {
     70    wpr_admin_page( 'add-parts', 'WP Results parts' );
     71}
     72
     73function add_forms_callback(){
     74    wp_enqueue_script('jquery-ui-sortable');
     75
     76    wpr_reg_scripts( array( 'alpaca-core.min', 'lodash', 'lodash-deep', 'alpacajs-ux-form-editor' ));
     77    wpr_reg_styles( array('alpaca.min', 'ux-form-editor-style', 'skeleton-grid-creator', 'grid-creator' ));
     78    wpr_admin_page('ux-form-builder', 'WP Results Form Builder' );
     79}
     80
     81function wp_result_theme_scripts() {
     82    wpr_reg_styles( array('skeleton-only-grid','list-style' ) );
     83}
     84add_action( 'wp_enqueue_scripts', 'wp_result_theme_scripts' );
     85
     86/* dynamic template helpers functions */
     87function get_skeleton_class($tpl){
     88    if($tpl['results_loop']){
     89        if(($tpl['left_bar'])&&($tpl['results_loop'])){
     90            $side_class = 'four';
     91            $loop_class = 'eight'; 
     92        }
     93        if(($tpl['right_bar'])&&($tpl['results_loop'])){
     94            $side_class = 'four';
     95            $loop_class = 'eight'; 
     96        }
     97        if(($tpl['left_bar'])&&($tpl['right_bar'])){
     98            $side_class = 'three';
     99            $loop_class = 'six';   
     100        }
     101    }else{
     102        if(($tpl['left_bar'])||($tpl['right_loop'])){
     103            $side_class = 'twelve';
     104        }
     105        if(($tpl['left_bar'])&&($tpl['right_loop'])){
     106            $side_class = 'six';
     107        }
     108    }
     109    return (object)array('side'=> $side_class, 'loop' => $loop_class);
     110}
     111
     112function my_sidebar($id){
     113   
     114    //var_dump($id);
     115    if($id['id']){
     116        // TODO check it if you change template !!!!
     117        if ( is_active_sidebar( $id['id'] ) ) {
     118            dynamic_sidebar($id['name']);
     119        }
     120    }else{
     121        if($id == true){
     122            echo '&nbsp;';
     123        }
     124    }
     125}
     126
     127/* ADMIN PAGES HELPERS METHODS */
     128function wpr_reg_scripts( $array ){
     129    foreach ( $array as $key ) {
     130        wp_register_script( $key, plugins_url('/js/'.$key.'.js', __FILE__) );
     131        wp_enqueue_script( $key );
     132    }
     133}
     134function wpr_reg_styles( $array ){
     135    foreach ( $array as $key ) {
     136        wp_register_style( $key, plugins_url('/css/'.$key.'.css', __FILE__) );
     137        wp_enqueue_style( $key );
     138    }
     139}
     140function wpr_admin_page( $page , $name ){
     141    echo '<div class="wrap"><h2>'.$name.'</h2>';
     142    include 'inc/plugin-page-'.$page.'.php';
     143    echo '</div>';
     144}
Note: See TracChangeset for help on using the changeset viewer.