Changeset 1914280
- Timestamp:
- 07/24/2018 04:53:18 PM (8 years ago)
- Location:
- thrivehive/trunk
- Files:
-
- 4 edited
-
README.md (modified) (3 diffs)
-
controllers/changeling.php (modified) (4 diffs)
-
controllers/posts.php (modified) (2 diffs)
-
thrivehive.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thrivehive/trunk/README.md
r1896065 r1914280 38 38 - customers.thrivehivesite.com 39 39 - customers2.thrivehivesite.com 40 - customers3.thrivehivesite.com. 40 - customers3.thrivehivesite.com 41 - customers4.thrivehivesite.com 41 42 42 43 Creds for these can be accessed from AWS EC2. … … 49 50 6. These scripts may run for a while, but once they are done, all plugins should be up to date! 50 51 52 Here's a simple script to replicate this process: 53 54 ``` 55 cd ~/thrivehive/repos/warp-prism 56 zip -r /tmp/thrivehive.zip . 57 for 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" 63 done 64 ``` 65 66 ## Update the Subversion Repo 67 svn co https://plugins.svn.wordpress.org/thrivehive 68 cp -a ~/thrivehive/repos/warp-prism/. thrivehive/trunk/ 69 51 70 ## Screenshots 52 71 … … 54 73 55 74 ## Changelog 75 * V 2.1 Added endpoint to search for Global Styling categories and values 56 76 * V 2.0 Enable support for new ThriveHive website editor 57 77 * V 1.138 Return th_editor on get_posts -
thrivehive/trunk/controllers/changeling.php
r1896065 r1914280 10 10 */ 11 11 class 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 } 12 21 13 22 /** … … 135 144 $theme_dir_uri = get_stylesheet_directory_uri(); 136 145 $category = $_REQUEST['category']; 146 $query = $_REQUEST['query']; 137 147 138 148 if (isset($category)) { … … 145 155 $theme_config_contents = file_get_contents($theme_config_full_path); 146 156 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 147 175 return array( 148 176 'themeConfig' => $theme_config_contents, … … 165 193 ); 166 194 } 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 } 167 248 } 168 249 -
thrivehive/trunk/controllers/posts.php
r1896065 r1914280 926 926 927 927 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); 934 929 } 935 930 … … 947 942 948 943 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); 949 953 } 950 954 -
thrivehive/trunk/thrivehive.php
r1896065 r1914280 5 5 *Plugin URI: http://thrivehive.com 6 6 *Description: A plugin to include ThriveHive's tracking code 7 *Version: 2. 07 *Version: 2.1 8 8 *Author: ThriveHive 9 9 *Author URI: http://thrivehive.com … … 15 15 define( 'TH_PLUGIN_ROOT', dirname(__FILE__) ); 16 16 define( 'TH_WYSIWYG_THEME_NAME', 'Changeling' ); 17 define( 'CHANGELING_DISPLAY_HERO_SETTING', 'changeling_display_hero_setting' ); 17 18 18 19 @include_once TH_PLUGIN_ROOT . "/singletons/api.php"; … … 1433 1434 echo "<div class='phone-number widget'>"; 1434 1435 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>"; 1437 1440 echo "</div>"; 1438 1441 echo "</div>"; … … 1479 1482 $safe_num = preg_replace('/[^\d]/','', $number); 1480 1483 $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; 1483 1488 } 1484 1489
Note: See TracChangeset
for help on using the changeset viewer.