/** * Optional implementation to deactivate plugin - can be extended by subclasses, not to be called directly but extended by subclasses * * @api * * @since 1.0 * * @param none * * @return string $message Optional any messages generated by deactivation */ public function deactivate() { $message = ""; // If the plugin requries smarty create cache and compiled directories if ($this->uses_smarty) { $smarty_cache_dir = $this->options->get_value('smarty_cache_dir'); $smarty_compiled_dir = $this->options->get_value('smarty_compiled_dir'); if (file_exists($smarty_cache_dir)) { if (!@rmdir($smarty_cache_dir)) { $message .= "<br>Unable to remove {$smarty_cache_dir} directory. Please remove this directory manually via FTP or cPanel."; } //end if } //end if if (file_exists($smarty_compiled_dir)) { if (!@rmdir($smarty_compiled_dir)) { $message .= "<br>Unable to remove {$smarty_compiled_dir} directory. Please remove this directory manually via FTP or cPanel."; } //end if } //end if } //end if return $message; }
/** * Process shortcodes passed to widget * * @ignore - Must be public, used by WordPress hook * * @since 1.0 * * @param array $attributes Optional the arguments passed to the shortcode * @param string $content Optional The content that the shortcode contains. Stored to fields[shortcode_content] * * @return none */ public function process_shortcode($attributes, $content = null) { if (is_feed()) { return '[' . $this->options->get_value('name') . ']'; } $shortcode_fields = get_option($this->options->get_value('shortcode-fields-option-name')); $defaults = new TSP_Easy_Dev_Data($shortcode_fields); if (!empty($attributes)) { $fields = $defaults->get_values(true); // Update attributes to include old attribute names from short codes // Backwards compatibility foreach ($fields as $key => $opts) { // continue if this label was renamed if (!empty($opts['old_labels'])) { $new_label = $key; // looop through all the old label names foreach ($opts['old_labels'] as $old_label) { // if the new label isn't being used and the user is using the old label // set the new labels value to the old label's value if (!array_key_exists($new_label, $attributes) && array_key_exists($old_label, $attributes)) { $attributes[$new_label] = $attributes[$old_label]; unset($attributes[$old_label]); } //end fi } //end foreach } //end if } //end foreach } //end if if (!empty($attributes)) { $defaults->set_values($attributes); } else { $defaults->decode_values(); } //endelse $fields = $defaults->get_values(); $fields['shortcode_content'] = $content; $output = $this->display_widget($fields, false); return $output; }