Changeset 1379595
- Timestamp:
- 03/26/2016 11:25:24 PM (10 years ago)
- Location:
- hercules-sentiment-analysis
- Files:
-
- 110 added
- 9 edited
-
tags/1.2.2 (added)
-
tags/1.2.2/assets (added)
-
tags/1.2.2/helpers (added)
-
tags/1.2.2/helpers/phpinsight (added)
-
tags/1.2.2/helpers/phpinsight/phpinsight.php (added)
-
tags/1.2.2/helpers/phpinsight/src (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/CHANGES (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/LICENSE (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/README.md (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/autoload.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/composer.json (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/examples (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/examples/demo.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/Autoloader.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/Sentiment.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/data (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/data/data.ign.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/data/data.neg.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/data/data.neu.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/data/data.pos.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/data/data.prefix.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/dictionaries (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/dictionaries/source.ign.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/dictionaries/source.neg.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/dictionaries/source.neu.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/dictionaries/source.pos.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/PHPInsight/dictionaries/source.prefix.php (added)
-
tags/1.2.2/helpers/phpinsight/src/php-insight/lib/bootstrap.php (added)
-
tags/1.2.2/hercules-framework (added)
-
tags/1.2.2/hercules-framework/assets (added)
-
tags/1.2.2/hercules-framework/assets/css (added)
-
tags/1.2.2/hercules-framework/assets/css/bootstrap.css (added)
-
tags/1.2.2/hercules-framework/autoload.php (added)
-
tags/1.2.2/hercules-framework/controllers (added)
-
tags/1.2.2/hercules-framework/controllers/.htaccess (added)
-
tags/1.2.2/hercules-framework/core (added)
-
tags/1.2.2/hercules-framework/core/.htaccess (added)
-
tags/1.2.2/hercules-framework/core/Controller.php (added)
-
tags/1.2.2/hercules-framework/core/Framework.php (added)
-
tags/1.2.2/hercules-framework/core/Helper.php (added)
-
tags/1.2.2/hercules-framework/core/HercAbstract.php (added)
-
tags/1.2.2/hercules-framework/core/Model.php (added)
-
tags/1.2.2/hercules-framework/core/View.php (added)
-
tags/1.2.2/hercules-framework/extras (added)
-
tags/1.2.2/hercules-framework/extras/utilities.php (added)
-
tags/1.2.2/hercules-framework/helpers (added)
-
tags/1.2.2/hercules-framework/helpers/.htaccess (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/handlebars.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Arguments.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Autoloader.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/BaseString.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Cache (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Cache.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Cache/APC.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Cache/Disk.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Cache/Dummy.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Context.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Handlebars.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper/BindAttrHelper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper/EachHelper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper/IfEqHelper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper/IfHelper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper/UnlessHelper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helper/WithHelper.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Helpers.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Loader (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Loader.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Loader/ArrayLoader.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Loader/FilesystemLoader.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Loader/InlineLoader.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Loader/StringLoader.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Parser.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/SafeString.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/String.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Template.php (added)
-
tags/1.2.2/hercules-framework/helpers/handlebars/src/Handlebars/Tokenizer.php (added)
-
tags/1.2.2/hercules-framework/helpers/string (added)
-
tags/1.2.2/hercules-framework/helpers/string/string.php (added)
-
tags/1.2.2/hercules-framework/helpers/tools (added)
-
tags/1.2.2/hercules-framework/helpers/tools/tools.php (added)
-
tags/1.2.2/hercules-framework/models (added)
-
tags/1.2.2/hercules-framework/models/.htaccess (added)
-
tags/1.2.2/hercules-framework/views (added)
-
tags/1.2.2/hercules-framework/views/.htaccess (added)
-
tags/1.2.2/models (added)
-
tags/1.2.2/models/sentiment-analysis (added)
-
tags/1.2.2/models/sentiment-analysis/sentiment-analysis.php (added)
-
tags/1.2.2/models/settings (added)
-
tags/1.2.2/models/settings/.htaccess (added)
-
tags/1.2.2/models/settings/settings.php (added)
-
tags/1.2.2/plugin.php (added)
-
tags/1.2.2/readme.txt (added)
-
tags/1.2.2/start.php (added)
-
tags/1.2.2/views (added)
-
tags/1.2.2/views/sentiment-analysis (added)
-
tags/1.2.2/views/sentiment-analysis/.htaccess (added)
-
tags/1.2.2/views/sentiment-analysis/sentiment-analysis.php (added)
-
tags/1.2.2/views/sentiment-analysis/template.php (added)
-
tags/1.2.2/views/settings (added)
-
tags/1.2.2/views/settings/.htaccess (added)
-
tags/1.2.2/views/settings/settings.php (added)
-
tags/1.2.2/views/settings/template.php (added)
-
trunk/hercules-framework/core/HercAbstract.php (modified) (9 diffs)
-
trunk/hercules-framework/core/Model.php (modified) (6 diffs)
-
trunk/hercules-framework/core/View.php (modified) (16 diffs)
-
trunk/models/sentiment-analysis/sentiment-analysis.php (modified) (2 diffs)
-
trunk/models/settings/settings.php (modified) (1 diff)
-
trunk/plugin.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/views/settings/settings.php (modified) (1 diff)
-
trunk/views/settings/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hercules-sentiment-analysis/trunk/hercules-framework/core/HercAbstract.php
r1379594 r1379595 52 52 } 53 53 54 /** 55 * Turns a string into Upper Camelcase. 56 * @param $string string to upper cammel case. 57 * @return string upper camel-cased version of input string. 58 */ 54 59 function UpperCamelCaseIt( $string ) 55 60 { … … 57 62 } 58 63 64 /** 65 * Turns an upper camel-cased string into a slug with lowercase letters and hyphens for word splits. 66 * @param $string Upper camel-cased string to turn into a slug. 67 * @return string slugified version of the upper camel case input string. 68 */ 59 69 function SlugifyCamelCase( $string ) 60 70 { … … 70 80 } 71 81 82 /** 83 * Takes a class name from a class that uses this framework and turns it into a slug. 84 * @param $string Class name that is of the type HercView_something, HercModel_something, HercController_something, or HercHelper_something. 85 * @return bool|string slugified version of the class name if there was one, otherwise returns false. 86 */ 72 87 function SlugFromClassName( $string ) 73 88 { … … 80 95 } 81 96 97 /** 98 * Returns the slug for the current class instance. 99 * 100 * @return bool|string Slugified version of the class name if it knows the class, otherwise false. 101 */ 82 102 function CurrentSlug() 83 103 { … … 137 157 } 138 158 159 /** 160 * Returns the url to a specific file. 161 * @param string $file 162 * @return string url to the file supplied. 163 */ 139 164 function GetUrl( $file = '' ) 140 165 { … … 142 167 } 143 168 169 /** 170 * Returns the path to the main plugin folder for this plugin. 171 * 172 * @return string path to the plugin folder. 173 */ 144 174 function GetPluginDirectory() 145 175 { 146 return dirname( dirname( __FILE__ ) ); 147 } 148 176 return dirname( dirname( dirname( __FILE__ ) ) ); 177 } 178 179 /** 180 * Returns the path to the Hercules Framework. 181 * 182 * @return string path to the framework parent folder. 183 */ 184 function GetFrameworkDirectory() 185 { 186 return dirname( dirname( __FILE__ ) ); 187 } 188 189 /** 190 * Returns the folder name for the plugin folder for this plugin. 191 * 192 * @return string folder name for this plugin. 193 */ 149 194 function GetPluginFolderName() 150 195 { … … 155 200 } 156 201 202 /** 203 * Returns the folder name for the framework folder. 204 * 205 * @return string folder name for this framework. 206 */ 207 function GetFrameworkFolderName() 208 { 209 $plugin_folder = $this->GetFrameworkDirectory(); 210 $folder_bits = explode( DIRECTORY_SEPARATOR, $plugin_folder ); 211 212 return array_pop( $folder_bits ); 213 } 214 215 /** 216 * Returns the current page url based on / instead of having the domain. 217 * @return string 218 */ 157 219 function GetCurrentPage() 158 220 { … … 172 234 } 173 235 236 /** 237 * Adds data to the data array if it existed, otherwise makes a new data array from the input value. 238 * 239 * @param array $data array of data to add to the current data array. 240 */ 174 241 function AddToData( $data ) 175 242 { … … 180 247 $this->data = array( $this->data ); 181 248 182 $this->data = array_merge( $this->data, $data ); 249 if( is_array( $this->data ) && is_array( $data ) && !empty( $data ) ) 250 $this->data = array_merge( $this->data, $data ); 183 251 } 184 252 } -
hercules-sentiment-analysis/trunk/hercules-framework/core/Model.php
r1379591 r1379595 8 8 } 9 9 10 /** 11 * Saves the custom settings for the current model when a post is saved. 12 * 13 * @param $post_id WP will supply the post id for the current post being saved. 14 */ 10 15 function RegisterPostMetaSave( $post_id ) 11 16 { … … 14 19 } 15 20 21 /** 22 * Sets the functions that need to be run when WP is initialized. 23 */ 16 24 function Initialize() 17 25 { … … 19 27 add_action( 'save_post', array( $this, 'RegisterPostMetaSave' ) ); 20 28 21 $this->UpdateOptions(); 29 if( property_exists( $this, 'has_options' ) && !empty( $this->has_options ) ) 30 $this->UpdateOptions(); 22 31 } 23 32 33 /** 34 * Gets post meta related to the current model 35 * @param $post_id Id of post to get meta data for. 36 * @return mixed all the meta data for the current model on the provided post. 37 */ 24 38 function GetMeta( $post_id ) 25 39 { … … 27 41 } 28 42 43 /** 44 * Gets options for the current model. 45 * 46 * @return mixed all the options related to the current model. 47 */ 29 48 function GetOptions() 30 49 { … … 32 51 } 33 52 53 /** 54 * Gets individual option from the current model. 55 * @param $key Option to get value from. 56 * @return bool|mixed false if no value found, otherwise the option value for the provided key. 57 */ 34 58 function GetOption( $key ) 35 59 { … … 39 63 return !empty( $options[ $key ] ) ? $options[ $key ] : false; 40 64 else 41 return $options;65 return false; 42 66 } 43 67 68 /** 69 * Updates all the options for the current model if there is any post or get data. 70 */ 44 71 function UpdateOptions() 45 72 { -
hercules-sentiment-analysis/trunk/hercules-framework/core/View.php
r1379591 r1379595 19 19 } 20 20 21 /** 22 * This is the core view function, it actually renders stuff to the page using the Handlebars template engine. 23 * 24 * This will also add the class name to all form inputs so that form data is an array of data based on the current class name. 25 * 26 * @param array $data data to be used when rendering. 27 * @param bool|false $return If set to true then it will return the html for rendering rather than echoing it out. 28 * @return null|string no return value if $return is set to false, otherwise the html string that is created during rendering. 29 */ 21 30 function Render( $data = array(), $return = false ) 22 31 { … … 73 82 } 74 83 84 /** 85 * Creates the name attribute for form inputs based on the current class. 86 * @param $matches array of matches provided by a preg_replace_callback function 87 * @return string name attribute with the classname[] thrown around the original name. 88 */ 75 89 function AddClassNameToPostNames( $matches ) 76 90 { … … 91 105 } 92 106 107 /** 108 * Registers all scripts for the current view. 109 */ 93 110 function RegisterAllScripts() 94 111 { … … 124 141 } 125 142 143 /** 144 * Enqueues bootstrap which only works inside of .herc-bootstrap sections so that we don't interfere with other styles. 145 */ 126 146 function EnqueueBootstrap() 127 147 { 128 $this->EnqueueStyleSheet( 'assets/css/bootstrap.css', sanitize_title( $this->GetPluginFolderName() . '_bootstrap' ) ); 129 } 130 148 $this->EnqueueStyleSheet( $this->GetFrameworkFolderName() . '/assets/css/bootstrap.css', sanitize_title( $this->GetFrameworkFolderName() . '_bootstrap' ) ); 149 } 150 151 /** 152 * Registers the enqueue bootstrap function so it enqueues in the admin area and the public side. 153 */ 131 154 function IncludeBootstrap() 132 155 { … … 135 158 } 136 159 160 /** 161 * Registers metaboxes to be rendered on post edit screens. 162 */ 137 163 function RegisterMetaboxes() 138 164 { … … 154 180 } 155 181 182 /** 183 * Adds the view to the post content if it is a post add on. 184 * @param $content post content provided by WP. 185 * @return string the new post content with the view added on. 186 */ 156 187 function PostFilter( $content ) 157 188 { … … 169 200 } 170 201 202 /** 203 * Generates data to be used when rendering. 204 */ 171 205 function GenerateData() 172 206 { … … 205 239 } 206 240 241 /** 242 * Registers an options page if this is an options page view. 243 */ 207 244 function AddOptionsPage() 208 245 { … … 215 252 } 216 253 254 /** 255 * Adds columns to the posts lists tables if applicable for this view. 256 * @param $columns WP provided array of columns already being rendered. 257 * @return array columns array with our new columns added on. 258 */ 217 259 function AddPostColumns( $columns ) 218 260 { … … 222 264 } 223 265 266 /** 267 * Adds columns to the comments list table if applicable for this view. 268 * @param $columns WP provided array of columns already being rendered. 269 * @return array columns array with our new columns added on. 270 */ 224 271 function AddCommentColumns( $columns ) 225 272 { … … 229 276 } 230 277 278 /** 279 * Calculates the value for the current custom column if applicable. 280 * 281 * @param $colname name of the column currently being rendered. 282 * @param $post_id id of the post that is being rendered. 283 */ 231 284 function PostColumnValues( $colname, $post_id ) 232 285 { … … 253 306 } 254 307 308 /** 309 * Calculates the value for the current custom column if applicable. 310 * 311 * @param $colname name of the column currently being rendered. 312 * @param $post_id id of the comment that is being rendered. 313 */ 255 314 function CommentColumnValues( $colname, $post_id ) 256 315 { … … 278 337 } 279 338 339 /** 340 * Adds an admin page to WP if this is an admin page view. 341 */ 280 342 function AddAdminPage() 281 343 { … … 291 353 } 292 354 355 /** 356 * Registers a short code to be used in WP. 357 * @param array $attributes provided by WP, it is the attributes added to the shortcode. 358 * @return string HTML string of the rendered view. 359 */ 293 360 public function RegisterShortcode( $attributes = array() ) 294 361 { … … 296 363 } 297 364 365 /** 366 * Handles all the code that needs to be handled each time WP is initialized. 367 */ 298 368 function Initialize() 299 369 { … … 339 409 } 340 410 411 /** 412 * Handles adding columns and functions to process values for those columns to post list tables. 413 * 414 * @param $post_type string of the post type to process actions for. 415 */ 341 416 function RegisterPostColumn( $post_type ) 342 417 { -
hercules-sentiment-analysis/trunk/models/sentiment-analysis/sentiment-analysis.php
r1379591 r1379595 14 14 15 15 /** 16 * Approves all positive comments, and marks comments as having been processed so we don't process the same comments multiple times.16 * Processes comments based on settings. Auto approves positive comments if that setting is set, unapproves negative comments if that setting is set. 17 17 */ 18 public function ApprovePositiveComments()18 public function HandleComments() 19 19 { 20 20 $comments = get_comments( array( 'status' => 'hold', 'meta_query' => array( array( 'key' => 'sentiment-checked', 'compare' => 'NOT EXISTS' ) ) ) ); … … 45 45 46 46 if( $this->Model('settings')->GetOption('auto_approve_positive_comments') == 'yes' || $this->Model('settings')->GetOption('auto_unapprove_negative_comments') == 'yes' ) 47 add_action( 'init', array( $this, ' ApprovePositiveComments' ) );47 add_action( 'init', array( $this, 'HandleComments' ) ); 48 48 } 49 49 } -
hercules-sentiment-analysis/trunk/models/settings/settings.php
r1379591 r1379595 9 9 $this->class_name = __CLASS__; 10 10 $this->directory = dirname( __FILE__ ); 11 $this->has_options = true; 11 12 12 13 parent::__construct(); -
hercules-sentiment-analysis/trunk/plugin.php
r1379594 r1379595 5 5 Author: Todd D. Nestor - todd.nestor@gmail.com 6 6 Author URI: http://toddnestor.com 7 Version: 1.2. 17 Version: 1.2.2 8 8 License: GNU General Public License v3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html -
hercules-sentiment-analysis/trunk/readme.txt
r1379594 r1379595 4 4 Requires at least: 3.5 5 5 Tested up to: 4.3 6 Stable tag: 1.2. 16 Stable tag: 1.2.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
hercules-sentiment-analysis/trunk/views/settings/settings.php
r1379591 r1379595 14 14 $this->priority = 5; 15 15 16 //Bootstrap makes things awesome! 16 17 $this->IncludeBootstrap(); 17 18 -
hercules-sentiment-analysis/trunk/views/settings/template.php
r1379591 r1379595 6 6 {{#if updated}} 7 7 <div class="row"> 8 <div class="col-md- 6">8 <div class="col-md-12"> 9 9 <div class="alert alert-success" role="alert"><strong>Success!</strong> Your settings were updated!</div> 10 10 </div>
Note: See TracChangeset
for help on using the changeset viewer.