Plugin Directory

Changeset 1914280


Ignore:
Timestamp:
07/24/2018 04:53:18 PM (8 years ago)
Author:
thrivehive
Message:

mygitbranch

Location:
thrivehive/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • thrivehive/trunk/README.md

    r1896065 r1914280  
    3838 - customers.thrivehivesite.com
    3939 - customers2.thrivehivesite.com
    40  - customers3.thrivehivesite.com.
     40 - customers3.thrivehivesite.com
     41 - customers4.thrivehivesite.com
    4142
    4243 Creds for these can be accessed from AWS EC2.
     
    49506. These scripts may run for a while, but once they are done, all plugins should be up to date!
    5051
     52Here's a simple script to replicate this process:
     53
     54```
     55cd ~/thrivehive/repos/warp-prism
     56zip -r /tmp/thrivehive.zip .
     57for c in customers customers2 customers3 customers4; do
     58  server="${c}.thrivehivesite.com"
     59  scp /tmp/thrivehive.zip $server:/tmp/
     60  ssh $server "cp /tmp/thrivehive.zip /root/plugins/"
     61  ssh $server "unzip -o /tmp/thrivehive.zip -d /root/cpanel3-skel/public_html/wp-content/plugins/thrivehive/"
     62  ssh $server "/scripts/update_thrivehive_plugin.py"
     63done
     64```
     65
     66## Update the Subversion Repo
     67svn co https://plugins.svn.wordpress.org/thrivehive
     68cp -a ~/thrivehive/repos/warp-prism/. thrivehive/trunk/
     69
    5170## Screenshots
    5271
     
    5473
    5574## Changelog
     75* V 2.1 Added endpoint to search for Global Styling categories and values
    5676* V 2.0 Enable support for new ThriveHive website editor
    5777* V 1.138 Return th_editor on get_posts
  • thrivehive/trunk/controllers/changeling.php

    r1896065 r1914280  
    1010*/
    1111class JSON_API_Changeling_Controller {
     12   
     13  private function config_key_indices() {
     14    $NAME_KEY_INDEX = 0;
     15    $CATEGORY_KEY_INDEX = 1;
     16    $NICE_NAME_KEY_INDEX = 2;
     17    $ACCESS_LEVEL_KEY_INDEX = 3;
     18     
     19    return array("name" => $NAME_KEY_INDEX, "category" => $CATEGORY_KEY_INDEX, "nice_name" => $NICE_NAME_KEY_INDEX, "access_level" => $ACCESS_LEVEL_KEY_INDEX);
     20  }
    1221
    1322  /**
     
    135144    $theme_dir_uri = get_stylesheet_directory_uri();
    136145    $category = $_REQUEST['category'];
     146    $query = $_REQUEST['query'];
    137147
    138148    if (isset($category)) {
     
    145155    $theme_config_contents = file_get_contents($theme_config_full_path);
    146156
     157    if (isset($query)) {
     158      $theme_config_data = json_decode($theme_config_contents);
     159      $filtered_data = array('keys' => $theme_config_data -> keys);
     160      $filtered_vars = array();
     161      $keys = $this -> config_key_indices();
     162      foreach ($theme_config_data -> vars as $var) {
     163        if ($this -> data_contains_query($var, $query)) {
     164          $filtered_vars[] = $var;
     165        }
     166      }
     167      $filtered_data['vars'] = $filtered_vars;
     168
     169      return array(
     170        'themeConfig' => $filtered_data,
     171        'category' => $category
     172      );
     173    }
     174
    147175    return array(
    148176      'themeConfig' => $theme_config_contents,
     
    165193    );
    166194  }
     195   
     196  /**
     197  *@api
     198  **/
     199  public function filter_bootstrap_categories(){
     200    global $json_api;
     201    $theme_dir_uri = get_stylesheet_directory_uri();
     202    $theme_config_path = '/config/theme-config.json';
     203    $query = $_REQUEST['query'];
     204   
     205    if (!isset($query)) {
     206      $query = '';
     207    }
     208    $theme_config_full_path = $theme_dir_uri . $theme_config_path;
     209    $theme_config_contents = file_get_contents($theme_config_full_path);
     210    $theme_config_data = json_decode($theme_config_contents);
     211
     212    $filtered_categories = array();
     213      $keys = $this -> config_key_indices();
     214    foreach ($theme_config_data -> vars as $var) {
     215      if ($this -> data_contains_query($var, $query)) {
     216        $cur_category = $var[$keys['category']];
     217        $new_access_level = $var[$keys['access_level']];
     218
     219        // If the category does not yet exist or we find a variable within it that has
     220        // a higher access level, set the category's access level to the current variable
     221        if (!array_key_exists($cur_category, $filtered_categories) ||
     222        $new_access_level > ($filtered_categories[$cur_category]['accessLevel'])) {
     223          $filtered_categories[$cur_category] = array('accessLevel' => $new_access_level);
     224        };
     225      }
     226    }
     227    return array(
     228      'filteredCategories' => $filtered_categories
     229    );
     230  }
     231
     232  private function data_contains_query($var, $query){
     233    $keys = $this -> config_key_indices();
     234    if ($query === '') {
     235      return true;
     236    }
     237    $result = false;
     238
     239    $keys_to_check = array('name', 'nice_name', 'category');
     240    foreach ($keys_to_check as $key) {
     241      if (stripos($var[$keys[$key]], $query) !== false) {
     242        $result = true;
     243      }
     244    }
     245     
     246    return $result;
     247  }
    167248}
    168249
  • thrivehive/trunk/controllers/posts.php

    r1896065 r1914280  
    926926
    927927    if(!$image_id){
    928       if(!has_header_image()){
    929         return array("featured_image" => null);
    930       }
    931       $data = get_object_vars(get_theme_mod('header_image_data'));
    932       $attachment_id = $data['attachment_id'];
    933       $image_id = $attachment_id;
     928      return array("featured_image" => null);
    934929    }
    935930
     
    947942
    948943    return array();
     944  }
     945
     946  public function get_global_header_image(){
     947    global $json_api;
     948
     949    $header_image_url = has_header_image() ? get_header_image() : null;
     950    $header_image_enabled = get_theme_mod(CHANGELING_DISPLAY_HERO_SETTING, true);
     951
     952    return array("global_header_image" => $header_image_url, "global_header_enabled" => $header_image_enabled);
    949953  }
    950954
  • thrivehive/trunk/thrivehive.php

    r1896065 r1914280  
    55   *Plugin URI: http://thrivehive.com
    66   *Description: A plugin to include ThriveHive's tracking code
    7    *Version: 2.0
     7   *Version: 2.1
    88   *Author: ThriveHive
    99   *Author URI: http://thrivehive.com
     
    1515define( 'TH_PLUGIN_ROOT', dirname(__FILE__) );
    1616define( 'TH_WYSIWYG_THEME_NAME', 'Changeling' );
     17define( 'CHANGELING_DISPLAY_HERO_SETTING', 'changeling_display_hero_setting' );
    1718
    1819@include_once TH_PLUGIN_ROOT . "/singletons/api.php";
     
    14331434       echo "<div class='phone-number widget'>";
    14341435       echo "<div class='widget-wrap'>";
    1435        echo "<h4 class='heading'>$heading</h4>";
    1436        echo "<a class='phone-number-text' href='tel:$safe_num'>$num</a>";
     1436       if (!empty($heading)) {
     1437        echo "<h4 class='heading'>$heading</h4>";
     1438       }
     1439       echo "<a class='phone-number-text' href='tel:+1-$safe_num'>$num</a>";
    14371440       echo "</div>";
    14381441       echo "</div>";
     
    14791482     $safe_num = preg_replace('/[^\d]/','', $number);
    14801483     $trunc_num = substr($safe_num, 0, 10);
    1481 
    1482      return $trunc_num;
     1484     $hyphen_num = substr_replace($trunc_num, '-', 3, 0);
     1485     $hyphen_num = substr_replace($hyphen_num, '-', 7, 0);
     1486
     1487     return $hyphen_num;
    14831488    }
    14841489
Note: See TracChangeset for help on using the changeset viewer.