Plugin Directory

Changeset 2067231


Ignore:
Timestamp:
04/11/2019 01:39:26 PM (7 years ago)
Author:
sebastiantiede
Message:

Release version 0.0.10

Location:
wp-open-votomat
Files:
1396 added
10 edited

Legend:

Unmodified
Added
Removed
  • wp-open-votomat/trunk/includes/api/wpov_party.php

    r2053270 r2067231  
    9191    }
    9292   
    93     function party_user_consensus($voting = false) {
     93    function party_user_consensus($voting = false, $user = false) {
    9494        $voting_answers = $this->voting_answers($voting);
    9595        //$user = wpov_get_current_voter();
    9696        $rate = 0;
    9797        foreach($voting_answers as $answer) {
    98             $rate += $answer->party_user_consensus();
     98            $rate += $answer->party_user_consensus($user);
    9999        }
    100100       
  • wp-open-votomat/trunk/includes/api/wpov_party_answer.php

    r2053270 r2067231  
    4343    }   
    4444   
    45     function party_user_consensus() {
    46        
    47         $user = wpov_get_current_voter();
    48        
     45    function party_user_consensus($user = false) {
     46        if(!$user) {
     47            $user = wpov_get_current_voter();
     48        }
     49               
    4950        $user_vote = $user->get_vote($this->voting()->get_id(), $this->question()->get_id());
    5051       
  • wp-open-votomat/trunk/includes/voter/wpov_voter.php

    r2053270 r2067231  
    168168    }   
    169169   
     170    function compare_public_link($voting = false) {       
     171        $post = wpov_get_voter($this->get_user_db_id());
     172
     173        global $wpov_post_voting;
     174               
     175        return sprintf('%scompare/%s', $wpov_post_voting->link(), $post->_post->post_name);
     176    }     
     177   
    170178}
    171179
  • wp-open-votomat/trunk/languages/wp-open-votomat-de_DE.po

    r2066999 r2067231  
    55"Project-Id-Version: Shortcake (Shortcode UI) 0.7.3\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/shortcode-ui\n"
    7 "POT-Creation-Date: 2019-04-11 09:37+0200\n"
    8 "PO-Revision-Date: 2019-04-11 09:37+0200\n"
     7"POT-Creation-Date: 2019-04-11 14:57+0200\n"
     8"PO-Revision-Date: 2019-04-11 14:57+0200\n"
    99"Last-Translator: \n"
    1010"Language-Team: \n"
     
    1616"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
    1717"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
    18 "esc_html_x:1,2c\n"
     18"esc_html_x:1,2c;register_js_translation\n"
    1919"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    2020"X-Poedit-SourceCharset: UTF-8\n"
     
    7272#: includes/admin/post_type-question.php:85
    7373#: includes/admin/post_type-voting.php:52
    74 #: includes/admin/post_type-voting.php:258 wp-open-votomat.php:355
     74#: includes/admin/post_type-voting.php:258 wp-open-votomat.php:381
    7575msgid "Question"
    7676msgstr "Frage"
     
    8484msgstr "Zurück zur Übersicht"
    8585
    86 #: wpov_template/twentynineteen/twig/page-voting-result.twig:7
     86#: wpov_template/twentynineteen/twig/page-voting-result.twig:9
    8787msgid "The result"
    8888msgstr "Das Ergebnis"
    8989
    9090#: wpov_template/twentynineteen/twig/page-voting-result.twig:11
     91msgid "The result someone send you"
     92msgstr "Das Ergebnis, das dir jemand gesendet hat"
     93
     94#: wpov_template/twentynineteen/twig/page-voting-result.twig:17
    9195#: includes/admin/post_type-voting.php:56
    92 #: includes/admin/post_type-voting.php:209 wp-open-votomat.php:322
     96#: includes/admin/post_type-voting.php:209 wp-open-votomat.php:348
    9397msgid "Party"
    9498msgstr "Partei"
    9599
    96 #: wpov_template/twentynineteen/twig/page-voting-result.twig:12
     100#: wpov_template/twentynineteen/twig/page-voting-result.twig:18
    97101msgid "Accordance"
    98102msgstr "Übereinstimmung"
    99103
    100 #: wpov_template/twentynineteen/twig/page-voting-result.twig:13
     104#: wpov_template/twentynineteen/twig/page-voting-result.twig:19
    101105msgid "in %"
    102106msgstr "in %"
    103107
    104 #: wpov_template/twentynineteen/twig/page-voting-result.twig:60
     108#: wpov_template/twentynineteen/twig/page-voting-result.twig:73
    105109msgid "Your answers compared to those of the parties"
    106110msgstr "Deine Antworten im direkten Vergleich mit den Parteien"
    107111
    108 #: wpov_template/twentynineteen/twig/page-voting-result.twig:63
    109 msgid ""
    110 "By clicking on the logos you come to the websites of the parties.<br />With "
    111 "the following link you can share your result with others:"
    112 msgstr ""
    113 "Durch Klick auf die Logos kommst du auf die Webseiten der Parteien.<br />Mit "
    114 "dem folgenden Link kannst du dein Ergebnis mit anderen teilen:"
     112#: wpov_template/twentynineteen/twig/page-voting-result.twig:78
     113msgid "By clicking on the logos you come to the websites of the parties."
     114msgstr "Durch Klick auf die Logos kommst du auf die Webseiten der Parteien."
     115
     116#: wpov_template/twentynineteen/twig/page-voting-result.twig:82
     117msgid "With the following link you can share your result with others:"
     118msgstr "Mit dem folgenden Link kannst du dein Ergebnis mit anderen teilen:"
    115119
    116120#: includes/admin/admin.php:86
     
    300304#: includes/admin/post_type-voting.php:36
    301305#: includes/admin/post_type-voting.php:57
    302 #: includes/admin/post_type-voting.php:169 wp-open-votomat.php:321
     306#: includes/admin/post_type-voting.php:169 wp-open-votomat.php:347
    303307msgid "Parties"
    304308msgstr "Parteien"
     
    306310#: includes/admin/post_type-voting.php:37
    307311#: includes/admin/post_type-voting.php:53
    308 #: includes/admin/post_type-voting.php:220 wp-open-votomat.php:354
     312#: includes/admin/post_type-voting.php:220 wp-open-votomat.php:380
    309313msgid "Questions"
    310314msgstr "Fragen"
     
    485489msgstr "Nicht erlaubt!"
    486490
    487 #: wp-open-votomat.php:269
     491#: wp-open-votomat.php:242
     492msgid "The link was copied!"
     493msgstr "Der Link wurde kopiert!"
     494
     495#: wp-open-votomat.php:295
    488496msgid "WPOV Footer Menu"
    489497msgstr "WPOV Fußmenü"
    490498
    491 #: wp-open-votomat.php:323 wp-open-votomat.php:356 wp-open-votomat.php:387
     499#: wp-open-votomat.php:349 wp-open-votomat.php:382 wp-open-votomat.php:413
    492500msgid "Add New"
    493501msgstr "Neue hinzufügen"
    494502
    495 #: wp-open-votomat.php:324
     503#: wp-open-votomat.php:350
    496504msgid "Add New Party"
    497505msgstr "Neue Partei hinzufügen"
    498506
    499 #: wp-open-votomat.php:325
     507#: wp-open-votomat.php:351
    500508msgid "Edit Party"
    501509msgstr "Partei bearbeiten"
    502510
    503 #: wp-open-votomat.php:326
     511#: wp-open-votomat.php:352
    504512msgid "New Party"
    505513msgstr "Neue Partei"
    506514
    507 #: wp-open-votomat.php:327
     515#: wp-open-votomat.php:353
    508516msgid "View Party"
    509517msgstr "Partei ansehen"
    510518
    511 #: wp-open-votomat.php:328
     519#: wp-open-votomat.php:354
    512520msgid "Search Parties"
    513521msgstr "Nach Partei suchen"
    514522
    515 #: wp-open-votomat.php:329
     523#: wp-open-votomat.php:355
    516524msgid "No Parties found"
    517525msgstr "Keine Partei gefunden"
    518526
    519 #: wp-open-votomat.php:330
     527#: wp-open-votomat.php:356
    520528msgid "No Parties found in Trash"
    521529msgstr "Keine Partei im Papierkorb gefunden"
    522530
    523 #: wp-open-votomat.php:357
     531#: wp-open-votomat.php:383
    524532msgid "Add New Question"
    525533msgstr "Neue Frage hinzufügen"
    526534
    527 #: wp-open-votomat.php:358
     535#: wp-open-votomat.php:384
    528536msgid "Edit Question"
    529537msgstr "Frage bearbeiten"
    530538
    531 #: wp-open-votomat.php:359
     539#: wp-open-votomat.php:385
    532540msgid "New Question"
    533541msgstr "Neue Frage"
    534542
    535 #: wp-open-votomat.php:360
     543#: wp-open-votomat.php:386
    536544msgid "View Question"
    537545msgstr "Frage ansehen"
    538546
    539 #: wp-open-votomat.php:361
     547#: wp-open-votomat.php:387
    540548msgid "Search Questions"
    541549msgstr "Nach Fragen suchen"
    542550
    543 #: wp-open-votomat.php:362
     551#: wp-open-votomat.php:388
    544552msgid "No Questions found"
    545553msgstr "Keine Fragen gefunden"
    546554
    547 #: wp-open-votomat.php:363
     555#: wp-open-votomat.php:389
    548556msgid "No Questions found in Trash"
    549557msgstr "Keine Fragen im Papierkorb gefunden"
    550558
    551 #: wp-open-votomat.php:385
     559#: wp-open-votomat.php:411
    552560msgid "Votings"
    553561msgstr "Wahlen"
    554562
    555 #: wp-open-votomat.php:386
     563#: wp-open-votomat.php:412
    556564msgid "Voting"
    557565msgstr "Wahl"
    558566
    559 #: wp-open-votomat.php:388
     567#: wp-open-votomat.php:414
    560568msgid "Add New Voting"
    561569msgstr "Neue Wahl hinzufügen"
    562570
    563 #: wp-open-votomat.php:389
     571#: wp-open-votomat.php:415
    564572msgid "Edit Voting"
    565573msgstr "Wahl bearbeiten"
    566574
    567 #: wp-open-votomat.php:390
     575#: wp-open-votomat.php:416
    568576msgid "New Voting"
    569577msgstr "Neue Wahl"
    570578
    571 #: wp-open-votomat.php:391
     579#: wp-open-votomat.php:417
    572580msgid "View Voting"
    573581msgstr "Wahl ansehen"
    574582
    575 #: wp-open-votomat.php:392
     583#: wp-open-votomat.php:418
    576584msgid "Search Votings"
    577585msgstr "Wahlen suchen"
    578586
    579 #: wp-open-votomat.php:393
     587#: wp-open-votomat.php:419
    580588msgid "No Votings found"
    581589msgstr "Keine Wahlen gefunden"
    582590
    583 #: wp-open-votomat.php:394
     591#: wp-open-votomat.php:420
    584592msgid "No Votings found in Trash"
    585593msgstr "Keine Wahlen im Papierkorb gefunden"
    586594
    587 #: wp-open-votomat.php:441
     595#: wp-open-votomat.php:467
    588596msgid "WP Open Votomat Sidebar"
    589597msgstr "WP Open Votomat Seitenspalte"
    590598
    591 #: wp-open-votomat.php:489
     599#: wp-open-votomat.php:515
    592600#, php-format
    593601msgid "Class »%s« exists!"
  • wp-open-votomat/trunk/wp-open-votomat.php

    r2066999 r2067231  
    44 * Description: This plugin allows you to use your website as a voting advice application.
    55 * Author: magma design studio
    6  * Version: 0.0.9
     6 * Version: 0.0.10
    77 * Author URI: https://magmadesignstudio.de
    88 * Text Domain: wpov
     
    2828define( 'WPOV__PLUGIN_NAME_SLUG', 'wp-open-votomat' );
    2929
    30 define( 'WPOV_VERSION', '0.0.9' );
     30define( 'WPOV_VERSION', '0.0.10' );
    3131define( 'WPOV__MINIMUM_WP_VERSION', '4.0' );
    3232define( 'WPOV__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     
    236236            if($wpov_css = $this->get_setting('admin_settings')['wpov_css']) {
    237237                wp_add_inline_style( 'wpov-custom-css', $wpov_css );
    238             }           
    239            
    240            
     238            }     
     239           
     240            wp_enqueue_script( 'wpov-base', WPOV__PLUGIN_DIR_URL . 'assets/js/wpov.js', array(  ), WPOV_VERSION, true );   
     241           
     242            $this->register_js_translation('The link was copied!');
     243           
     244            wp_add_inline_script( 'wpov-base', sprintf('var wpov = %s', json_encode(array(
     245                'wp' => array(
     246                    'WPLANG' => get_option('WPLANG'),
     247                ),
     248                'translations' => $this->get_js_translations()
     249            ))), 'before'); 
     250           
     251        }
     252       
     253        function register_js_translation($text) {
     254            global $wpov_string_translations;
     255           
     256            if(empty($wpov_string_translations)) {
     257                $wpov_string_translations = array();
     258            }
     259           
     260            $wpov_string_translations[$text] = __($text, WPOV__PLUGIN_NAME_SLUG);
     261        }
     262       
     263        function get_js_translations() {
     264            global $wpov_string_translations;
     265           
     266            return $wpov_string_translations;
    241267        }
    242268       
  • wp-open-votomat/trunk/wpov_template/twentynineteen/assets/js/app.js

    r2053270 r2067231  
    2828                $input.trigger(triggerSelect);
    2929                document.execCommand("copy");
     30                alert(wpov_translate('The link was copied!'));
    3031            })
    3132        });
  • wp-open-votomat/trunk/wpov_template/twentynineteen/page.php

    r2060854 r2067231  
    1717$templates = array( 'page.twig' );
    1818
     19$context['override_current_voter'] = false;
     20
    1921if(in_array(get_query_var( 'post_type' ), array('wpov-voting', 'wpov-question'))) {
    2022    global $wpov_post_voting;
    2123    global $wpov_post_question;   
    22    
    23    
     24       
    2425    $wpov_post_voting = $voting = $context['post_voting'] = $context['post'] = wpov_get_post($post);   
    2526   
    26     if(get_query_var( 'wpov-result' )) {
     27    if(get_query_var( 'wpov-result' )) {       
    2728        if($wpov_voter_result = get_query_var( 'wpov-voter-result' )) {
     29
    2830            if($voter = new wpov_voter(array(
    2931                'post_name__in' => array($wpov_voter_result)
    3032            ))) {
    31                 $context['current_voter'] = $voter;
     33                $context['override_current_voter'] = $voter;
    3234            }
    33            
    34             //$context['current_voter'] =
    3535        }
    3636       
  • wp-open-votomat/trunk/wpov_template/twentynineteen/twig/home.twig

    r2066999 r2067231  
    7373        <div class="col-{{ columns_small }} col-sm-{{ columns_medium }}">
    7474            {% if sponsor.column_headline %}
    75             <h4 class="mb-4">{{ sponsor.column_headline }}</h4>
     75            <p class="mb-4 h6">{{ sponsor.column_headline }}</p>
    7676            {% endif %}   
    7777            <a href="{{ sponsor.url }}" target="_blank">
  • wp-open-votomat/trunk/wpov_template/twentynineteen/twig/page-voting-result.twig

    r2066999 r2067231  
    55    <div class="card mb-3">
    66        <div class="card-body">
    7             <h3 class="card-title">{{ __('The result', WPOV__PLUGIN_NAME_SLUG) }}</h3>
     7            <h3 class="card-title">
     8                {% if not override_current_voter %}
     9                    {{ __('The result', WPOV__PLUGIN_NAME_SLUG) }}
     10                {% else %}
     11                    {{ __('The result someone send you', WPOV__PLUGIN_NAME_SLUG) }}
     12                {% endif %}
     13            </h3>
    814            <table class="table card-text sortable">
    915                <thead>
     
    1521                </thead>
    1622                <tbody>
     23                    {% if override_current_voter %}
     24                        {% set current_voter = override_current_voter %}
     25                    {% else %}
     26                        {% set current_voter = current_voter() %}
     27                    {% endif %}
    1728
    1829                    {% for party in post_voting.parties() %}
    19                     {% set party_user_consensus = party.party_user_consensus(post_voting.get_id()) %}
    20                     {% set count_questions = current_voter().count_votes(post_voting.get_id()) %}
     30                    {% set party_user_consensus = party.party_user_consensus(post_voting.get_id(), override_current_voter) %}
     31                    {% set count_questions = current_voter.count_votes(post_voting.get_id()) %}
    2132
    2233
     
    5869        </div>
    5970    </div>
    60     <a class="btn btn-primary btn-sm" href="{{ post_voting.compare_link() }}">{{ __('Your answers compared to those of the parties', WPOV__PLUGIN_NAME_SLUG) }}</a>
     71    {% if not override_current_voter %}
     72    <a class="btn btn-primary btn-sm" href="{{ post_voting.compare_link() }}">
     73            {{ __('Your answers compared to those of the parties', WPOV__PLUGIN_NAME_SLUG) }}
     74    </a>
     75    {% endif %}
    6176    <div class="mt-3 text-center">
    6277        <p>
    63             {{ __('By clicking on the logos you come to the websites of the parties.<br />With the following link you can share your result with others:', WPOV__PLUGIN_NAME_SLUG) }}
     78            {{ __('By clicking on the logos you come to the websites of the parties.', WPOV__PLUGIN_NAME_SLUG) }}
    6479        </p>   
     80        {% if not override_current_voter %}
     81        <p>
     82            {{ __('With the following link you can share your result with others:', WPOV__PLUGIN_NAME_SLUG) }}
     83        </p>           
    6584        <div class="input-group mb-3">
    6685            <input id="wpov_direct_link" readonly value="{{ current_voter().result_public_link() }}" type="text" class="form-control" />
     
    7089                </button>
    7190            </div>
    72         </div>       
     91        </div> 
     92        {% endif %}
    7393    </div>
    7494{% endblock %}
Note: See TracChangeset for help on using the changeset viewer.