Plugin Directory

Changeset 2940918


Ignore:
Timestamp:
07/20/2023 03:23:49 PM (3 years ago)
Author:
danstanhope
Message:

checking for username initial load

Location:
expertfile-expert-content-templates/trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • expertfile-expert-content-templates/trunk/expertfile.php

    r2893860 r2940918  
    1111 * Plugin URI:        https://expertfile.com/wordpress
    1212 * Description:       The easiest most powerful way to add expert content to your website from directories to profiles & more...
    13  * Version:           1.0.33
     13 * Version:           1.0.34
    1414 * Author:            ExpertFile
    1515 * Author URI:        https://expertfile.com
     
    2424}
    2525
    26 define( 'EXPERTFILE_VERSION', '1.0.12' );
     26define( 'EXPERTFILE_VERSION', '1.0.13' );
    2727define( 'EXPERTFILE_PLUGIN_NAME', 'expertfile' );
    2828define( 'EXPERTFILE_API_ENDPOINT', 'https://public-api.expertfile.com' );
  • expertfile-expert-content-templates/trunk/public/class-expertfile-public.php

    r2893860 r2940918  
    484484        $profile_page_url = ($profile_page_url == "" ? $url_options['profile-url'] : $profile_page_url);
    485485
    486         if (is_null($post_id)) {
     486        if (!isset($post_id)) {
    487487            return;
    488488        }
     
    624624        $post_id =  $qs['id'] ?? get_query_var('id') ?? null;;
    625625
    626         if (is_null($post_id)) {
     626        if (!isset($post_id)) {
    627627            return;
    628628        }
     
    10971097        $id = $options['organization-id'];
    10981098
    1099         if (is_null($id) || is_null($secret) || is_null($id)) {
     1099        if (!isset($id) || !isset($secret) || !isset($id)) {
    11001100            return;
    11011101        }
  • expertfile-expert-content-templates/trunk/public/classes/Api.php

    r2833229 r2940918  
    1212    function set_token($token)
    1313    {
    14         if (is_null($token)) {
     14        if (!isset($token)) {
    1515            return;
    1616        }
     
    2323    function make_request($token = null, $url, $params = [], $type = 'GET')
    2424    {
    25         if (is_null($token)) {
     25        if (!isset($token)) {
    2626            $token = $this->get_oauth_2_token($this->client_id, $this->client_secret);
    2727
  • expertfile-expert-content-templates/trunk/public/classes/Design.php

    r2695500 r2940918  
    1515        $token
    1616    ) {
    17         if (is_null($this->organization_id)) {
     17        if (!isset($this->organization_id)) {
    1818            return;
    1919        }
  • expertfile-expert-content-templates/trunk/public/classes/Expert.php

    r2759416 r2940918  
    2727       
    2828
    29         if (is_null($this->organization_id)) {
     29        if (!isset($this->organization_id)) {
    3030            return;
    3131        }
     
    7171        $q
    7272    ) {
    73         if (is_null($this->organization_id)) {
     73        if (!isset($this->organization_id)) {
    7474            return;
    7575        }
     
    9191    ) {
    9292       
    93         if (is_null($this->organization_id) || is_null($username)) {
     93        if (!isset($this->organization_id) || !isset($username)) {
    9494            return;
    9595        }
     
    105105        $username
    106106    ) {
    107         if (is_null($this->organization_id) || is_null($username)) {
     107        if (!isset($this->organization_id) || !isset($username)) {
    108108            return;
    109109        }
     
    123123        $page_size
    124124    ) {
    125         if (is_null($this->organization_id) || is_null($username)) {
     125        if (!isset($this->organization_id) || !isset($username)) {
    126126            return;
    127127        }
  • expertfile-expert-content-templates/trunk/public/classes/ExpertAnswer.php

    r2695500 r2940918  
    1515    public function get_expert_answers($token, $tags, $page_size, $page_number)
    1616    {
    17         if (is_null($this->organization_id)) {
     17        if (!isset($this->organization_id)) {
    1818            return;
    1919        }
     
    4141        $post_id
    4242    ) {
    43         if (is_null($this->organization_id) || is_null($post_id)) {
     43        if (!isset($this->organization_id) || !isset($post_id)) {
    4444            return;
    4545        }
  • expertfile-expert-content-templates/trunk/public/classes/Inquiry.php

    r2695500 r2940918  
    1515        $token
    1616    ){
    17         if (is_null($this->organization_id)) {
     17        if (!isset($this->organization_id)) {
    1818            return;
    1919        }
     
    2929        $parameters
    3030    ){
    31         if (is_null($this->organization_id)) {
     31        if (!isset($this->organization_id)) {
    3232            return;
    3333        }
  • expertfile-expert-content-templates/trunk/public/classes/Sitemap.php

    r2893860 r2940918  
    1818        $parameters
    1919    ) {
    20         if (is_null($this->organization_id)) {
     20        if (!isset($this->organization_id)) {
    2121            return;
    2222        }
  • expertfile-expert-content-templates/trunk/public/classes/Spotlight.php

    r2695500 r2940918  
    1616        $post_id
    1717    ){
    18         if (is_null($this->organization_id) || is_null($post_id)) {
     18        if (!isset($this->organization_id) || !isset($post_id)) {
    1919            return;
    2020        }
     
    3535    ){
    3636
    37         if (is_null($this->organization_id)) {
     37        if (!isset($this->organization_id)) {
    3838            return;
    3939        }
  • expertfile-expert-content-templates/trunk/public/classes/Utils.php

    r2836218 r2940918  
    6060    {
    6161
    62         if (is_null($url) || is_null($identifier) || is_null($type)) return "";
     62        if (!isset($url) || !isset($identifier) || !isset($type)) return "";
    6363        $encoded_pattern = '/{{encoded}}/';
    6464
  • expertfile-expert-content-templates/trunk/public/js/analytic.ly.js

    r2695500 r2940918  
    1 !function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){!function(e){function t(){var r=this;return t.prototype.TYPES={DIRECTORY:"directory",USER:"user",SPOTLIGHT:"spotlight",QANDA:"qanda"},t.prototype.getQueryStringParameter=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+e+"=([^&#]*)"),n=r.exec(t.toLowerCase());return null===n?"":decodeURIComponent(n[1].replace(/\+/g," "))},t.prototype.buildQueryString=function(e){return Object.keys(e).map(function(t){return encodeURI(t)+"="+encodeURIComponent(JSON.stringify(e[t]))}).join("&")},t.prototype.track=function(t){t.source||(t.source="corpapi");var n=new XMLHttpRequest,a="https://public-api.expertfile.com";if(delete t.url,"corpapi"===t.source){t.asset_type||(t.asset_type="directory");if(!{directory:!0,user:!0,spotlight:!0}[t.asset_type])return;t.referrer=document.referrer?document.referrer:"direct",t.attr||(t.attr={}),t.attr.page_url=t.page_url||e.location.href,t.asset_type="user"===t.asset_type?"featured":t.asset_type,a=a+"/v2/analytics/corpapi/"+t.asset_type,delete t.asset_type}else if("embed"===t.source){if(!t.attr)return;a=a+"/v2/analytics/embed/"+t.attr.theme+"/"+t.attr.template}else if("expertfile"===t.source){if(!t.attr)return;a="spotlight"===t.asset_type?a+"/v2/analytics/spotlight/"+t.attr.corporation+"/"+t.attr.postid:"qanda"===t.asset_type?a+"/v2/analytics/qanda/"+t.attr.corporation+"/"+t.attr.questionid:a+"/v2/analytics/"+t.attr.username}var o=r.buildQueryString(t);n.open("GET",a+"?"+o),n.send()},this}void 0===e.analyticly&&(e.analyticly=new t)}(window)}]);
     1(function (window) {
     2    function analyticly() {
     3        var _analyticly = this;
     4
     5        analyticly.prototype.TYPES = {
     6            DIRECTORY: 'directory',
     7            USER: 'user',
     8            SPOTLIGHT: 'spotlight',
     9            QANDA: 'qanda'
     10        };
     11
     12        analyticly.prototype.getQueryStringParameter = function (name, url) {
     13            name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
     14
     15            var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),
     16                results = regex.exec(url.toLowerCase());
     17
     18            return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
     19        };
     20
     21        analyticly.prototype.buildQueryString = function (params) {
     22            return Object.keys(params)
     23                .map(function (k) { return encodeURI(k) + '=' + encodeURIComponent(JSON.stringify(params[k])); })
     24                .join('&');
     25        };
     26
     27        analyticly.prototype.track = function (params) {
     28            if (!params.source) params.source = 'corpapi';
     29
     30            var xhr = new XMLHttpRequest(),
     31                url = 'http://public_api.local.expertfile.com:8078';
     32
     33            delete params['url'];
     34
     35            if (params.source === 'corpapi') {
     36                if (!params.asset_type) params.asset_type = 'directory';
     37
     38                var routes = {
     39                    'directory': true,
     40                    'user': true,
     41                    'spotlight': true,
     42                    'qanda': true
     43                };
     44
     45                if (!routes[params.asset_type]) return;
     46
     47                params.referrer = document.referrer ? document.referrer : 'direct';
     48
     49                if (!params.attr) params.attr = {};
     50
     51                params.attr.page_url = params.page_url || window.location.href;
     52                params.asset_type = params.asset_type === 'user' ? 'featured' : params.asset_type;
     53
     54                url = url + '/v2/analytics/corpapi/' + params.asset_type;
     55
     56                delete params['asset_type'];
     57            } else if (params.source === 'embed') {
     58                if (!params.attr) return;
     59
     60                url = url + '/v2/analytics/embed/' + params.attr.theme + '/' + params.attr.template;
     61            } else if (params.source === 'expertfile') {
     62                if (!params.attr) return;
     63
     64                if (params.asset_type === 'spotlight') {
     65                    url = url + '/v2/analytics/spotlight/' + params.attr.corporation + '/' + params.attr.postid;
     66                } else if (params.asset_type === 'qanda') {
     67                    url = url + '/v2/analytics/qanda/' + params.attr.corporation + '/' + params.attr.questionid;
     68                } else {
     69                    url = url + '/v2/analytics/' + params.attr.username;
     70                }
     71            }
     72
     73            var query = _analyticly.buildQueryString(params);
     74
     75            xhr.open('GET', url + '?' + query);
     76            xhr.send();
     77        };
     78
     79        return this;
     80    }
     81
     82    if (typeof (window.analyticly) === 'undefined') {
     83        window.analyticly = new analyticly();
     84    }
     85})(window);
  • expertfile-expert-content-templates/trunk/public/js/expertanswer.js

    r2787175 r2940918  
    99
    1010            Share();
    11             Track('expertanswer');
     11            Track('qanda');
    1212        },
    1313        search: () => {
  • expertfile-expert-content-templates/trunk/public/js/spotlight.js

    r2787175 r2940918  
    55    spotlight: {
    66        init: () => {
     7 
    78            expertfile.spotlight.search();
    89            expertfile.spotlight.setIframeHeight();
  • expertfile-expert-content-templates/trunk/public/js/util.js

    r2787175 r2940918  
    583583
    584584export const Track = (type) => {
     585
    585586    let obj = {};
    586587    let corporate_username = document.querySelector('#expertfile-corp-username')?.value;
    587588    let username = document.querySelector('#expertfile-username')?.value;
    588589    let spotlightId = document.querySelector('#spotlight-id')?.value;
    589     let expertanswerId = document.querySelector('#expertanswer-id')?.value;
     590    let expertanswerId = document.querySelector('#qanda-id')?.value;
    590591
    591592    switch (type) {
     
    601602            }
    602603            break;
    603         case 'expertanswer':
     604        case 'qanda':
    604605            obj = {
    605606                asset_type: analyticly.TYPES.QANDA,
     
    628629            break;
    629630    }
     631
    630632    analyticly.track(obj);
    631633};
  • expertfile-expert-content-templates/trunk/public/partials/expert/directory.php

    r2833229 r2940918  
    190190                <h2 class="exfl-sr-only">Filters</h2>
    191191                <div class="clearfix">
    192                     <div class="exfl-text-sm exfl-float-right">
    193                         <button id="sm-filter-heading" type="button" class="lg:exfl-hidden exfl-inline-flex exfl-items-center exfl-px-4 exfl-py-2 exfl-border exfl-shadow-sm exfl-text-base exfl-font-medium exfl-border exfl-border-gray-200 exfl-rounded-md focus:exfl-outline-none focus:exfl-ring-2 focus:exfl-gray-offset-2 focus:exfl-ring-gray-400">
    194                             <span>Show Filters</span>
    195                             <svg class="exfl-flex-none exfl-w-5 exfl-h-5 exfl-ml-2 exfl-mr-2 exfl-text-gray-400 group-hover:exfl-text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
    196                                 <path fill-rule="evenodd" d="M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z" clip-rule="evenodd" />
    197                             </svg>
    198                         </button>
     192                   
     193                    <div id="sm-filter-heading" class="exfl-text-sm exfl-float-right">
     194                        <?php if (count($filter_state['filters']) > 0) { ?>
     195                            <button type="button" class="lg:exfl-hidden exfl-inline-flex exfl-items-center exfl-px-4 exfl-py-2 exfl-border exfl-shadow-sm exfl-text-base exfl-font-medium exfl-border exfl-border-gray-200 exfl-rounded-md focus:exfl-outline-none focus:exfl-ring-2 focus:exfl-gray-offset-2 focus:exfl-ring-gray-400">
     196                                <span>Show Filters</span>
     197                                <svg class="exfl-flex-none exfl-w-5 exfl-h-5 exfl-ml-2 exfl-mr-2 exfl-text-gray-400 group-hover:exfl-text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
     198                                    <path fill-rule="evenodd" d="M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z" clip-rule="evenodd" />
     199                                </svg>
     200                            </button>
     201                        <?php } ?>
    199202                    </div>
    200203                </div>
  • expertfile-expert-content-templates/trunk/public/partials/expert/profile.php

    r2798968 r2940918  
    514514                                                    <h3 class="exfl-my-0 exfl-text-xl exfl-font-semibold exfl-text-gray-900 exfl-normal-case"><?php echo esc_attr($accomplishment->title) ?></h3>
    515515                                                <?php    } ?>
    516                                                 <?php if (!is_null($accomplishment->start) && trim(date('Y-m-d', $accomplishment->start)) != "1970-01-01") { ?>
     516                                                <?php if (isset($accomplishment->start) && trim(date('Y-m-d', $accomplishment->start)) != "1970-01-01") { ?>
    517517                                                    <p class="exfl-my-0">
    518518                                                        <svg class="exfl-h-3 exfl-w-3 exfl-inline" fill="none" viewBox="0 0 24 24" stroke="currentColor">
     
    522522                                                    </p>
    523523                                                <?php    } ?>
    524                                                 <?php if (!is_null($accomplishment->description)) { ?>
     524                                                <?php if (isset($accomplishment->description)) { ?>
    525525                                                    <p class="exfl-my-0"><?php echo esc_attr($accomplishment->description) ?></p>
    526526                                                <?php    } ?>
  • expertfile-expert-content-templates/trunk/public/partials/expertanswer/post.php

    r2798968 r2940918  
    182182                </div>
    183183            </div>
    184             <input type="hidden" id="question-id" value="<?php echo esc_attr($question->id) ?>">
     184            <input type="hidden" id="qanda-id" value="<?php echo esc_attr($question->id) ?>">
    185185            <input type="hidden" id="expertfile-corp-username" value="<?php echo esc_attr($organization_username) ?>">
    186186            <a href="https://expertfile.com/" target="_blank" class="exfl-mt-8 exfl-no-underline hover:exfl-opacity-50 exfl-flex exfl-items-center exfl-text-base exfl-text-white exfl-justify-end <?php echo filter_var(esc_attr($show_powered_by), FILTER_VALIDATE_BOOLEAN) ? "exfl-block" : "exfl-hidden" ?>">
Note: See TracChangeset for help on using the changeset viewer.