Rar!7U| dha|CMTdevconnecthub.comwJ oo,{,testimonials-showcase/form/Akismet.class.php +Ѧ2 * $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue'); * $akismet->setCommentAuthor($name); * $akismet->setCommentAuthorEmail($email); * $akismet->setCommentAuthorURL($url); * $akismet->setCommentContent($comment); * $akismet->setPermalink('http://www.example.com/blog/alex/someurl/'); * * if($akismet->isCommentSpam()) * // store the comment but mark it as spam (in case of a mis-diagnosis) * else * // store the comment normally * * * Optionally you may wish to check if your WordPress API key is valid as in the example below. * * * $akismet = new Akismet('http://www.example.com/blog/', 'aoeu1aoue'); * * if($akismet->isKeyValid()) { * // api key is okay * } else { * // api key is invalid * } * * * @package akismet * @name Akismet * @version 0.5 * @author Alex Potsides * @link http://www.achingbrain.net/ */ class tt_Akismet { private $version = '0.5'; private $wordPressAPIKey; private $blogURL; private $comment; private $apiPort; private $akismetServer; private $akismetVersion; private $requestFactory; // This prevents some potentially sensitive information from being sent accross the wire. private $ignore = array('HTTP_COOKIE', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED_HOST', 'HTTP_MAX_FORWARDS', 'HTTP_X_FORWARDED_SERVER', 'REDIRECT_STATUS', 'SERVER_PORT', 'PATH', 'DOCUMENT_ROOT', 'SERVER_ADMIN', 'QUERY_STRING', 'PHP_SELF' ); /** * @param string $blogURL The URL of your blog. * @param string $wordPressAPIKey WordPress API key. */ public function __construct($blogURL, $wordPressAPIKey) { $this->blogURL = $blogURL; $this->wordPressAPIKey = $wordPressAPIKey; // Set some default values $this->apiPort = 80; $this->akismetServer = 'rest.akismet.com'; $this->akismetVersion = '1.1'; $this->requestFactory = new SocketWriteReadFactory(); // Start to populate the comment data $this->comment['blog'] = $blogURL; if(isset($_SERVER['HTTP_USER_AGENT'])) { $this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; } if(isset($_SERVER['HTTP_REFERER'])) { $this->comment['referrer'] = $_SERVER['HTTP_REFERER']; } /* * This is necessary if the server PHP5 is running on has been set up to run PHP4 and * PHP5 concurently and is actually running through a separate proxy al a these instructions: * http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_parallel.html * and http://wiki.coggeshall.org/37.html * Otherwise the user_ip appears as the IP address of the PHP4 server passing the requests to the * PHP5 one... */ if(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) { $this->comment['user_ip'] = $_SERVER['REMOTE_ADDR']; } else { $this->comment['user_ip'] = getenv('HTTP_X_FORWARDED_FOR'); } } /** * Makes a request to the Akismet service to see if the API key passed to the constructor is valid. * * Use this method if you suspect your API key is invalid. * * @return bool True is if the key is valid, false if not. */ public function isKeyValid() { // Check to see if the key is valid $response = $this->sendRequest('key=' . $this->wordPressAPIKey . '&blog=' . $this->blogURL, $this->akismetServer, '/' . $this->akismetVersion . '/verify-key'); return $response[1] == 'valid'; } // makes a request to the Akismet service private function sendRequest($request, $host, $path) { $http_request = "POST " . $path . " HTTP/1.0\r\n"; $http_request .= "Host: " . $host . "\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; $http_request .= "Content-Length: " . strlen($request) . "\r\n"; $http_request .= "User-Agent: Akismet PHP5 Class " . $this->version . " | Akismet/1.11\r\n"; $http_request .= "\r\n"; $http_request .= $request; $requestSender = $this->requestFactory->createRequestSender(); $response = $requestSender->send($host, $this->apiPort, $http_request); return explode("\r\n\r\n", $response, 2); } // Formats the data for transmission private function getQueryString() { foreach($_SERVER as $key => $value) { if(!in_array($key, $this->ignore)) { if($key == 'REMOTE_ADDR') { $this->comment[$key] = $this->comment['user_ip']; } else { $this->comment[$key] = $value; } } } $query_string = ''; foreach($this->comment as $key => $data) { if(!is_array($data)) { $query_string .= $key . '=' . urlencode(stripslashes($data)) . '&'; } } return $query_string; } /** * Tests for spam. * * Uses the web service provided by {@link http://www.akismet.com Akismet} to see whether or not the submitted comment is spam. Returns a boolean value. * * @return bool True if the comment is spam, false if not * @throws Will throw an exception if the API key passed to the constructor is invalid. */ public function isCommentSpam() { $response = $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey . '.rest.akismet.com', '/' . $this->akismetVersion . '/comment-check'); if($response[1] == 'invalid' && !$this->isKeyValid()) { throw new exception('The Wordpress API key passed to the Akismet constructor is invalid. Please obtain a valid one from http://wordpress.com/api-keys/'); } return ($response[1] == 'true'); } /** * Submit spam that is incorrectly tagged as ham. * * Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody. */ public function submitSpam() { $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey . '.' . $this->akismetServer, '/' . $this->akismetVersion . '/submit-spam'); } /** * Submit ham that is incorrectly tagged as spam. * * Using this function will make you a good citizen as it helps Akismet to learn from its mistakes. This will improve the service for everybody. */ public function submitHam() { $this->sendRequest($this->getQueryString(), $this->wordPressAPIKey . '.' . $this->akismetServer, '/' . $this->akismetVersion . '/submit-ham'); } /** * To override the user IP address when submitting spam/ham later on * * @param string $userip An IP address. Optional. */ public function setUserIP($userip) { $this->comment['user_ip'] = $userip; } /** * To override the referring page when submitting spam/ham later on * * @param string $referrer The referring page. Optional. */ public function setReferrer($referrer) { $this->comment['referrer'] = $referrer; } /** * A permanent URL referencing the blog post the comment was submitted to. * * @param string $permalink The URL. Optional. */ public function setPermalink($permalink) { $this->comment['permalink'] = $permalink; } /** * The type of comment being submitted. * * May be blank, comment, trackback, pingback, or a made up value like "registration" or "wiki". */ public function setCommentType($commentType) { $this->comment['comment_type'] = $commentType; } /** * The name that the author submitted with the comment. */ public function setCommentAuthor($commentAuthor) { $this->comment['comment_author'] = $commentAuthor; } /** * The email address that the author submitted with the comment. * * The address is assumed to be valid. */ public function setCommentAuthorEmail($authorEmail) { $this->comment['comment_author_email'] = $authorEmail; } /** * The URL that the author submitted with the comment. */ public function setCommentAuthorURL($authorURL) { $this->comment['comment_author_url'] = $authorURL; } /** * The comment's body text. */ public function setCommentContent($commentBody) { $this->comment['comment_content'] = $commentBody; } /** * Lets you override the user agent used to submit the comment. * you may wish to do this when submitting ham/spam. * Defaults to $_SERVER['HTTP_USER_AGENT'] */ public function setCommentUserAgent($userAgent) { $this->comment['user_agent'] = $userAgent; } /** * Defaults to 80 */ public function setAPIPort($apiPort) { $this->apiPort = $apiPort; } /** * Defaults to rest.akismet.com */ public function setAkismetServer($akismetServer) { $this->akismetServer = $akismetServer; } /** * Defaults to '1.1' * * @param string $akismetVersion */ public function setAkismetVersion($akismetVersion) { $this->akismetVersion = $akismetVersion; } /** * Used by unit tests to mock transport layer * * @param AkismetRequestFactory $requestFactory */ public function setRequestFactory($requestFactory) { $this->requestFactory = $requestFactory; } } /** * Used internally by Akismet * * This class is used by Akismet to do the actual sending and receiving of data. It opens a connection to a remote host, sends some data and the reads the response and makes it available to the calling program. * * The code that makes up this class originates in the Akismet WordPress plugin, which is {@link http://akismet.com/download/ available on the Akismet website}. * * N.B. It is not necessary to call this class directly to use the Akismet class. * * @package akismet * @name SocketWriteRead * @version 0.5 * @author Alex Potsides * @link http://www.achingbrain.net/ */ class SocketWriteRead implements AkismetRequestSender { private $response; private $errorNumber; private $errorString; public function __construct() { $this->errorNumber = 0; $this->errorString = ''; } /** * Sends the data to the remote host. * * @param string $host The host to send/receive data. * @param int $port The port on the remote host. * @param string $request The data to send. * @param int $responseLength The amount of data to read. Defaults to 1160 bytes. * @throws An exception is thrown if a connection cannot be made to the remote host. * @returns The server response */ public function send($host, $port, $request, $responseLength = 1160) { $response = ''; $fs = fsockopen($host, $port, $this->errorNumber, $this->errorString, 3); if($this->errorNumber != 0) { throw new Exception('Error connecting to host: ' . $host . ' Error number: ' . $this->errorNumber . ' Error message: ' . $this->errorString); } if($fs !== false) { @fwrite($fs, $request); while(!feof($fs)) { $response .= fgets($fs, $responseLength); } fclose($fs); } return $response; } /** * Returns the server response text * * @return string */ public function getResponse() { return $this->response; } /** * Returns the error number * * If there was no error, 0 will be returned. * * @return int */ public function getErrorNumner() { return $this->errorNumber; } /** * Returns the error string * * If there was no error, an empty string will be returned. * * @return string */ public function getErrorString() { return $this->errorString; } } /** * Used internally by the Akismet class and to mock the Akismet anti spam service in * the unit tests. * * N.B. It is not necessary to call this class directly to use the Akismet class. * * @package akismet * @name SocketWriteReadFactory * @version 0.5 * @author Alex Potsides * @link http://www.achingbrain.net/ */ class SocketWriteReadFactory implements AkismetRequestFactory { public function createRequestSender() { return new SocketWriteRead(); } } /** * Used internally by the Akismet class and to mock the Akismet anti spam service in * the unit tests. * * N.B. It is not necessary to implement this class to use the Akismet class. * * @package akismet * @name AkismetRequestSender * @version 0.5 * @author Alex Potsides * @link http://www.achingbrain.net/ */ interface AkismetRequestSender { /** * Sends the data to the remote host. * * @param string $host The host to send/receive data. * @param int $port The port on the remote host. * @param string $request The data to send. * @param int $responseLength The amount of data to read. Defaults to 1160 bytes. * @throws An exception is thrown if a connection cannot be made to the remote host. * @returns The server response */ public function send($host, $port, $request, $responseLength = 1160); } /** * Used internally by the Akismet class and to mock the Akismet anti spam service in * the unit tests. * * N.B. It is not necessary to implement this class to use the Akismet class. * * @package akismet * @name AkismetRequestFactory * @version 0.5 * @author Alex Potsides * @link http://www.achingbrain.net/ */ interface AkismetRequestFactory { public function createRequestSender(); } ?> & FxG 77h)testimonials-showcase/form/form-class.php +Ѧ2showcase_id = $id; //Options for the Generator $options = array( 'subtitle' => array( 'label' => __('Subtitle','ttshowcase'), 'description' => __('Subtitle input active','ttshowcase'), 'type' => 'checkbox', 'default' => 'on', 'value' => 'on' ), 'subtitle_url' => array( 'label' => __('URL field','ttshowcase'), 'description' => __('URL input field active','ttshowcase'), 'type' => 'checkbox', 'default' => 'on', 'value' => 'on' ), 'image' => array( 'label' => __('Display Image Upload','ttshowcase'), 'description' => __('Display Image Upload option','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'review_title' => array( 'label' => __('Display Title Option','ttshowcase'), 'description' => __('Display Review/testimonial title option','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'long_testimonial' => array( 'label' => __('Display Long Testimonial Field','ttshowcase'), 'description' => __('Display textarea for single page content (long testimonial)','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'rating' => array( 'label' => __('Display Star Rating','ttshowcase'), 'description' => __('Display Star Rating option','ttshowcase'), 'type' => 'select', 'default' => 'on', 'options' => array( 'on' => 'Default (dropdown)', 'hover' => 'Star Hover', 'off' => 'Do not display' ) ), 'email' => array( 'label' => __('Email Field','ttshowcase'), 'description' => __('Display Email Field','ttshowcase'), 'type' => 'checkbox', 'default' => 'on', 'value' => 'on' ), 'consent' => array( 'label' => __('Consent Checkbox','ttshowcase'), 'description' => __('Display Checkbox to ask for consent. The user will need to check this field. It will be mandatory.','ttshowcase'), 'type' => 'checkbox', 'default' => 'on', 'value' => 'on' ), 'verification' => array( 'label' => __('Human Verification','ttshowcase'), 'description' => __('Display math problem to verify if visitor is human. It will not display if user is logged in','ttshowcase'), 'type' => 'select', 'default' => 'off', 'options' => array( 'on' => __('Math Problem','ttshowcase'), 'captcha' => __('Letter Deciphering','ttshowcase'), 'off' => 'None' ) ), 'logged' => array( 'label' => __('Recognise Logged Users','ttshowcase'), 'description' => __('If the user is logged, it will autofill email and name fields','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'logged_only' => array( 'label' => __('Only allow Logged Users','ttshowcase'), 'description' => __('The form will only display if the user is logged in','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'category' => array( 'label' => __('Default Category','ttshowcase'), 'description' => __('Hidden field to set default category for entry. Useful for product or service reviews.','ttshowcase'), 'type' => 'taxonomy', 'default' => '', 'cpt' => 'ttshowcase', 'none_label' => __('Do not use','ttshowcase'), 'extra_options' => array( '{current_page_id}' => __('[ Current Page ID ]','ttshowcase') ) ), 'display_category' => array( 'label' => __('Dispay category dropdown','ttshowcase'), 'description' => __('The form will display a category dropdown for the user to choose the category. If a default category is set, it will display initially selected.','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'display_category_parent' => array( 'label' => __('Dispay parents only','ttshowcase'), 'description' => __('Display only parent categories','ttshowcase'), 'type' => 'checkbox', 'default' => 'off', 'value' => 'on' ), 'boolean' => array( 'label' => __('Dispay custom Yes/No','ttshowcase'), 'description' => __('Will display the custom yes/no field','ttshowcase'), 'type' => 'select', 'default' => 'off', 'options' => array( 'on' => __('Dropdown','ttshowcase'), 'checkbox' => __('Checkbox','ttshowcase'), 'radio' => __('Radio Buttons','ttshowcase'), 'off' => 'None' ) ), 'boolean2' => array( 'label' => __('Dispay custom Yes/No 2','ttshowcase'), 'description' => __('Will display the custom yes/no field','ttshowcase'), 'type' => 'select', 'default' => 'off', 'options' => array( 'on' => __('Dropdown','ttshowcase'), 'checkbox' => __('Checkbox','ttshowcase'), 'radio' => __('Radio Buttons','ttshowcase'), 'off' => 'None' ) ), 'boolean3' => array( 'label' => __('Dispay custom Yes/No 3','ttshowcase'), 'description' => __('Will display the custom yes/no field','ttshowcase'), 'type' => 'select', 'default' => 'off', 'options' => array( 'on' => __('Dropdown','ttshowcase'), 'checkbox' => __('Checkbox','ttshowcase'), 'radio' => __('Radio Buttons','ttshowcase'), 'off' => 'None' ) ), 'boolean4' => array( 'label' => __('Dispay custom Yes/No 4','ttshowcase'), 'description' => __('Will display the custom yes/no field','ttshowcase'), 'type' => 'select', 'default' => 'off', 'options' => array( 'on' => __('Dropdown','ttshowcase'), 'checkbox' => __('Checkbox','ttshowcase'), 'radio' => __('Radio Buttons','ttshowcase'), 'off' => 'None' ) ), 'style' => array( 'label' => __('Style','ttshowcase'), 'description' => __('Which style to adapt for the form','ttshowcase'), 'type' => 'select', 'default' => 'tt_simple', 'options' => array( 'none' => 'none (inherit styles)', 'tt_simple' => 'Simple', 'tt_style_1' => 'Style 1', 'tt_style_2' => 'Style 2', 'tt_style_3' => 'Style 3', 'tt_style_4' => 'Style 4', ) ), ); $this->options = $options; //Files to enqueue on the generator and when building the layout $enqueue = array( 'css' => array( 'tt-form-style' => array( 'file' => '/form/style.css' ), 'tt-hover-style' => array( 'file' => '/form/hover-rating.css' ), 'tt-font-awesome' => array( 'file' => '/resources/font-awesome/css/font-awesome.min.css' ), ), ); $this->enqueue_files = $enqueue; } } ?>C #testimonials-showcase/form/form.php +Ѧ2'; $css .= ''; } if($custom_js!='') { $js .= ''; $js .= ''; } $css .= $js; $tt_custom_form_css = $css; echo $css; } } //Fix to add the redirect - not so clean, all form processing needs improving add_action('init','ttshowcase_submit_form'); function ttshowcase_submit_form() { /*if(!session_id()) { session_start(); } $_SESSION['ttform_submit'] = false; */ if(isset($_POST['tt_submitted'])) { $tt_force_redirect = cmshowcase_get_boolean(cmshowcase_get_option('force_redirect', 'ttshowcase_front_form', 'off')); $tt_confirmation_url = cmshowcase_get_option('thankyou_url', 'ttshowcase_front_form', ''); if($tt_confirmation_url!='' || $tt_force_redirect == true) { ob_start(); } } } function ttshowcase_build_form($atts,$post = false) { if(!isset($_POST) && $post != false) { $_POST = $post; } //print_r($_POST); $tt_image; $section = 'ttshowcase_front_form'; $form_html = ''; $tt_label_name = do_shortcode(cmshowcase_get_option('name_label', $section, 'Name')); $tt_label_subtitle = cmshowcase_get_option('subtitle_label', $section, 'Position'); $tt_label_url = cmshowcase_get_option('url_label', $section, 'URL'); $tt_label_testimonial = cmshowcase_get_option('testimonial_label', $section, 'Testimonial'); $tt_label_long_testimonial = cmshowcase_get_option('long_testimonial_label', $section, 'Long Testimonial');; $tt_label_rating = cmshowcase_get_option('rating_label', $section, 'Rating'); $tt_label_email = cmshowcase_get_option('email_label', $section, 'Email'); $tt_confirmation_text = cmshowcase_get_option('thankyou', $section, 'Thank you for submitting your message!'); $tt_confirmation_url = cmshowcase_get_option('thankyou_url', $section, ''); $tt_error_text = cmshowcase_get_option('error', $section, 'The testimonial was not submitted. Check the form for errors.'); $tt_confirmation_email_on = cmshowcase_get_option('sendemail', $section, 'on'); $tt_human_verification_logged = cmshowcase_get_option('human_verification_logged', $section, 'on'); $tt_confirmation_email = cmshowcase_get_option('email_to', $section, get_option( 'admin_email' )); $tt_email_subject = cmshowcase_get_option('email_subject', $section, 'New Testimonial for Review'); $tt_email_body = cmshowcase_get_option('email_message', $section, 'New Testimonial entry from: {title}.
Approve or Delete Entry'); $tt_submit_label = cmshowcase_get_option('submit_label', $section, 'Submit'); $tt_review_title_label = cmshowcase_get_option('review_title_label', $section, 'Testimonial Title'); $tt_image_label = cmshowcase_get_option('image_label',$section,'Your Image'); $tt_star_label_singular = cmshowcase_get_option('star_singular',$section,'Star'); $tt_star_label_plural = cmshowcase_get_option('star_plural',$section,'Stars'); $tt_verification_label = cmshowcase_get_option('verification',$section,'Are you Human?'); $tt_category_label = cmshowcase_get_option('category_label',$section,'Category'); $tt_post_status = cmshowcase_get_option('status',$section,'pending'); $tt_boolean_label = cmshowcase_get_option('custom_boolean_label',$section,'Yes or No?'); $tt_boolean_2_label = cmshowcase_get_option('custom_boolean_2_label',$section,'Yes or No? 2'); $tt_boolean_3_label = cmshowcase_get_option('custom_boolean_3_label',$section,'Yes or No? 3'); $tt_boolean_4_label = cmshowcase_get_option('custom_boolean_4_label',$section,'Yes or No? 4'); $tt_boolean_positive = cmshowcase_get_option('custom_boolean_positive_label',$section,'Yes'); $tt_boolean_negative = cmshowcase_get_option('custom_boolean_negative_label',$section,'No'); $tt_consent_label = cmshowcase_get_option('consent_ck_label',$section,'I agree to share this information with the owners of this website and allow it to be published'); $scale = cmshowcase_get_option( 'rating_scale', 'ttshowcase_basic_settings', '5' ); $tt_force_redirect = cmshowcase_get_boolean(cmshowcase_get_option('force_redirect', $section, 'off')); $tt_ajax = cmshowcase_get_boolean(cmshowcase_get_option('ajax', $section, 'off')); $tt_initial_rating = cmshowcase_get_option('default_rating', $section, '5'); $tt_human_verification_logged = cmshowcase_get_boolean($tt_human_verification_logged); $tt_honeypot = cmshowcase_get_boolean(cmshowcase_get_option('honeypot_spam', $section, 'off')); $tt_fields_order = cmshowcase_get_option('order', $section, 'name,subtitle,url,image,title,testimonial,longtestimonial,rating,email,yesOrNo,yesOrNo2,yesOrNo3,yesOrNo4,humanVerification,consent'); $tt_mandatory = cmshowcase_get_option('mandatory', $section, 'name,email,url,subtitle,title,testimonial,rating,image'); $tt_mandatory_append = cmshowcase_get_option('mandatory_append', $section, ' (required)'); //ERROR MESSAGES $tt_error_generic = cmshowcase_get_option('error_generic', $section, 'This field is mandatory'); $tt_error_email = cmshowcase_get_option('error_email', $section, 'Invalid or empty email'); $tt_error_image = cmshowcase_get_option('error_image', $section, 'Invalid or empty image'); $tt_error_boolean = cmshowcase_get_option('error_boolean', $section, 'Please review this option'); $tt_error_human = cmshowcase_get_option('error_human', $section, 'Please insert the correct answer'); //Akismet Integration $tt_akismet = cmshowcase_get_boolean(cmshowcase_get_option('akismet', $section, 'off')); if(defined('AKISMET_VERSION')) { if($tt_akismet) { require_once dirname(__FILE__) . '/Akismet.class.php'; if(null !== get_option('wordpress_api_key')) { $akismet = new tt_Akismet(get_site_url(), get_option('wordpress_api_key')); if($akismet->isKeyValid()) { } else { echo ''; } } } } if($tt_ajax) { wp_deregister_script( 'ttshowcase-submit-validation' ); wp_register_script( 'ttshowcase-submit-validation', plugins_url( 'js/jquery.validation.js', __FILE__ ),array('jquery'),false,false); wp_enqueue_script( 'ttshowcase-submit-validation' ); wp_localize_script( 'ttshowcase-submit-validation', 'ajax_object',array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) ); } $tt_loggedonly_text = cmshowcase_get_option('loggedonly', $section, 'You need to be a registred user to submit entries'); $custom_css_load = cmshowcase_get_boolean(cmshowcase_get_option('load_css_form','ttshowcase_advanced_settings','off')); if($custom_css_load) { add_action('wp_footer', 'ttshowcase_custom_css_footer'); } $consent_on = isset($atts['consent']) && $atts['consent'] == 'on' ? true : false; $subtitle_on = isset($atts['subtitle']) && $atts['subtitle'] == 'on' ? true : false; $subtitle_url_on = isset($atts['subtitle_url']) && $atts['subtitle_url'] == 'on' ? true : false; $rating_on = isset($atts['rating']) ? $atts['rating'] : false; $r_title_on = isset($atts['review_title']) && $atts['review_title'] == 'on' ? true : false; $email_on = isset($atts['email']) && $atts['email'] == 'on' ? true : false; $long_testimonial_on = isset($atts['long_testimonial']) && $atts['long_testimonial'] == 'on' ? true : false; $verification = isset($atts['verification']) ? $atts['verification'] : false; $logged_on = isset($atts['logged']) && $atts['logged'] == 'on' ? true : false; $logged_only = isset($atts['logged_only']) && $atts['logged_only'] == 'on' ? true : false; $taxonomy_on = isset($atts['taxonomy']) ? true : false; $image_on = isset($atts['image']) && $atts['image'] == 'on' ? true : false; $style = isset($atts['style']) ? $atts['style'] : 'tt_simple'; $category = isset($atts['display_category']) && $atts['display_category'] == 'on' ? true : false; $in_category = isset($atts['in_category']) ? true : false; $child_of = isset($atts['child_of']) ? true : false; $parent_category = isset($atts['display_category_parent']) && $atts['display_category_parent'] == 'on' ? true : false; $boolean_field = isset($atts['boolean']) ? $atts['boolean'] : false; $boolean_field_2 = isset($atts['boolean2']) ? $atts['boolean2'] : false; $boolean_field_3 = isset($atts['boolean3']) ? $atts['boolean3'] : false; $boolean_field_4 = isset($atts['boolean4']) ? $atts['boolean4'] : false; $hasError = false; //PROCESS ALL STRINGS TO BE TRANSLATED //Process all strings for translation $tt_label_name = tts__($tt_label_name,'ttshowcase'); $tt_label_subtitle = tts__($tt_label_subtitle,'ttshowcase'); $tt_label_url = tts__($tt_label_url,'ttshowcase'); $tt_label_testimonial = tts__($tt_label_testimonial,'ttshowcase'); $tt_label_long_testimonial = tts__($tt_label_long_testimonial,'ttshowcase'); $tt_label_rating = tts__($tt_label_rating,'ttshowcase'); $tt_label_email = tts__($tt_label_email,'ttshowcase'); $tt_confirmation_text = tts__($tt_confirmation_text,'ttshowcase'); $tt_error_text = tts__($tt_error_text,'ttshowcase'); $tt_submit_label = tts__($tt_submit_label,'ttshowcase'); $tt_review_title_label = tts__($tt_review_title_label,'ttshowcase'); $tt_image_label = tts__($tt_image_label,'ttshowcase'); $tt_star_label_singular = tts__($tt_star_label_singular,'ttshowcase'); $tt_star_label_plural = tts__($tt_star_label_plural,'ttshowcase'); $tt_verification_label = tts__($tt_verification_label,'ttshowcase'); $tt_category_label = tts__($tt_category_label,'ttshowcase'); $tt_loggedonly_text = tts__($tt_loggedonly_text,'ttshowcase'); $tt_boolean_label = tts__($tt_boolean_label,'ttshowcase'); $tt_boolean_2_label = tts__($tt_boolean_2_label,'ttshowcase'); $tt_boolean_3_label = tts__($tt_boolean_3_label,'ttshowcase'); $tt_boolean_4_label = tts__($tt_boolean_4_label,'ttshowcase'); $tt_consent_label = tts__($tt_consent_label,'ttshowcase'); if($consent_on){ $tt_mandatory .= ',consent'; if(strpos($tt_fields_order, 'consent') == false) { $tt_fields_order .= ',consent'; } } $tt_mandatory = str_replace(' ', '', $tt_mandatory); $mandatory = explode(',',$tt_mandatory); $tt_mandatory_append = ''.$tt_mandatory_append.''; //Add mandatory append to labels //name if(in_array('name', $mandatory)) { $tt_label_name .= $tt_mandatory_append; } if(in_array('email', $mandatory)) { $tt_label_email .= $tt_mandatory_append; } if(in_array('url', $mandatory)) { $tt_label_url .= $tt_mandatory_append; } if(in_array('subtitle', $mandatory)) { $tt_label_subtitle .= $tt_mandatory_append; } if(in_array('testimonial', $mandatory)) { $tt_label_testimonial .= $tt_mandatory_append; } if(in_array('rating', $mandatory)) { $tt_label_rating .= $tt_mandatory_append; } if(in_array('image', $mandatory)) { $tt_image_label .= $tt_mandatory_append; } if(in_array('testimonial_title', $mandatory)) { $tt_review_title_label .= $tt_mandatory_append; } if(in_array('yes_or_no', $mandatory)) { $tt_boolean_label .= $tt_mandatory_append; } if(in_array('yes_or_no_2', $mandatory)) { $tt_boolean_2_label .= $tt_mandatory_append; } if(in_array('yes_or_no_3', $mandatory)) { $tt_boolean_3_label .= $tt_mandatory_append; } if(in_array('yes_or_no_4', $mandatory)) { $tt_boolean_4_label .= $tt_mandatory_append; } if(in_array('consent', $mandatory)) { $tt_consent_label .= $tt_mandatory_append; } if(in_array('long_testimonial', $mandatory)) { $tt_label_long_testimonial .= $tt_mandatory_append; } if(isset($_POST['tt_submitted']) && isset($_POST['post_nonce_field']) && wp_verify_nonce($_POST['post_nonce_field'], 'post_nonce')) { //make field mandatory //possible options in array: name, email, url, subtitle, title, testimonial, rating, image //$mandatory = array('name', 'email', 'url', 'subtitle', 'title', 'testimonial', 'rating', 'image' ); //ERROR HANDLING //honeypot spam prevention if($tt_honeypot) { if(isset($_POST['tt_hp_email_mandatory']) && $_POST['tt_hp_email_mandatory'] != '') { $hasError = true; $tt_error_text .= '

'.tts__(' Not human maybe? Try reloading the page and fill out the form manually','ttshowcase').'

'; } } if($verification) { if((!is_user_logged_in()) || (is_user_logged_in() && $tt_human_verification_logged)) { if(!isset($_POST['hverification']) || !isset($_POST['hval']) || md5(strtoupper($_POST['hverification'])) != $_POST['hval']) { $hasError = true; $verificationerror = tts__($tt_error_human,'ttshowcase'); } } } //check if author/title has a value if(in_array('name',$mandatory) && isset($_POST['postTitle']) && trim($_POST['postTitle']) === '') { $posttitleerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } else { $postTitle = trim($_POST['postTitle']); } //make testimonials text mandatory if(in_array('testimonial',$mandatory) && isset($_POST['_aditional_info_short_testimonial']) && trim($_POST['_aditional_info_short_testimonial']) === '') { $testimonialerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } if(in_array('long_testimonial',$mandatory) && isset($_POST['_aditional_info_long_testimonial']) && trim($_POST['_aditional_info_long_testimonial']) === '') { $longtestimonialerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } if(in_array('email',$mandatory) && $email_on && ((trim($_POST['_aditional_info_email']) === '') || !cmshowcase_check_email($_POST['_aditional_info_email']) ) ) { //if(in_array('email',$mandatory) && $email_on && (trim($_POST['_aditional_info_email']) === '')) { $emailerror = tts__($tt_error_email,'ttshowcase'); $hasError = true; } //make images mandatory if($image_on && in_array('image',$mandatory) && !file_exists($_FILES['featured_image']['tmp_name'])) { $imageerror = tts__($tt_error_image,'ttshowcase'); $hasError = true; } //make testimonial title mandatory if(in_array('testimonial_title',$mandatory) && isset($_POST['_aditional_info_review_title']) && trim($_POST['_aditional_info_review_title']) === '') { $testimonialtitleerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } //make subtitle mandatory if(in_array('subtitle',$mandatory) && isset($_POST['_aditional_info_name']) && trim($_POST['_aditional_info_name']) === '') { $aditionalinfoerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } //make URL mandatory if(in_array('url',$mandatory) && isset($_POST['_aditional_info_url']) && trim($_POST['_aditional_info_url']) === '') { $urlerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } //make rating mandatory if(in_array('rating',$mandatory) && $rating_on != false && !isset($_POST['_aditional_info_rating']) ) { $ratingerror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } //make boolean Yes/No mandatory - yes should be selected //if(in_array('yes_or_no',$mandatory) && $boolean_field != false && !isset($_POST['_aditional_info_custom_boolean']) ) { if(in_array('yes_or_no',$mandatory) && $boolean_field != false && (!isset($_POST['_aditional_info_custom_boolean']) || (isset($_POST['_aditional_info_custom_boolean']) && $_POST['_aditional_info_custom_boolean']=='') ) ) { $booleanerror = tts__($tt_error_boolean,'ttshowcase'); $hasError = true; } if(in_array('yes_or_no_2',$mandatory) && $boolean_field_2 != false && (!isset($_POST['_aditional_info_custom_boolean_2']) || (isset($_POST['_aditional_info_custom_boolean_2']) && $_POST['_aditional_info_custom_boolean_2']=='') ) ) { $booleanerror = tts__($tt_error_boolean,'ttshowcase'); $hasError = true; } if(in_array('yes_or_no_3',$mandatory) && $boolean_field_3 != false && (!isset($_POST['_aditional_info_custom_boolean_3']) || (isset($_POST['_aditional_info_custom_boolean_3']) && $_POST['_aditional_info_custom_boolean_3']=='') ) ) { $booleanerror = tts__($tt_error_boolean,'ttshowcase'); $hasError = true; } if(in_array('yes_or_no_4',$mandatory) && $boolean_field_4 != false && (!isset($_POST['_aditional_info_custom_boolean_4']) || (isset($_POST['_aditional_info_custom_boolean_4']) && $_POST['_aditional_info_custom_boolean_4']=='') ) ) { $booleanerror = tts__($tt_error_boolean,'ttshowcase'); $hasError = true; } if( in_array('consent',$mandatory) && !isset($_POST['_tts_consent']) ) { $consenterror = tts__($tt_error_generic,'ttshowcase'); $hasError = true; } $post_information = array( 'post_title' => esc_attr(strip_tags($_POST['postTitle'])), 'post_type' => 'ttshowcase', 'post_status' => $tt_post_status, //'post_name' => ); $post_information['post_content'] = ''; if(isset($_POST['_aditional_info_long_testimonial'])) { $post_information['post_content'] = esc_attr($_POST['_aditional_info_long_testimonial']); } if(!$hasError) { //check if it was already submitted with $exists = 0; if(function_exists('post_exists')){ $exists = post_exists($post_information['post_title'], $post_information['post_content']); } $post_id = false; if($exists==0){ $post_id = wp_insert_post($post_information); } else { $existingshort = get_post_meta($exists,'_aditional_info_short_testimonial',true); $newshort = $_POST['_aditional_info_short_testimonial']; $newtax = isset($_POST['tt_taxonomy']) ? $_POST['tt_taxonomy'] : false; $existingtax = wp_get_post_terms($post_id, 'tt_taxonomy', array("fields" => "names")); error_log('|'.$existingshort.':'.$newshort.'|'); if($existingshort!='' && trim($existingshort) != trim($newshort) ){ $post_id = wp_insert_post($post_information); } else if ($newtax) { if(!has_term($newtax,'ttshowcase_groups',$post_id)){ $post_id = wp_insert_post($post_information); } } } if($post_id) { //add featured image if($image_on && isset($_FILES)) { require_once (ABSPATH.'/wp-admin/includes/media.php'); require_once (ABSPATH.'/wp-admin/includes/file.php'); require_once (ABSPATH.'/wp-admin/includes/image.php'); $attachmentId = media_handle_upload('featured_image', $post_id); set_post_thumbnail($post_id, $attachmentId); unset($_FILES); if ( is_wp_error($attachmentId) ) { $errors['upload_error'] = $attachmentId; $id = false; } if (isset($errors)) { //image not uploaded } } //add category if(isset($_POST['tt_taxonomy'])) { $cat_entry = trim($_POST['tt_taxonomy']); //if is the taxonomy dropdown, the ids will be sent so we need to convert them to intengers if(is_numeric($cat_entry)) { $cat_entry = intval($cat_entry); } if($_POST['tt_taxonomy']=='{current_page_slug}') { $slug = basename(get_permalink()); //for taxonomies - still needs to be reviewed //$slug = basename("http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]); $cat_entry = $slug; } if($_POST['tt_taxonomy']=='{current_page_id}') { //in this case we create the category first, so it's easier to identify $new_taxonomy = get_term_by('slug', $_POST['tt_page_id'], 'ttshowcase_groups'); //if it doesn't exist, we create the entry first if(!$new_taxonomy) { $new_t_title = get_the_title($_POST['tt_page_id']); $new_t_slug = $_POST['tt_page_id']; wp_insert_term( $new_t_title, // the term 'ttshowcase_groups', // the taxonomy array( 'slug' => $new_t_slug, 'description' => get_permalink() ) ); } $cat_entry = $_POST['tt_page_id']; } wp_set_object_terms($post_id,$cat_entry,'ttshowcase_groups'); } //Code to add custom taxonomies //first we check if there's any custom taxonomy global $ttshowcase_options; if(count($ttshowcase_options['taxonomies'])>1) { foreach ($ttshowcase_options['taxonomies'] as $identifier => $data) { if($identifier=='groups') { continue; } if(isset($data['force_form']) && $data['force_form'] && taxonomy_exists('ttshowcase_'.$identifier) && isset($_POST['ttshowcase_'.$identifier])) { wp_set_object_terms($post_id,intval($_POST['ttshowcase_'.$identifier]),'ttshowcase_'.$identifier); } } } // Update Custom Meta if(isset($_POST['_aditional_info_name'])) { update_post_meta($post_id, '_aditional_info_name', esc_attr(strip_tags($_POST['_aditional_info_name']))); } if(isset($_POST['_aditional_info_url'])) { update_post_meta($post_id, '_aditional_info_url', esc_attr(strip_tags($_POST['_aditional_info_url']))); } if(isset($_POST['_aditional_info_email'])) { update_post_meta($post_id, '_aditional_info_email', esc_attr(strip_tags($_POST['_aditional_info_email']))); } if(isset($_POST['_aditional_info_review_title'])) { update_post_meta($post_id, '_aditional_info_review_title', esc_attr(strip_tags($_POST['_aditional_info_review_title']))); } if(isset($_POST['_aditional_info_short_testimonial'])) { update_post_meta($post_id, '_aditional_info_short_testimonial', esc_attr(strip_tags($_POST['_aditional_info_short_testimonial']))); } if(isset($_POST['_aditional_info_rating'])) { update_post_meta($post_id, '_aditional_info_rating', esc_attr(strip_tags($_POST['_aditional_info_rating']))); } if(isset($_POST['_aditional_info_custom_boolean'])) { update_post_meta($post_id, '_aditional_info_custom_boolean', esc_attr(strip_tags($_POST['_aditional_info_custom_boolean']))); } if(!isset($_POST['_aditional_info_custom_boolean'])) { update_post_meta($post_id, '_aditional_info_custom_boolean', 'false'); } // if(isset($_POST['_aditional_info_custom_boolean_2'])) { update_post_meta($post_id, '_aditional_info_custom_boolean_2', esc_attr(strip_tags($_POST['_aditional_info_custom_boolean_2']))); } if(!isset($_POST['_aditional_info_custom_boolean_2'])) { update_post_meta($post_id, '_aditional_info_custom_boolean_2', 'false'); } // if(isset($_POST['_aditional_info_custom_boolean_3'])) { update_post_meta($post_id, '_aditional_info_custom_boolean_3', esc_attr(strip_tags($_POST['_aditional_info_custom_boolean_3']))); } if(!isset($_POST['_aditional_info_custom_boolean_3'])) { update_post_meta($post_id, '_aditional_info_custom_boolean_3', 'false'); } // if(isset($_POST['_aditional_info_custom_boolean_4'])) { update_post_meta($post_id, '_aditional_info_custom_boolean_4', esc_attr(strip_tags($_POST['_aditional_info_custom_boolean_4']))); } if(!isset($_POST['_aditional_info_custom_boolean_4'])) { update_post_meta($post_id, '_aditional_info_custom_boolean_4', 'false'); } //Filter the submission with Akismet before sending notification email $send_email = true; if(defined('AKISMET_VERSION')) { if($tt_akismet) { require_once dirname(__FILE__) . '/Akismet.class.php'; if(null !== get_option('wordpress_api_key')) { $akismet = new tt_Akismet(get_site_url(), get_option('wordpress_api_key')); if($akismet->isKeyValid()) { $akismet->setCommentAuthor($_POST['postTitle']); if(isset($_POST['_aditional_info_email'])) { $akismet->setCommentAuthorEmail($_POST['_aditional_info_email']); } if(isset($_POST['_aditional_info_url'])) { $akismet->setCommentAuthorURL($_POST['_aditional_info_url']); } if(isset($_POST['_aditional_info_short_testimonial'])) { $akismet->setCommentContent($_POST['_aditional_info_short_testimonial']); } $akismet->setPermalink(get_permalink($post_id)); if($akismet->isCommentSpam()) { $send_email = false; wp_update_post(array( 'ID' => $post_id, 'post_status' => 'trash', 'post_title' => '[SPAM?] '.$_POST['postTitle'] )); } } } } } //Send Email if($tt_confirmation_email_on=='on' && $send_email) { $url = admin_url( 'post.php?post='.$post_id.'&action=edit'); $title = $postTitle; $text = sanitize_text_field($_POST['_aditional_info_short_testimonial']); $rating = isset($_POST['_aditional_info_rating']) ? sanitize_text_field($_POST['_aditional_info_rating']) : ''; $boolean = isset($_POST['_aditional_info_custom_boolean']) ? sanitize_text_field($_POST['_aditional_info_custom_boolean']) : ''; $boolean2 = isset($_POST['_aditional_info_custom_boolean_2']) ? sanitize_text_field($_POST['_aditional_info_custom_boolean_2']) : ''; $boolean3 = isset($_POST['_aditional_info_custom_boolean_3']) ? sanitize_text_field($_POST['_aditional_info_custom_boolean_3']) : ''; $boolean4 = isset($_POST['_aditional_info_custom_boolean_4']) ? sanitize_text_field($_POST['_aditional_info_custom_boolean_4']) : ''; $shorttitle = isset($_POST['_aditional_info_review_title']) ? sanitize_text_field($_POST['_aditional_info_review_title']) : ''; $taxonomy = ''; $email = isset($_POST['_aditional_info_email']) ? sanitize_text_field($_POST['_aditional_info_email']) : ''; $taxs = get_post_taxonomies( $post_id ); foreach ($taxs as $key => $value) { $tax = get_taxonomy( $value ); $term_list = wp_get_post_terms($post_id, $value, array("fields" => "names")); //print_r($term_list); $current = ''; foreach ($term_list as $tkey => $tvalue) { if($current!=$value) { $taxonomy .= $tax->labels->name.': '.$tvalue; $current = $value; } else { $taxonomy .= ', '.$tvalue; } } $taxonomy .= '
'; } //template tags /* {title} - Name of entry author {admin_url} - Link to the edit and approval page for this entry {text} - Entry submitted text {rating} - Rating for this entry {boolean} - Yes/No field {boolean2} - Yes/No field 2 {boolean3} - Yes/No field 3 {boolean4} - Yes/No field 4 {email} - Email {taxonomy} - Categories {short_title} - Title for Short Testimonial */ $template_search = array('{title}','{admin_url}','{text}','{rating}','{boolean}','{boolean2}','{boolean3}','{boolean4}','{taxonomy}','{email}','{short_title}'); $template_replace = array($title,$url,$text,$rating,$boolean,$boolean2,$boolean3,$boolean4,$taxonomy,$email,$shorttitle); $message_subject = str_replace($template_search,$template_replace, $tt_email_subject); $message_body = str_replace($template_search,$template_replace, $tt_email_body); $headers[] = 'Content-type: text/html'; $send_email = wp_mail( $tt_confirmation_email, $message_subject, nl2br($message_body) ,$headers); } if($send_email) { //email was sent } // Redirect if($tt_confirmation_url!='') { wp_redirect( $tt_confirmation_url ); exit; } else { if($tt_force_redirect) { global $wp; $current_url = home_url(add_query_arg(array( 'ttform' => 'success#ttform'),$wp->request)); wp_redirect( $current_url ); exit; } else { $extraclass = ''; if(isset($_POST['_aditional_info_custom_boolean'])){ $extraclass = 'ttshowcase_boolean_'.$_POST['_aditional_info_custom_boolean'].' '; } $form_html .= '
'.do_shortcode($tt_confirmation_text).'
'; } } } else { $form_html .= '
'.do_shortcode($tt_error_text).'
'; } } } if(isset($_GET['ttform'])) { $form_html .= '
'.do_shortcode($tt_confirmation_text).'
'; } if(!isset($_POST['tt_submitted']) || (isset($_POST['tt_submitted']) && $hasError)) { $html_array = array(); if($logged_on) { if(is_user_logged_in()) { $current_user = wp_get_current_user(); } else { $logged_on = false; } } $form_type = ''; if($image_on) { $form_type = 'enctype="multipart/form-data"'; } $form_html .= '
'; if($hasError) { $form_html .= '
'; $form_html .= do_shortcode($tt_error_text); $form_html .= '
'; } $tt_action = 'action="#ttform" method="POST"'; if($tt_ajax) { //$tt_action = 'onsubmit="tt_ajax_form(); return false;"'; $tt_action = 'onsubmit="return false;"'; $style .= ' tt_form_has_ajax'; } $form_html .= '
'; if(!$logged_on) { $name_form_html = ''; $name_form_html .= '
'; if ( isset($posttitleerror) && $posttitleerror != '' ) { $name_form_html .= ''.$posttitleerror.'
'; } $name_form_html .= '
'; $html_array['name'] = $name_form_html; } if($logged_on) { $name_form_html = ''; $name_form_html .= '
'; $html_array['name'] = $name_form_html; } if($subtitle_on) { $subtitle_form_html = ''; $subtitle_form_html .= '
'; if ( isset($aditionalinfoerror) && $aditionalinfoerror != '' ) { $subtitle_form_html .= ''.$aditionalinfoerror.'
'; } $subtitle_form_html .= '
'; $html_array['subtitle'] = $subtitle_form_html; /* Custom Made Drop Down $form_html .= '
';*/ } if($subtitle_url_on) { $url_form_html = ''; $url_form_html .= '
'; if ( isset($urlerror) && $urlerror != '' ) { $url_form_html .= ''.$urlerror.'
'; } $url_form_html .= '
'; $html_array['url'] = $url_form_html; } if($image_on) { $image_form_html = ''; $image_form_html .= '
'; } $image_form_html .='
'; $html_array['image'] = $image_form_html; //$html_array['image'] = '
Votre Photo
'; } if($r_title_on) { $title_form_html = ''; $title_form_html .= '
'; if ( isset($testimonialtitleerror ) && $testimonialtitleerror != '' ) { $title_form_html .= ''.$testimonialtitleerror.'
'; } $title_form_html .= '
'; $html_array['testimonialTitle'] = $title_form_html; } if($rating_on == 'on') { $rating_form_html = ''; $rating_form_html .= '
'; $html_array['rating'] = $rating_form_html; } if($rating_on == 'hover') { $rating_form_html = ''; wp_register_style( 'tthoverrating', plugins_url( 'hover-rating.css', __FILE__ ) ); wp_enqueue_style( 'tthoverrating' ); wp_register_style( 'tt-font-awesome', plugins_url( 'resources/font-awesome/css/font-awesome.min.css', dirname(__FILE__) ) ); wp_enqueue_style( 'tt-font-awesome' ); $tt_curr_selected = isset($_POST['_aditional_info_rating']) ? $_POST['_aditional_info_rating'] : $tt_initial_rating; $rating_form_html .= '
'; $maxrating = intval($scale); while ($maxrating > 1) { $rating_form_html .= ''; $maxrating--; } /* */ $rating_form_html .= '
'; $rating_form_html .= '
'; if ( isset($ratingerror ) && $ratingerror != '' ) { $rating_form_html .= ''.$ratingerror.'
'; } $html_array['rating'] = $rating_form_html; } $testimonial_form_html = ''; $testimonial_form_html .= '
'; if ( isset($testimonialerror) && $testimonialerror != '' ) { $testimonial_form_html .= ''.$testimonialerror.'
'; } $testimonial_form_html .='
'; $html_array['testimonial'] = $testimonial_form_html; if($long_testimonial_on) { $long_testimonial_form_html = ''; $long_testimonial_form_html .= '
'; if ( isset($longtestimonialerror) && $longtestimonialerror != '' ) { $long_testimonial_form_html .= ''.$longtestimonialerror.'
'; } $long_testimonial_form_html .='
'; $html_array['longTestimonial'] = $long_testimonial_form_html; } if($email_on && !$logged_on) { $email_form_html = ''; $email_form_html .= '
'; if ( isset($emailerror) && $emailerror != '' ) { $email_form_html .= ''.$emailerror.'
'; } $email_form_html .= '
'; $html_array['email'] = $email_form_html; } if($email_on && $logged_on) { $email_form_html = ''; $email_form_html .= '
'; $html_array['email'] = $email_form_html; } if($tt_honeypot) { $form_html .= ''; } /* CUSTOM BOOLEAN 01 */ if($boolean_field == 'on') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean']['options']; $yesno_form_html = ''; $yesno_form_html .= '
'; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_form_html .= ''.$booleanerror.'
'; } $yesno_form_html .= '
'; $html_array['yesOrNo'] = $yesno_form_html; } //boolean checkbox if($boolean_field == 'checkbox') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean']['options']; $yesno_form_html = ''; $yesno_form_html .= '
'; $tt_curr_selected = isset($_POST['_aditional_info_custom_boolean']) ? 'checked' : ''; $yesno_form_html .= ''; $yesno_form_html .= ''; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_form_html .= ''.$booleanerror.'
'; } $yesno_form_html .='
'; $html_array['yesOrNo'] = $yesno_form_html; } //boolean radio if($boolean_field == 'radio') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean']['options']; $yesno_form_html .= '
'; $html_array['yesOrNo'] = $yesno_form_html; } /* CUSTOM BOOLEAN 02 */ if($boolean_field_2 == 'on') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_2']['options']; $yesno_2_form_html = ''; $yesno_2_form_html .= '
'; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_2_form_html .= ''.$booleanerror.'
'; } $yesno_2_form_html .= '
'; $html_array['yesOrNo2'] = $yesno_2_form_html; } //boolean checkbox if($boolean_field_2 == 'checkbox') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_2']['options']; $yesno_2_form_html = ''; $yesno_2_form_html .= '
'; $tt_curr_selected = isset($_POST['_aditional_info_custom_boolean_2']) ? 'checked' : ''; $yesno_2_form_html .= ''; $yesno_2_form_html .= ''; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_2_form_html .= ''.$booleanerror.'
'; } $yesno_2_form_html .='
'; $html_array['yesOrNo2'] = $yesno_2_form_html; } //boolean radio if($boolean_field_2 == 'radio') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_2']['options']; $yesno_2_form_html .= '
'; $html_array['yesOrNo2'] = $yesno_2_form_html; } /* CUSTOM BOOLEAN 03 */ if($boolean_field_3 == 'on') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_3']['options']; $yesno_3_form_html = ''; $yesno_3_form_html .= '
'; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_3_form_html .= ''.$booleanerror.'
'; } $yesno_3_form_html .= '
'; $html_array['yesOrNo3'] = $yesno_3_form_html; } //boolean checkbox if($boolean_field_3 == 'checkbox') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_3']['options']; $yesno_3_form_html = ''; $yesno_3_form_html .= '
'; $tt_curr_selected = isset($_POST['_aditional_info_custom_boolean_3']) ? 'checked' : ''; $yesno_3_form_html .= ''; $yesno_3_form_html .= ''; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_3_form_html .= ''.$booleanerror.'
'; } $yesno_3_form_html .='
'; $html_array['yesOrNo3'] = $yesno_3_form_html; } //boolean radio if($boolean_field_3 == 'radio') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_3']['options']; $yesno_3_form_html .= '
'; $html_array['yesOrNo3'] = $yesno_3_form_html; } /* CUSTOM BOOLEAN 04 */ if($boolean_field_4 == 'on') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_4']['options']; $yesno_4_form_html = ''; $yesno_4_form_html .= '
'; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_4_form_html .= ''.$booleanerror.'
'; } $yesno_4_form_html .= '
'; $html_array['yesOrNo4'] = $yesno_4_form_html; } //boolean checkbox if($boolean_field_4 == 'checkbox') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_4']['options']; $yesno_4_form_html = ''; $yesno_4_form_html .= '
'; $tt_curr_selected = isset($_POST['_aditional_info_custom_boolean_4']) ? 'checked' : ''; $yesno_4_form_html .= ''; $yesno_4_form_html .= ''; if ( isset($booleanerror) && $booleanerror != '' ) { $yesno_4_form_html .= ''.$booleanerror.'
'; } $yesno_4_form_html .='
'; $html_array['yesOrNo4'] = $yesno_4_form_html; } //boolean radio if($boolean_field_4 == 'radio') { global $ttshowcase_options; $bool_opt = $ttshowcase_options['meta_boxes']['aditional_info']['fields']['custom_boolean_4']['options']; $yesno_4_form_html .= '
'; $html_array['yesOrNo4'] = $yesno_4_form_html; } if($verification == 'on') { if( !is_user_logged_in() || ( is_user_logged_in() && ($tt_human_verification_logged || is_admin() ) ) ) { $one = rand(50, 90); $two = rand(1, 9); $result = md5($one + $two); $verification_form_html = ''; $verification_form_html .= '
'.$one.' + '.$two.' = '; if (isset($verificationerror) && $verificationerror != '' ) { $verification_form_html .= '
'.$verificationerror.'
'; } $verification_form_html .= '
'; $html_array['humanVerification'] = $verification_form_html; } } if($verification == 'captcha') { if( !is_user_logged_in() || ( is_user_logged_in() && ($tt_human_verification_logged || is_admin() ) ) ) { $one = rand(50, 90); $two = rand(1, 9); $result = md5($one + $two); $image_key = tt_create_image($result); $word = $image_key['word']; $image_ash = $image_key['image']; $img_url = "data:image/png;base64,".$image_ash; $verification_form_html = ''; $verification_form_html .= '
'; if ( isset($verificationerror) && $verificationerror != '' ) { $verification_form_html .= ''.$verificationerror.'
'; } $html_array['humanVerification'] = $verification_form_html; } } if($category) { $category_form_html = ''; $category_form_html .= '
'; $args = array( 'echo' => false, 'taxonomy' => 'ttshowcase_groups', 'hide_empty' => false, 'name' => 'tt_taxonomy', 'id' => 'tt_taxonomy', 'orderby' => 'SLUG', 'order' => 'ASC' ); if($parent_category) { $args['hierarchical'] = true; $args['depth'] = 1; } if($in_category){ $args['include'] = $atts['in_category']; } if($child_of){ $args['child_of'] = $atts['child_of']; } if($taxonomy_on){ $tax_id = get_term_by('slug', $atts['taxonomy'], 'ttshowcase_groups'); if($tax_id){ $args['selected'] = $tax_id->term_id; } } $dropdown = wp_dropdown_categories( $args ); $category_form_html .= $dropdown; $category_form_html .= '
'; $html_array['category'] = $category_form_html; } //CUSTOM TAXONOMY FETCHING global $ttshowcase_options; if(count($ttshowcase_options['taxonomies'])>1) { $html_array['customTax'] = ''; $custom_tax_form_html = ''; foreach ($ttshowcase_options['taxonomies'] as $identifier => $data) { if($identifier=='groups') { continue; } if(isset($data['force_form']) && $data['force_form'] && taxonomy_exists('ttshowcase_'.$identifier)) { $tax = get_taxonomy('ttshowcase_'.$identifier); $custom_tax_form_html .= '
'; $args = array( 'echo' => false, 'taxonomy' => 'ttshowcase_'.$identifier, 'hide_empty' => false, 'name' => 'ttshowcase_'.$identifier, 'id' => 'ttshowcase_'.$identifier, 'orderby' => 'NAME', 'order' => 'ASC' ); $dropdown = wp_dropdown_categories( $args ); $custom_tax_form_html .= $dropdown; $custom_tax_form_html .= '
'; } } $html_array['customTax'] .= $custom_tax_form_html; } if($consent_on) { $consent_html = ''; $html_array['consent'] = $consent_html; } //To order the fields $field_order = explode(',',$tt_fields_order); foreach ($field_order as $field_key) { if(isset($html_array[$field_key])) { $form_html .= $html_array[$field_key]; } } //$form_html .= print_r(explode(',',$tt_fields_order)); /*global $ts_content_order; foreach ($ts_content_order as $info) { if(isset($info_array[$info])) { $html.=$info_array[$info]; } } */ //$form_html .= '
'; $form_html .= wp_nonce_field('post_nonce', 'post_nonce_field',true,false); //get the post id $this_post = get_post(); if(is_object($this_post)) { $current_page_id = $this_post->ID; } else { $current_page_id = 'null'; } $form_html .= ''; if($taxonomy_on && !$category) { $form_html .= ''; } $form_html .= ''; $form_html .= ''; $form_html .= ''; //$form_html .= '
'; $form_html .= '
'; $form_html .= '
'; if($logged_only) { if ( ! is_user_logged_in() ) { $form_html = $tt_loggedonly_text; } } //to try and avoid duplicated unset($_POST['tt_submitted']); } /* Temp fix for swipeTouch issue. Uncomment if needed */ // $form_html .= ''; /* End Temp Fix */ return do_shortcode($form_html); } function tt_create_image($ash) { global $tt_image; $tt_image = imagecreatetruecolor(150, 26) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($tt_image, 255, 255, 255); $text_color = imagecolorallocate($tt_image, 0, 255, 255); $line_color = imagecolorallocate($tt_image, 64, 64, 64); $pixel_color = imagecolorallocate($tt_image, 150, 150, 200); imagefilledrectangle($tt_image, 0, 0, 180, 26, $background_color); for ($i = 0; $i < 3; $i++) { imageline($tt_image, 0, rand() % 26, 180, rand() % 26, $line_color); } for ($i = 0; $i < 1000; $i++) { imagesetpixel($tt_image, rand() % 180, rand() % 26, $pixel_color); } $letters = 'ABCDEFGHIJKMNPQRTUVWXY346789'; $len = strlen($letters); $letter = $letters[rand(0, $len - 1)]; $text_color = imagecolorallocate($tt_image, 0, 0, 0); $word = ""; for ($i = 0; $i < 6; $i++) { $letter = $letters[rand(0, $len - 1)]; imagestring($tt_image, 5, 5 + ($i * 26), 10, $letter, $text_color); $word .= strtoupper($letter); } ob_start(); imagepng($tt_image); // Capture the output $imagedata = ob_get_contents(); // Clear the output buffer ob_end_clean(); imagedestroy($tt_image); $array_image = array(); $array_image['image'] = base64_encode($imagedata); $array_image['word'] = md5($word); return $array_image; } // In Development add_action('wp_ajax_nopriv_ttshowcase_ajax_form', 'ttshowcase_ajax_form_submit'); add_action('wp_ajax_ttshowcase_ajax_form', 'ttshowcase_ajax_form_submit'); function ttshowcase_ajax_form_submit() { //Process data submitted $atts = isset($_POST['tt_atts']) ? json_decode(base64_decode($_POST['tt_atts']),true) : array(); echo ttshowcase_build_form($atts,$_POST); exit(); } ?>ftI  h[+testimonials-showcase/form/hover-rating.css +Ѧ2.tt_rating { display:inline-block; vertical-align: middle; } #ttshowcase_form .tt_rating label { width:1em !important; font-size:200%; } /* :not(:checked) is a filter, so that browsers that don’t support :checked don’t follow these rules. Every browser that supports :checked also supports :not(), so it doesn’t make the test unnecessarily selective */ .tt_rating:not(:checked) > input { visibility:hidden; width:0px; height:0px; float:right; top: 100%; clip: rect(0,0,0,0); margin: 0; padding: 0; border:10px #fff solid; } .tt_rating:not(:checked) > label { float: right; display: block; width:1em; padding:0; margin: 0; overflow:hidden; white-space:nowrap; margin: 0; cursor:pointer; font-size:200%; line-height:1.2; color:#eee; } .tt_rating > input:checked ~ label { color: #f70; } .tt_rating:not(:checked) > label:hover, .tt_rating:not(:checked) > label:hover ~ label { color: gold; } .tt_rating > input:checked + label:hover, .tt_rating > input:checked + label:hover ~ label, .tt_rating > input:checked ~ label:hover, .tt_rating > input:checked ~ label:hover ~ label, .tt_rating > label:hover ~ input:checked ~ label { color: #ea0; }MIP o2testimonials-showcase/form/js/jquery.validation.js +Ѧ2/* jQuery( '#ttshowcase_form' ).submit(function( event ) { event.preventDefault(); }); */ jQuery(document).ready(function(){ jQuery('#ttshowcase_form.tt_form_has_ajax').submit(function( event ) { event.preventDefault(); }).find('.tt_form_button').one('click',function(){ tt_ajax_form(); console.log('form submitted'); }); }); function tt_ajax_form() { var form = jQuery('.ttshowcase_form_wrap form'); var wrapper = jQuery('.tt_form_container'); form.fadeTo( "slow" , 0.1, function() { wrapper.addClass('tt_loading'); var data = new FormData(document.getElementById("ttshowcase_form")); data.append("label", "WEBUPLOAD"); data.append("action", "ttshowcase_ajax_form"); jQuery.ajax({ url: ajax_object.ajax_url, type: "POST", data: data, contentType: false, cache: false, processData:false, success: function (response) { var el = wrapper; var elOffset = el.offset().top; var elHeight = el.height(); var windowHeight = jQuery(window).height(); var offset; if (elHeight < windowHeight) { offset = elOffset - ((windowHeight / 2) - (elHeight / 2)); } else { offset = elOffset; } jQuery('html, body').animate({scrollTop:offset-100}, 700, function() { wrapper.html(response).removeClass('tt_loading'); form.fadeTo( "slow" , 1, function() {}); jQuery('html, body').find('.tt_form_button').one('click',function(){ tt_ajax_form(); console.log('form submitted'); }); }); }, }); }); }ΰB FF @$testimonials-showcase/form/style.css +Ѧ2/* Error Message */ .ttshowcase_form_error { padding:15px; font-weight: bold; background:#FFF; color:red; margin-bottom:10px; } .ttshowcase_form_wrap .error { padding:15px; font-weight: bold; color:red; } /* Confirmation Message */ .ttshowcase_confirmation { padding:15px; font-weight: bold; } /* Captcha Image */ .tt_capimg { vertical-align: middle; } .tt_cap_input { width:80px !important; } /* global */ #ttshowcase_form label[for^='_aditional_info_custom_boolean'], #ttshowcase_form label[for^='_tts_consent'] { display:inline; padding-left: 5px; } #ttshowcase_form label.tt_radio_label { display:inline; } /* Simple Style*/ .tt_simple label { width:20%; text-align: left; font-weight: bold; display: inline-block; vertical-align: middle; } .tt_simple input:not([type=checkbox]):not([type=radio]), .tt_simple textarea, .tt_simple select { display: inline-block; margin: 0; padding: 1px 5px; min-height: 26px; } .tt_simple fieldset { padding:5px; } /* Style 01 .tt_style_1{background-color: #f73456;} */ .tt_style_1 label { width:26%; margin:0; padding: 0; text-align: left; display: inline-block; vertical-align: middle; } .tt_style_1 input:not([type=checkbox]):not([type=radio]), .tt_style_1 textarea { display: inline-block; width: 70%; margin: 0; padding: 1px 5px; min-height: 26px; } .tt_style_1 fieldset { padding:10px; border: 0; margin: 5px 0; } .tt_style_1 button { margin: 10px; border:0; text-shadow:none!important; font-weight:500; min-height:32px; text-transform:uppercase; text-align:center; -webkit-border-radius:3px; -moz-border-radius:3px; border-radius:3px; -webkit-box-shadow:0 1px 1px rgba(0,0,1,0.8); -moz-box-shadow:0 1px 1px rgba(0,0,1,0.8); box-shadow:0 1px 1px rgba(0,0,1,0.8); padding:0 20px; } .tt_style_1 button:hover{ cursor: pointer; -webkit-transition: background-color 400ms linear; -moz-transition: background-color 400ms linear; -o-transition: background-color 400ms linear; -ms-transition: background-color 400ms linear; transition: background-color 400ms linear; } .tt_style_1 fieldset:hover{ background: rgba(0, 0, 0, .05); -webkit-transition: background-color 800ms linear; -moz-transition: background-color 800ms linear; -o-transition: background-color 800ms linear; -ms-transition: background-color 800ms linear; transition: background-color 800ms linear; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } /* Style 02 .tt_style_2{background-color: #f3c876;} */ .tt_style_2 label { margin:0 4px; text-align: left; display: inline-block; vertical-align: middle; } .tt_style_2 input:not([type=checkbox]):not([type=radio]), .tt_style_2 textarea { width: 100%; padding:5px 2%; margin: 0; padding: 1px 5px; min-height: 26px; -webkit-border-radius:0; -moz-border-radius:0; border-radius:0; } .tt_style_2 input[type=checkbox] { width:20px; margin-right:10px; } .tt_style_2 button { margin: 10px 15px; border:0; text-shadow:none!important; font-weight:500; min-height:32px; text-transform:uppercase; text-align:center; -webkit-box-shadow:0 1px 1px rgba(0,0,1,0.8); -moz-box-shadow:0 1px 1px rgba(0,0,1,0.8); box-shadow:0 1px 1px rgba(0,0,1,0.8); padding:0 20px; -webkit-border-radius:0; -moz-border-radius:0; border-radius:0; } .tt_style_2 fieldset { padding: 8px 2%; border: 0; margin: 2px 0; } .tt_style_2 button:hover{ cursor: pointer; -webkit-transition: background-color 400ms linear; -moz-transition: background-color 400ms linear; -o-transition: background-color 400ms linear; -ms-transition: background-color 400ms linear; transition: background-color 400ms linear; } .tt_style_2 fieldset:hover{ background: rgba(0, 0, 0, .05); -webkit-transition: background-color 500ms linear; -moz-transition: background-color 500ms linear; -o-transition: background-color 500ms linear; -ms-transition: background-color 500ms linear; transition: background-color 500ms linear; } /* Style 03 .tt_style_3{background-color: #7f4564;} */ .tt_style_3 label { width:26%; text-align: left; display: inline-block; vertical-align: middle; } .tt_style_3 input:not([type=checkbox]):not([type=radio]), .tt_style_3 textarea, .tt_style_3 #featured_image { display: inline-block; width: 70%; margin: 0; padding: 1px 5px; min-height: 26px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } .tt_style_3 input[type=checkbox] { width:20px; margin-right:10px; } .tt_style_3 fieldset { padding:12px; border: 0; margin: 5px 0; } .tt_style_3 img { border-radius: 5px; -webkit-border-radius:5px; -moz-border-radius:5px; } .tt_style_3 button { margin: 10px; border:0; text-shadow:none!important; font-weight:500; min-height:32px; text-transform:uppercase; text-align:center; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; -webkit-box-shadow:0 1px 1px rgba(0,0,1,0.8); -moz-box-shadow:0 1px 1px rgba(0,0,1,0.8); box-shadow:0 1px 1px rgba(0,0,1,0.8); padding:0 20px; } .tt_style_3 button:hover{ cursor: pointer; -webkit-transition: background-color 400ms linear; -moz-transition: background-color 400ms linear; -o-transition: background-color 400ms linear; -ms-transition: background-color 400ms linear; transition: background-color 400ms linear; } .tt_style_3 fieldset:hover{ -webkit-transition: background-color 800ms linear; -moz-transition: background-color 800ms linear; -o-transition: background-color 800ms linear; -ms-transition: background-color 800ms linear; transition: background-color 800ms linear; background: -webkit-linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* For Safari */ background: -o-linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* For Firefox 3.6 to 15 */ background: linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* Standard syntax */ -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } /* Style 04 .tt_style_4{background-color: #5cf677;}*/ .tt_style_4 label { margin:0 4px; text-align: left; display: inline-block; vertical-align: middle; } .tt_style_4 input:not([type=checkbox]):not([type=radio]), .tt_style_4 textarea { width: 100%; padding:5px 2%; margin: 0; padding: 1px 5px; min-height: 26px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } .tt_style_4 input[type=checkbox] { width:20px; margin-right:10px; } .tt_style_4 img { border-radius: 5px; -webkit-border-radius:5px; -moz-border-radius:5px; } .tt_style_4 button { margin: 10px; border:0; text-shadow:none!important; font-weight:500; min-height:32px; text-transform:uppercase; text-align:center; -webkit-box-shadow:0 1px 1px rgba(0,0,1,0.8); -moz-box-shadow:0 1px 1px rgba(0,0,1,0.8); box-shadow:0 1px 1px rgba(0,0,1,0.8); padding:0 20px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } .tt_style_4 fieldset { padding: 8px 2%; border: 0; margin: 2px 0; } .tt_style_4 button:hover{ cursor: pointer; -webkit-transition: background-color 400ms linear; -moz-transition: background-color 400ms linear; -o-transition: background-color 400ms linear; -ms-transition: background-color 400ms linear; transition: background-color 400ms linear; } .tt_style_4 fieldset:hover{ -webkit-transition: background-color 800ms linear; -moz-transition: background-color 800ms linear; -o-transition: background-color 800ms linear; -ms-transition: background-color 800ms linear; transition: background-color 800ms linear; background: -webkit-linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* For Safari */ background: -o-linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* For Firefox 3.6 to 15 */ background: linear-gradient(rgba(0, 0, 0, .01), rgba(0, 0, 0, .2)); /* Standard syntax */ -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } /* Hide Honeypot */ #tt_hp_email_mandatory { display:none;} .tt_loading { } @media only screen and (max-width : 650px) { .ttshowcase_form_wrap label { width:100% !important; } .ttshowcase_form_wrap input[type="text"], .ttshowcase_form_wrap textarea { width:100% !important; } } ŦE e%testimonials-showcase/img/default.png +Ѧ2PNG  IHDRXsBIT|d pHYs  ~tEXtSoftwareAdobe Fireworks CS5.1HtEXtCreation Time06/07/13`Ȋ IDATxknY_`ƀg `HA䄊"J!e|"oMq&$JJE$4Mh*E973cg紎ߵIHF^YzV{:^/Ky>{b,c$k- mn70 3l&<,˴X,Ƶ:\WU4Mfq_6um5 W۶]I ?̲,MNeZ,T< !Ņ9sUe*=ڳ(p"Ls# er~r{VU$[-˺}&My# /axP4PYj٨( ǰX K#|royE=?N!eYt:p8w)BI7oT;(W4NRX{$\ %wrFϕÃ0a Pb aM+<$eyEq>:»$}k߇t$)։}sw߻z5<[YkcPgp^VX$.I3XE$[EH;H(CynYoz\GdQ"NcYE! rӓTWH2WMę)I%XLt:E Nǣ[,T' A?eZu]OFZ6ixc}9|ec( ]7BXqPk#-1[M %bV€N^wi~yakkx[jbf$y,\,Tj6"(EԵ23"!{}w,bTGiSU+X}/kw!p /r+?nskq,ۆ8B%iۀQHO34¢LSHƢy~`gY!k[(mRTt:iHGg+BkRއpM%trua<\%r=b@Nfj!SU.( ?C1=^HpPRP2^}C^û(0 Z-R;PMzs*_0*h{幻ĒGc:Cx(\ CR2qyPMƊQdLpfqs9D"CĻ"J3V!mٽ~0w֓ͣ~pPe<;sU #\.Xa\"TII*=g~݋E^#\?a (a=5ШΙ4 I@ V|8xAiK>jN( HEC//&>Fx\%Ң(lfH h=<^/Ɔء$yB5;уkqT^$x>?W[abHLD`c94GI8w @͈g׫UwÓ%lb(IF IdA\<$KVUV;d, OXB. a @4|lU#rab=~s*d٨sZ9K\IYʲ~.]ϲ,`4C6ECՎ "tÊhAAy .11K@X= ;㰄IH}a4ɚ+B;I"l  _Q(@zniw%><}\9T*u]JC۶Aa0@0J^eZSp<ècQ&,3ϊ1N I ̓Ac\>5\鸖˥f]rCui(z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> 2 u/_$\BCv< 5 ]s.,4&yUx~xw-bEDCĻHGKwFGEGME{EEKX,YFZ ={$vrK .3\rϮ_Yq*©L_wד+]eD]cIIIOAu_䩔)3ѩiB%a+]3='/40CiU@ёL(sYfLH$%Y jgGeQn~5f5wugv5k֮\۹Nw]m mHFˍenQQ`hBBQ-[lllfjۗ"^bO%ܒY}WwvwXbY^Ю]WVa[q`id2JjGէ{׿m>PkAma꺿g_DHGGu;776ƱqoC{P38!9 ҝˁ^r۽Ug9];}}_~imp㭎}]/}.{^=}^?z8hc' O*?f`ϳgC/Oϩ+FFGGόzˌㅿ)ѫ~wgbk?Jި9mdwi獵ޫ?cǑOO?w| x&mf2:Y~ pHYs  ?IDAT8NCA ED_1o@CJzJH s&sDK'3=4M Nu]$15+Ui.EYb}KL~Egj<V%:>M6Dߤvg//sK3p{ ߄#O`;U[K|ܝWKw$]s]FL`c-QPHx'\l+?eET`7I4Y>1697RpU` 7YLGl?;\{fe}IENDB`aB `/$testimonials-showcase/img/icon32.png +Ѧ2PNG  IHDR szztEXtSoftwareAdobe ImageReadyqe<DIDATxb?@&Zx=C{{ٳgs= @|!EEj/޽ë۷ uuuV@MSS"6uDY5А B񟜜?~`U3FmmZ0=O8IzzzL@7HRRrGGGί_}```Њwnnn.\"d!tddd6^t//,F .{p:#a7m$Mo뉋Kʸ|xݰb7:znn#g QQQ^膉\&:6lo߾͌%effFJϟ?A)]V|1gp<"^b>}zׯ׆JJJ ljI#EM `:fYfA\\|-(-Py"FhB4`ּ h\<<showcase_id = $id; $this->showcase_options = $options; foreach ($addons as $key => $value) { switch ($key) { case 'thumb-sizes': $this->build_custom_thumb_size($value); break; case 'admin-archive-columns': $this->build_admin_archive_colums($value); break; case 'move-editor-below': $this->move_editor_below($value); break; case 'single-page-filters': $this->single_page_filters($value); break; case 'single-template-filters': $this->single_template_filters($value); break; case 'vector-icon': $this->vector_icon_build($value); break; case 'font-icon': $this->font_icon_build($value); break; case 'admin-entries': $this->admin_entries($value); break; case 'admin-archive-taxonomy-filter': $this->admin_tax_filter($value); break; default: # code... break; } } } function admin_tax_filter($value) { $this->showcase_taxonomies = $value['taxonomies']; add_action( 'restrict_manage_posts', array($this,'taxonomy_filters') ); } function taxonomy_filters(){ global $typenow; // an array of all the taxonomyies you want to display. Use the taxonomy name or slug $taxonomies = array('ttshowcase_groups'); // must set this to the post type you want the filter(s) displayed on if( $typenow == $this->showcase_id ){ foreach ($taxonomies as $tax_slug) { $tax_obj = get_taxonomy($tax_slug); $tax_name = $tax_obj->labels->all_items; $terms = get_terms($tax_slug); if(count($terms) > 0) { echo ""; } } } } function single_page_filters($array) { foreach ($array as $key) { add_filter( 'the_content', $key ); } } function single_template_filters($array) { foreach ($array as $key) { add_filter( 'single_template', $key ); } } //small fix to move the custom boxes above the editor function move_editor_below($array) { $this->editor_boxes = $array; add_action('admin_footer',array($this,'admin_footer_trigger')); } function admin_entries($value) { $this->admin_entries_num = $value; add_filter('pre_get_posts', array(&$this,'cmshowcase_posts_per_page_admin')); } public function cmshowcase_posts_per_page_admin($wp_query) { if (is_post_type_archive( $this->showcase_id ) && is_admin() ) { $wp_query->set( 'posts_per_page', $this->admin_entries_num ); } } public function admin_footer_trigger() { global $post; if ( get_post_type($post) == $this->showcase_id) { ?> $value) { $crop = false; if ($value['crop'] == "true" || $value['crop'] == true ) { $crop = true; } $id = $this->showcase_id.'_'.$value['id']; add_image_size( $id, $value['width'], $value['height'], $crop); } } function build_admin_archive_colums($value) { $this->columns_values = $value; add_filter('manage_posts_columns', array(&$this,'columns_head')); add_action('manage_posts_custom_column', array(&$this,'columns_content'), 10, 2); add_filter( 'manage_edit-'.$this->showcase_id.'_sortable_columns', array(&$this,'ordering_columns') ); } //Add new column function columns_head($defaults) { global $post; if (isset($post->post_type) && $post->post_type == $this->showcase_id) { foreach ($this->columns_values as $key => $value) { $defaults[$key] = __($value['title'],$this->showcase_id); } } //$defaults = cmshowcase_translate_array($defaults,$this->showcase_id); return $defaults; } //set column content function columns_content($column_name, $post_ID) { global $post; if ($post->post_type == $this->showcase_id) { if(isset($this->columns_values[$column_name])){ $value = $this->columns_values[$column_name]; if($value['type']=='thumbnail'){ if($value['source']=='featured_image') { echo get_the_post_thumbnail($post_ID, array(50,50)); } } if($value['type']=='taxonomy'){ $term_list = wp_get_post_terms($post_ID, $value['source'], array("fields" => "names")); foreach ( $term_list as $term ) { echo $term.'
'; } } if($value['type']=='ID'){ echo $post_ID; } if($value['type']=='text'){ if(is_array($value['source'])) { $field_id_name = '_'.$value['source'][0].'_'.$value['source'][1]; $meta = get_post_custom( $post_ID ); if(isset($meta[$field_id_name])){ if(isset($value['limit'])) { echo substr($meta[$field_id_name][0], 0, $value['limit']).' (...)'; } else { echo $meta[$field_id_name][0]; } } } } if($value['type']=='order'){ if($value['source']=='menu_order') { echo $post->menu_order; } } } } } public function ordering_columns($columns) { $columns['menu_order'] = 'menu_order'; return $columns; } function font_icon_build($font) { $wp_version = floatval( get_bloginfo( 'version' ) ); if($wp_version >= 3.8) { $this->vector_font_icon = $font; add_action('admin_head', array(&$this,'font_icon')); } } function font_icon() { $icon = $this->vector_font_icon; $cpt = $this->showcase_id; echo ' '; } function vector_icon_build($icon) { $wp_version = floatval( get_bloginfo( 'version' ) ); if($wp_version <= 3.8) { $this->vector_icon = $icon; add_action( 'admin_head', array(&$this,'vector_icon_css') ); } } function vector_icon_css() { $icon = $this->vector_icon; $cpt = $this->showcase_id; ?> ÃL aI,testimonials-showcase/includes/class-cpt.php +Ѧ2post_type_name = strtolower( str_replace( ' ', '_', $id ) ); $this->post_type_args = $args; $this->post_type_names = $names; $this->tax_args = array(); $this->meta_box_args = array(); // Add action to register the post type, if the post type doesnt exist if( ! post_type_exists( $this->post_type_name ) ) { add_action( 'init', array( &$this, 'register_post_type' ) ); } // Save post hook $this->save(); } /* Constructor method which registers the post type */ public function register_post_type() { $name = __($this->post_type_names['singular'],$this->post_type_name); $plural = __($this->post_type_names['plural'],$this->post_type_name); $slug = __( $this->post_type_names['slug'], $this->post_type_name ); $passed_labels = array(); if(isset($this->post_type_args['labels'])) { // We go through the entries to make them translatable foreach ($this->post_type_args['labels'] as $key => $value) { $passed_labels[$key] = __($value,$this->post_type_name); } // In case there are wildcards, we run the function to replace wildcads with name $passed_labels = $this->build_label_names($this->post_type_names,$passed_labels); } //after building the labels, we set them again to the original array key $this->post_type_args['labels'] = $passed_labels; // default labels. $default_labels = array( 'name' => _x( $plural, 'post type general name', $this->post_type_name ), 'singular_name' => _x( $name, 'post type singular name', $this->post_type_name ), 'add_new' => __( 'Add New', $this->post_type_name ).' '.strtolower( $name ), 'add_new_item' => __( 'Add New', $this->post_type_name ).' '.$name, 'edit_item' => __( 'Edit', $this->post_type_name ) .' '. $name, 'new_item' => __( 'New' , $this->post_type_name ).' '. $name, 'all_items' => __( 'All', $this->post_type_name ).' '.$plural, 'view_item' => __( 'View', $this->post_type_name ) . $name, 'search_items' => __( 'Search', $this->post_type_name ).' '. $plural, 'not_found' => __( 'No result found', $this->post_type_name ), 'not_found_in_trash' => __( 'No result found', $this->post_type_name ), 'parent_item_colon' => '', 'menu_name' => $plural, 'slug' => $slug ); // We set some default and overwite them with the given arguments. $args = array_merge( // Default array( 'label' => $plural, 'labels' => $default_labels, 'public' => true, 'show_ui' => true, 'supports' => array( 'title', 'editor' ), 'show_in_nav_menus' => true, '_builtin' => false, ), // Given args $this->post_type_args ); // Register the post type register_post_type( $this->post_type_name, $args ); } /* Function to replace wildcards in labels */ function build_label_names($names,$labels) { $final = array(); if (array_key_exists('singular', $names)) { foreach ($labels as $key => $value) { $final[$key] = str_replace("%singular%", __($names['singular'],$this->post_type_name), $value); } } if (array_key_exists('plural', $names)) { foreach ($final as $key => $value) { $final[$key] = str_replace("%plural%", __($names['plural'],$this->post_type_name), $value); } } if (array_key_exists('slug', $names)) { $final['slug'] = $names['slug']; } return $final; } /* Method to attach the taxonomy to the post type */ public function add_taxonomy( $id, $names = array(), $args = array(), $labels = array(), $fields = array() ) { if( ! empty( $id ) ) { // We need to know the post type name, so the new taxonomy can be attached to it. $post_type_name = $this->post_type_name; // Taxonomy properties $taxonomy_id = $id; $taxonomy_names = $names; $taxonomy_labels = $labels; $taxonomy_args = $args; if( ! taxonomy_exists( $taxonomy_id ) ) { //get the names and translate them if possible $name = __($taxonomy_names['singular'],$this->post_type_name); $plural = __($taxonomy_names['plural'],$this->post_type_name); //print_r($passed_labels); // Default labels, overwrite them with the given labels. $labels = array_merge( // Default array( 'name' => _x( $plural, 'Taxonomy general name',$this->post_type_name ), 'singular_name' => _x( $name, 'Taxonomy singular name',$this->post_type_name ), 'search_items' => __( 'Search',$this->post_type_name ).' '. $plural, 'all_items' => __( 'All',$this->post_type_name ).' '. $plural, 'parent_item' => __( 'Parent',$this->post_type_name ) .' '. $name, 'parent_item_colon' => __( 'Parent',$this->post_type_name ) .' '. $name . ';', 'edit_item' => __( 'Edit',$this->post_type_name ) .' ' . $name, 'update_item' => __( 'Update',$this->post_type_name ) .' '. $name, 'add_new_item' => __( 'Add New',$this->post_type_name ) .' '. $name, 'new_item_name' => __( 'New',$this->post_type_name ), 'menu_name' => __( $plural, $this->post_type_name ), ), // Given labels $labels ); // Default arguments, overwitten with the given arguments $args = array_merge( // Default array( 'label' => $plural, 'labels' => $labels, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, '_builtin' => false, 'hierarchical' => true ), // Given $taxonomy_args ); $this->tax_args[$taxonomy_id] = $args; // Add the taxonomy to the post type add_action( 'init', array ($this,'register_tax')); } else { add_action( 'init', array($this, 'register_tax_for_this')); } /* // IN CASE WE NEED TO ADD CUSTOM FiELDS FOR TAXONOMY // CURRENTLY WORKS ON PHP 5.3+ //add custom fields if they exist if(!empty($fields)) { add_action( $taxonomy_id.'_add_form_fields', function() use ($taxonomy_id,$fields) { $this->taxonomy_add_new_meta_field($taxonomy_id,$fields); } ); add_action( $taxonomy_id.'_edit_form_fields', function() use ($taxonomy_id,$fields) { $this->taxonomy_edit_meta_field($taxonomy_id,$fields); } ); add_action( 'edited_'.$taxonomy_id, array($this,'save_taxonomy_custom_meta'), 10, 2 ); add_action( 'create_'.$taxonomy_id, array($this,'save_taxonomy_custom_meta'), 10, 2 ); } */ } } public function register_tax () { $post_type_name = $this->post_type_name; $tax_args = $this->tax_args; foreach ($tax_args as $tax_key => $args) { // We go through the entries to make them translatable foreach ($args['labels'] as $key => &$value) { $args['labels'][$key] = __($value,$this->post_type_name); } register_taxonomy( $tax_key, $post_type_name, $args ); } } public function register_tax_for_this() { $taxonomy_id = $this->taxonomy_id; $post_type_name = $this->post_type_name; register_taxonomy_for_object_type( $taxonomy_id, $post_type_name ); } //New Code for Taxonomy Fields //NEEDS TO BE IMPROVED TO CHECK FOR FIELD TYPES // Add term page public function taxonomy_add_new_meta_field($taxonomy,$fields) { // this will add the custom meta field to the add new term page foreach( $fields as $field => $args ) { $label = isset( $args['label'] ) ? __($args['label'],$this->post_type_name) : $field; ?>

post_type_name) : ''; $argsfinal = array(); $argsfinal['name'] = 'term_meta['.$field.']'; $argsfinal['id'] = 'term_meta['.$field.']'; $argsfinal['type'] = isset( $args['type'] ) ? $args['type'] : 'text'; $argsfinal['default'] = isset( $args['default'] ) ? $args['default'] : ''; $argsfinal['value'] = esc_attr( isset($term_meta[$field]) ) ? esc_attr( $term_meta[$field] ) : ''; $argsfinal['description'] = $description; $argsfinal['options'] = isset( $args['options'] ) ? $args['options'] : null; $argsfinal['size'] = isset( $args['size'] ) ? $args['size'] : null; call_user_func('cmshowcase_build_field_'.$argsfinal['type'], $argsfinal); ?>
$args ) { $label = isset( $args['label'] ) ? __($args['label'],$this->post_type_name) : $field; ?> post_type_name) : ''; $argsfinal = array(); $argsfinal['name'] = 'term_meta['.$field.']'; $argsfinal['id'] = 'term_meta['.$field.']'; $argsfinal['type'] = isset( $args['type'] ) ? $args['type'] : 'text'; $argsfinal['default'] = isset( $args['default'] ) ? $args['default'] : ''; $argsfinal['value'] = esc_attr( isset($term_meta[$field]) ) ? esc_attr( $term_meta[$field] ) : ''; $argsfinal['description'] = $description; $argsfinal['options'] = isset( $args['options'] ) ? $args['options'] : null; $argsfinal['size'] = isset( $args['size'] ) ? $args['size'] : null; call_user_func('cmshowcase_build_field_'.$argsfinal['type'], $argsfinal); ?> featured_image_meta_box = array(); $this->featured_image_meta_box['title'] = $title; $this->featured_image_meta_box['context'] = $context; $this->featured_image_meta_box['priority'] = $priority; add_action( 'do_meta_boxes', array($this, 'preset_meta_box_featured_image') ); } } public function preset_meta_box_featured_image () { $cpt_id = $this->post_type_name; $title = $this->featured_image_meta_box['title']; $context = $this->featured_image_meta_box['context']; $priority = $this->featured_image_meta_box['priority']; remove_meta_box( 'postimagediv', $cpt_id, 'side' ); add_meta_box( 'postimagediv', __($title,$this->post_type_name) , 'post_thumbnail_meta_box', $cpt_id, $context, $priority ); } /* Attaches meta boxes to the post type */ public function add_meta_box( $meta_id, $title, $description, $fields = array(), $context = 'normal', $priority = 'high' ) { if( ! empty( $meta_id ) ) { // We need to know the Post Type name again $post_type_name = $this->post_type_name; // Meta variables $box_id = $meta_id;//strtolower( str_replace( ' ', '_', $title ) ); $box_title = ucwords( str_replace( '_', ' ', $title ) ); $box_description= $description; $box_context = $context; $box_priority = $priority; // Make the fields global global $custom_fields; $custom_fields[$box_id] = $fields; $this->custom_cpt_fields[$box_id] = $fields; $this->meta_box_args[$box_id]['title'] = $box_title; $this->meta_box_args[$box_id]['description'] = $box_description; $this->meta_box_args[$box_id]['context'] = $box_context; $this->meta_box_args[$box_id]['priority'] = $box_priority; $this->meta_box_args[$box_id]['fields'] = $fields; //$box_id, $box_title, $box_description, $post_type_name, $box_context, $box_priority, $fields add_action( 'admin_init', array($this,'add_meta_boxes_execute')); } } public function add_meta_boxes_execute() { foreach ($this->meta_box_args as $box_id => $args) { //$box_id, $box_title, $box_description, $post_type_name, $box_context, $box_priority, $fields $box_title = $args['title']; $box_description = $args['description']; $post_type_name = $this->post_type_name; $box_context = $args['context']; $box_priority = $args['priority']; $fields = $args['fields']; //translate values $box_title = __($box_title,$this->post_type_name); add_meta_box( $box_id, $box_title, array ($this,'meta_boxes_process'), $post_type_name, $box_context, $box_priority, array( 'fields' => $fields, 'description' => $box_description ) ); } } public function meta_boxes_process($post, $data) { global $post; // Nonce field for some validation wp_nonce_field( plugin_basename( __FILE__ ), 'custom_post_type' ); // Get all inputs from $data $custom_fields = $data['args']['fields']; // Get Description and translate it $description = __($data['args']['description'],$this->post_type_name); // Get the saved values $meta = get_post_custom( $post->ID ); // Check the array and loop through it if( ! empty( $description ) ) { echo ''; if($description!='') { echo ''; } /* Loop through $custom_fields */ foreach( $custom_fields as $field => $args ) { $field_id_name = '_'.strtolower( str_replace( ' ', '_', $data['id'] ) ) . '_' . strtolower( str_replace( ' ', '_', $field ) ); //get the field and translate it $field_label = (isset($args['label']) ? __($args['label'],$this->post_type_name) : $field); $description = isset( $args['description'] ) ? __($args['description'],$this->post_type_name) : ''; echo ''; } echo "
'.$description.'
'; echo ''; $argsfinal = array(); $argsfinal['name'] = 'custom_meta['.$field_id_name.']'; $argsfinal['id'] = 'custom_meta['.$field_id_name.']'; $argsfinal['type'] = $args['type']; $argsfinal['default'] = isset( $args['default'] ) ? $args['default'] : ''; $argsfinal['value'] = maybe_unserialize((isset($meta[$field_id_name][0]) ? $meta[$field_id_name][0] : "")); $argsfinal['description'] = $description; $argsfinal['options'] = isset( $args['options'] ) ? $args['options'] : null; $argsfinal['size'] = isset( $args['size'] ) ? $args['size'] : null; call_user_func('cmshowcase_build_field_'.$argsfinal['type'], $argsfinal); echo '
"; } } /* Listens for when the post type being saved Needs to be improved for different types of fields */ public function save() { $post_type_name = $this->post_type_name; add_action( 'save_post_'.$post_type_name, array($this,'save_post_process'), 99); } public function save_post_process() { // Need the post type name again $post_type_name = $this->post_type_name; // Deny the wordpress autosave function if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return; if(isset($_POST['custom_post_type'])){ if ( ! wp_verify_nonce( $_POST['custom_post_type'], plugin_basename(__FILE__) ) ) return; } else { return; } global $post; if( isset( $_POST ) && isset( $post->ID ) && get_post_type( $post->ID ) == $post_type_name ) { global $custom_fields; //$this->custom_cpt_fields; //we changed global custom_fields to $this->custom_cpt_fields to fix bug of data not being saved on some ocasions // Loop through each meta box foreach( $this->custom_cpt_fields as $title => $fields ) { // Loop through all fields foreach( $fields as $label => $type ) { $field_id_name = '_'.strtolower( str_replace( ' ', '_', $title ) ) . '_' . strtolower( str_replace( ' ', '_', $label ) ); $value = isset($_POST['custom_meta'][$field_id_name]) ? $_POST['custom_meta'][$field_id_name] : ''; $field_id_name = '_'.strtolower( str_replace( ' ', '_', $title ) ) . '_' . strtolower( str_replace( ' ', '_', $label ) ); update_post_meta( $post->ID, $field_id_name, $value); } } } } } } ?>N P0testimonials-showcase/includes/class-layouts.php +Ѧ2cmshowcase_id = $id; foreach ($layouts as $layoutk => $layoutv) { require_once (dirname(__FILE__).'/../layouts/'.$layoutk.'/layout.php'); $constructor = $layoutv['class']; $this->layouts[$id][$layoutk] = new $constructor($this->cmshowcase_id); unset($constructor); } } } } ?>@/O NNiӀ1testimonials-showcase/includes/class-ordering.php +Ѧ2post_type; if($post_type=='ttshowcase') { // is post type sortable? $sortable = ( post_type_supports( $post_type, 'page-attributes' ) || is_post_type_hierarchical( $post_type ) ); // check permission if ( ! $sortable = apply_filters( 'simple_page_ordering_is_sortable', $sortable, $post_type ) ) { return; } // does user have the right to manage these post objects? if ( ! self::check_edit_others_caps( $post_type ) ) { return; } add_filter( 'views_' . $screen->id, array( __CLASS__, 'sort_by_order_link' ) ); // add view by menu order to views add_action( 'wp', array( __CLASS__, 'wp' ) ); add_action( 'admin_head', array( __CLASS__, 'admin_head' ) ); } } /** * when we load up our posts query, if we're actually sorting by menu order, initialize sorting scripts * CUSTOM CHANGED */ public static function wp() { if ( 0 === strpos( get_query_var('orderby'), 'menu_order' ) ) { $script_name = '/includes/js/ordering.js'; wp_enqueue_script( 'cmshowcase-ordering', plugins_url( $script_name, DIRNAME(__FILE__) ), array('jquery-ui-sortable'), '2.1', true ); wp_enqueue_style( 'cmshowcase-admin', plugins_url( '/includes/css/admin.css', DIRNAME(__FILE__) ) ); } } /** * Add page ordering help to the help tab */ public static function admin_head() { $screen = get_current_screen(); $screen->add_help_tab(array( 'id' => 'simple_page_ordering_help_tab', 'title' => 'Simple Page Ordering', 'content' => '

' . __( 'To reposition an item, simply drag and drop the row by "clicking and holding" it anywhere (outside of the links and form controls) and moving it to its new position.', 'ttshowcase' ) . '

', )); } public static function ajax_simple_page_ordering() { // check and make sure we have what we need if ( empty( $_POST['id'] ) || ( !isset( $_POST['previd'] ) && !isset( $_POST['nextid'] ) ) ) { die(-1); } // real post? if ( ! $post = get_post( $_POST['id'] ) ) { die(-1); } // does user have the right to manage these post objects? if ( ! self::check_edit_others_caps( $post->post_type ) ) { die(-1); } // badly written plug-in hooks for save post can break things if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { error_reporting( 0 ); } $previd = empty( $_POST['previd'] ) ? false : (int) $_POST['previd']; $nextid = empty( $_POST['nextid'] ) ? false : (int) $_POST['nextid']; $start = empty( $_POST['start'] ) ? 1 : (int) $_POST['start']; $excluded = empty( $_POST['excluded'] ) ? array( $post->ID ) : array_filter( (array) $_POST['excluded'], 'intval' ); $new_pos = array(); // store new positions for ajax $return_data = new stdClass; do_action( 'simple_page_ordering_pre_order_posts', $post, $start ); // attempt to get the intended parent... if either sibling has a matching parent ID, use that $parent_id = $post->post_parent; $next_post_parent = $nextid ? wp_get_post_parent_id( $nextid ) : false; if ( $previd == $next_post_parent ) { // if the preceding post is the parent of the next post, move it inside $parent_id = $next_post_parent; } elseif ( $next_post_parent !== $parent_id ) { // otherwise, if the next post's parent isn't the same as our parent, we need to study $prev_post_parent = $previd ? wp_get_post_parent_id( $previd ) : false; if ( $prev_post_parent !== $parent_id ) { // if the previous post is not our parent now, make it so! $parent_id = ( $prev_post_parent !== false ) ? $prev_post_parent : $next_post_parent; } } // if the next post's parent isn't our parent, it might as well be false (irrelevant to our query) if ( $next_post_parent !== $parent_id ) { $nextid = false; } $max_sortable_posts = (int) apply_filters( 'simple_page_ordering_limit', 50 ); // should reliably be able to do about 50 at a time if ( $max_sortable_posts < 5 ) { // don't be ridiculous! $max_sortable_posts = 50; } // we need to handle all post stati, except trash (in case of custom stati) $post_stati = get_post_stati(array( 'show_in_admin_all_list' => true, )); $siblings = new WP_Query(array( 'depth' => 1, 'posts_per_page' => $max_sortable_posts, 'post_type' => $post->post_type, 'post_status' => $post_stati, 'post_parent' => $parent_id, 'orderby' => 'menu_order title', 'order' => 'ASC', 'post__not_in' => $excluded, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'suppress_filters' => true, 'ignore_sticky_posts' => true, )); // fetch all the siblings (relative ordering) // don't waste overhead of revisions on a menu order change (especially since they can't *all* be rolled back at once) remove_action( 'pre_post_update', 'wp_save_post_revision' ); foreach( $siblings->posts as $sibling ) : // don't handle the actual post if ( $sibling->ID === $post->ID ) { continue; } // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order if ( $nextid === $sibling->ID ) { wp_update_post(array( 'ID' => $post->ID, 'menu_order' => $start, 'post_parent' => $parent_id, )); $ancestors = get_post_ancestors( $post->ID ); $new_pos[$post->ID] = array( 'menu_order' => $start, 'post_parent' => $parent_id, 'depth' => count( $ancestors ), ); $start++; } // if repositioned post has been set, and new items are already in the right order, we can stop if ( isset( $new_pos[$post->ID] ) && $sibling->menu_order >= $start ) { $return_data->next = false; break; } // set the menu order of the current sibling and increment the menu order if ( $sibling->menu_order != $start ) { wp_update_post(array( 'ID' => $sibling->ID, 'menu_order' => $start, )); } $new_pos[$sibling->ID] = $start; $start++; if ( !$nextid && $previd == $sibling->ID ) { wp_update_post(array( 'ID' => $post->ID, 'menu_order' => $start, 'post_parent' => $parent_id )); $ancestors = get_post_ancestors( $post->ID ); $new_pos[$post->ID] = array( 'menu_order' => $start, 'post_parent' => $parent_id, 'depth' => count($ancestors) ); $start++; } endforeach; // max per request if ( !isset( $return_data->next ) && $siblings->max_num_pages > 1 ) { $return_data->next = array( 'id' => $post->ID, 'previd' => $previd, 'nextid' => $nextid, 'start' => $start, 'excluded' => array_merge( array_keys( $new_pos ), $excluded ), ); } else { $return_data->next = false; } do_action( 'simple_page_ordering_ordered_posts', $post, $new_pos ); if ( ! $return_data->next ) { // if the moved post has children, we need to refresh the page (unless we're continuing) $children = get_posts(array( 'numberposts' => 1, 'post_type' => $post->post_type, 'post_status' => $post_stati, 'post_parent' => $post->ID, 'fields' => 'ids', 'update_post_term_cache' => false, 'update_post_meta_cache' => false, )); if ( ! empty( $children ) ) { die( 'children' ); } } $return_data->new_pos = $new_pos; die( json_encode( $return_data ) ); } /** * Append a sort by order link to the post actions * * CUSTOM CHANGED FOR SHOWCASE * * @param string $views * @return string */ public static function sort_by_order_link( $views ) { if(get_query_var('orderby') != 'menu_order') { $class = ( get_query_var('orderby') == 'menu_order title' ) ? 'current' : ''; $query_string = esc_url( remove_query_arg(array( 'orderby', 'order' )) ); $query_string = add_query_arg( 'orderby', urlencode('menu_order title'), $query_string ); $views['byorder'] = sprintf('%s', $query_string, $class, __("Sort by Order", 'ttshowcase')); } else { $views['byorder'] = __("Drag & Drop Ordering Activated", 'ttshowcase'); } return $views; } /** * Checks to see if the current user has the capability to "edit others" for a post type * * @param string $post_type Post type name * @return bool True or false */ private static function check_edit_others_caps( $post_type ) { $post_type_object = get_post_type_object( $post_type ); $edit_others_cap = empty( $post_type_object ) ? 'edit_others_' . $post_type . 's' : $post_type_object->cap->edit_others_posts; return apply_filters( 'simple_page_ordering_edit_rights', current_user_can( $edit_others_cap ), $post_type ); } } } ?>?ldO YY҈1testimonials-showcase/includes/class-settings.php +Ѧ2showcase_id = $id; $this->showcase_sections = $sections; $this->settings_page_title = $title; $this->menu_title = $menu_title; $this->capability = $capability; //We add the new menu entry add_action( 'admin_menu', array($this,'add_setings_page')); //Add the init hook to register the settings sections and fields add_action( 'admin_init', array($this, 'admin_init') ); //hook to call necessary scripts for the page to work properly add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); } public function add_setings_page() { $id = $this->showcase_id; $title = $this->settings_page_title; $menu_title = $this->menu_title; $capability = $this->capability; $parent_slug = 'edit.php?post_type='.$id; $page_title = __($title,$this->showcase_id); $menu_title = __($menu_title,$this->showcase_id); $capability = $capability; $slug = strtolower( str_replace( ' ', '_', $title ) ); $menu_slug = $id.'_'.$slug; $function = array($this, 'plugin_page'); add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); } /** * Enqueue scripts and styles */ function admin_enqueue_scripts() { wp_enqueue_script( 'jquery' ); //wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'thickbox' ); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' ); } /** * Init function where the sections and fields are registred * This needs to be called from a admin_init hook */ function admin_init() { $sections = $this->showcase_sections; foreach ( $sections as $section ) { if($section){ if(isset($section['section_id'])) { //check if it already exists if not add option if ( false == get_option( $section['section_id'] ) ) { add_option( $section['section_id'] ); } if ( isset($section['section_description']) && !empty($section['section_description']) ) { //first we translate the description $description = __($section['section_description'],$this->showcase_id); $description = '
'.$description.'
'; $callback = $description; //create_function('', 'echo "'.str_replace('"', '\"', $description).'";'); $callback = function() use ($description) { echo $description; }; } else { $callback = '__return_false'; } //We translate the title $title = isset($section['section_title']) ? __($section['section_title'],$this->showcase_id) : $section['section_id']; add_settings_section( $section['section_id'], $title, $callback, $section['section_id'] ); //register settings fields if(isset($section['fields'])) { foreach ( $section['fields'] as $fieldkey => $fieldvalues ) { $type = isset( $fieldvalues['type'] ) ? $fieldvalues['type'] : 'text'; $default = isset( $fieldvalues['default'] ) ? $fieldvalues['default'] : ''; //translate fields that can be translated $label = isset( $fieldvalues['label'] ) ? __($fieldvalues['label'],$this->showcase_id) : $fieldkey.'_'; $description = isset( $fieldvalues['description'] ) ? __($fieldvalues['description'],$this->showcase_id) : ''; $args = array( 'id' => $section['section_id'].'['.$fieldkey.']', 'type' => $fieldvalues['type'], 'description' => $description, 'name' => $section['section_id'].'['.$fieldkey.']', 'section' => $section['section_id'], 'size' => isset( $fieldvalues['size'] ) ? $fieldvalues['size'] : null, 'options' => isset( $fieldvalues['options'] ) ? cmshowcase_translate_array($fieldvalues['options'],$this->showcase_id) : '', 'default' => isset( $fieldvalues['default'] ) ? $fieldvalues['default'] : '', 'sanitize_callback' => isset( $fieldvalues['sanitize_callback'] ) ? $fieldvalues['sanitize_callback'] : '', 'value' => cmshowcase_get_option( $fieldkey, $section['section_id'], $default ) ); add_settings_field( $section['section_id'] . '[' . $fieldkey . ']', $label, 'cmshowcase_build_field_'.$fieldvalues['type'], $section['section_id'], $section['section_id'], $args ); //if the translation is enabled, we register it here if(isset($fieldvalues['translate']) && $fieldvalues['translate']) { $title = $fieldvalues['label']; $value = cmshowcase_get_option( $fieldkey, $section['section_id'], $fieldvalues['default'] ); $domain = $this->showcase_id; tts_register_for_translation($title,$value,$domain); } } } register_setting( $section['section_id'], $section['section_id'], array( $this, 'sanitize_options' ) ); } } } } function plugin_page() { echo '
'; echo '

'; echo '

' . __($this->settings_page_title,$this->showcase_id) . '

'; if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true') { $updated = __('Settings Updated',$this->showcase_id); echo '

'.$updated.'

'; } $this->show_navigation(); $this->show_forms(); echo '
'; } /** * Show navigations as tab * * Shows all the settings section labels as tab */ function show_navigation() { $html = ''; echo $html; } /** * Show the section settings forms * * This function displays every sections in a different form */ function show_forms() { ?>
showcase_sections as $form ) { ?>
script(); } /** * Tabbable JavaScript codes * * This code uses localstorage for displaying active tabs */ function script() { ?> İaS  ^a3testimonials-showcase/includes/class-shortcodes.php +Ѧ2showcase_id = $id; $this->generator = $shortcodes['generator']; // Build Layouts object array $this->add_layouts($layouts); /* if(isset($shortcodes['shortcodes'])){ $this->shortcodes = $shortcodes['shortcodes']; $this->add_new_shortcode($shortcodes['shortcodes']); } */ if(isset($shortcodes['generator'])) { $this->add_new_generator($shortcodes['generator']); //add the preview function add_action( 'wp_ajax_cmshowcase', array($this,'generator_ajax_function')); add_action( 'wp_ajax_cmshowcase_save_shortcode', array($this,'generator_ajax_function')); add_action( 'wp_ajax_cmshowcase_view_shortcodes', array($this,'generator_ajax_function')); add_action( 'wp_ajax_cmshowcase_load_shortcode', array($this,'generator_ajax_function')); add_action( 'wp_ajax_cmshowcase_delete_shortcode', array($this,'generator_ajax_function')); //add the shortcodes if(isset($shortcodes['generator']['generators'])) { $this->shortcodes = $shortcodes['generator']['generators']; $this->add_new_shortcode($shortcodes['shortcodes']); } } /* In case we include the layouts in the shortcodes array if(isset($shortcodes['layouts'])){ $this->add_layouts($shortcodes['layouts']); } */ } public function generator_ajax_function() { $update_shortcodes = false; $unique = true; if($_POST['action'] == 'cmshowcase_load_shortcode') { $saved_shortcodes = get_option($this->showcase_id.'_saved_shortcodes',array()); $name = stripslashes($_POST['name']); $generator = $_POST['generator']; if(isset($saved_shortcodes[$generator][$name])) { echo $saved_shortcodes[$generator][$name]; } die(); } if($_POST['action'] == 'cmshowcase_delete_shortcode') { $update_shortcodes = true; // needed variables $name = stripslashes($_POST['name']); $generator = $_POST['generator']; $saved_shortcodes = get_option($this->showcase_id.'_saved_shortcodes',array()); if(isset($saved_shortcodes[$generator][$name])) { unset($saved_shortcodes[$generator][$name]); } $new_saved_shortcodes = update_option($this->showcase_id.'_saved_shortcodes',$saved_shortcodes); } if($_POST['action'] == 'cmshowcase_save_shortcode') { $update_shortcodes = true; // needed variables $shortcode = stripslashes($_POST['shortcode']); $name = stripslashes($_POST['name']); $generator = $_POST['generator']; $override = $_POST['override_name']; $saved_shortcodes = get_option($this->showcase_id.'_saved_shortcodes',array()); if($override!='null') { $saved_shortcodes[$generator][$override] = $shortcode; $new_saved_shortcodes = update_option($this->showcase_id.'_saved_shortcodes',$saved_shortcodes); } else { //check if alias already exists if(isset($saved_shortcodes[$generator])) { foreach ($saved_shortcodes[$generator] as $s_name => $s_short) { if($s_name == $name) { $unique = false; } } } //print_r($saved_shortcodes); //only adds new value if alias is unique if($unique) { $saved_shortcodes[$generator][$name] = $shortcode; $new_saved_shortcodes = update_option($this->showcase_id.'_saved_shortcodes',$saved_shortcodes); } } } if($_POST['action'] == 'cmshowcase_view_shortcodes' || $update_shortcodes) { $generator = $_POST['generator']; $trigger = $_POST['shortcode_trigger']; $saved_shortcodes = get_option($this->showcase_id.'_saved_shortcodes',''); if(isset($saved_shortcodes[$generator]) && count($saved_shortcodes[$generator]) > 0) { $saved_title = __('Saved Shortcodes',$this->showcase_id); //If visual composer is active if ( defined( 'WPB_VC_VERSION' ) ) { $saved_title .= ''.__('These will display in the Visual Composer options.',$this->showcase_id).''; } $html = '
'. $saved_title.'
'; $html .= ''; asort($saved_shortcodes[$generator]); foreach ($saved_shortcodes[$generator] as $s_name => $s_short) { $html .= ''; } $html .= '
'.$s_name.''.__('Load',$this->showcase_id).''.__('Delete',$this->showcase_id).'
'; if(!$unique) { $html = '
'.__('Alias name already exists. Please use a diferent one',$this->showcase_id).'

'.$html; } //$html .= ''.__('You can use the saved shortcodes Alias in your posts, pages and widgets instead of the long descriptive shortcodes.',$this->showcase_id).''; echo $html; } die(); // this is required to return a proper result } if($_POST['action'] == 'cmshowcase') { // to add the preview function $shortcode = stripslashes($_POST['shortcode']); $html = do_shortcode($shortcode); echo $html; die(); // this is required to return a proper result } } function add_new_generator($opt) { $id = $this->showcase_id; $this->title = isset($opt['menu_title']) ? $opt['menu_title'] : __('Shortcode Generator',$id); $this->menu_title = isset($opt['menu_title']) ? $opt['menu_title'] : __('Shortcode Generator',$id); $this->description = isset($opt['description']) ? $opt['description'] : ''; $this->capability = isset($opt['capability']) ? $opt['capability'] : 'manage_options'; //We add the new menu entry add_action( 'admin_menu', array($this,'add_generator_page')); } function add_generator_page() { $id = $this->showcase_id; $title = $this->title; $menu_title = $this->menu_title; $capability = $this->capability; $parent_slug = 'edit.php?post_type='.$id; $page_title = __($title,$id); $menu_title = __($menu_title,$id); $capability = $capability; $slug = strtolower( str_replace( ' ', '_', $title ) ); $menu_slug = $id.'_'.$slug; $function = array($this, 'generator_page'); add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); } function generator_page() { $this->enqueue_generator_scripts(); $generator = $this->generator; // Enqueue scripts from layouts foreach ($this->layouts as $object) { foreach ($object as $layout) { if(isset($layout->enqueue_files)) { cmshowcase_enqueue_layout_scripts($layout->enqueue_files); } } } //Check if custom layouts exist, create object and enqueue files $gens_check = $generator['generators']; foreach ($gens_check as $gen => $val) { if (isset($val['type']) && $val['type'] == 'custom') { if(isset($val['class'])) { $custom_gen[$gen] = new $val['class']($this->showcase_id); $custom = $custom_gen[$gen]; if(isset($custom->enqueue_files)) { cmshowcase_enqueue_layout_scripts($custom->enqueue_files); } } } } echo '

'; echo "

". __($generator['page_title'],$this->showcase_id) ."

"; if(isset($generator['intro_text'])) { echo "
".__($generator['intro_text'],$this->showcase_id)."
"; } if(count($generator['generators'])>1) { $available_label = isset($generator['pre_nav_label']) ? $generator['pre_nav_label'] : 'Available Generators'; ?>
showcase_id);?> $val) { $gen_title = isset($val['title']) ? $val['title'] : 'Generator'; $gen_id = trim($gen); ?> showcase_id); ?>
$values) { $generator_id = trim($generator); $generator_title = isset($values['title']) ? $values['title'] : ''; $generator_description = isset($values['description']) ? $values['description'] : ''; $query_title = isset($values['labels']['query']) ? $values['labels']['query'] : 'What entries to display'; $layout_title = isset($values['labels']['layout']) ? $values['labels']['layout'] : 'How to display the entries'; $shortcode_label = isset($values['labels']['shortcode']) ? $values['labels']['shortcode'] : 'Shortcode'; $php_label = isset($values['labels']['php']) ? $values['labels']['php'] : 'Get PHP function'; $load_label = isset($values['labels']['load_shortcode']) ? $values['labels']['load_shortcode'] : 'Place a shortcode here to load it'; $shortcode_title_label = isset($values['labels']['shortcode_title']) ? $values['labels']['shortcode_title'] : 'Shortcode'; $preview_title_label = isset($values['labels']['preview_title']) ? $values['labels']['preview_title'] : 'Preview'; $preview_description_label = isset($values['labels']['preview_description']) ? $values['labels']['preview_description'] : ''; $preview_light_bg_label = isset($values['labels']['preview_light_bg']) ? $values['labels']['preview_light_bg'] : 'Light Background'; $preview_dark_bg_label = isset($values['labels']['preview_dark_bg']) ? $values['labels']['preview_dark_bg'] : 'Dark Background'; $gen_type = isset($values['type']) ? $values['type'] : 'layout'; ?>
showcase_id); ?>
' /> $args) { //functions are defined in the utils-advanced.php file call_user_func('cmshowcase_build_shortcode_field_'.$input, $this->showcase_id, $args); } } ?> options)) { foreach ($customg->options as $key => $value) { if(isset($value['type']) && ($value['type'] == 'seperator' || $value['type'] == 'html' || $value['type'] == 'html_bold' || $value['type'] == 'hidden' || $value['type'] == 'hidden_html')) { if(isset($value['type']) && $value['type'] == 'seperator') { echo ''; } if(isset($value['type']) && $value['type'] == 'html') { echo ''; } if(isset($value['type']) && $value['type'] == 'html_bold') { echo ''; } if(isset($value['type']) && $value['type'] == 'hidden') { $args = array(); $args['generator'] = $generator_id; $args['id'] = $key; $args['type'] = isset( $value['type'] ) ? $value['type'] : 'text'; $args['default'] = isset( $value['default'] ) ? $value['default'] : ''; $args['value'] = isset( $value['value'] ) ? $value['value'] : $default; call_user_func('cmshowcase_build_field_'.$args['type'], $args); } if(isset($value['type']) && $value['type'] == 'hidden_html') { $args = array(); $args['generator'] = $generator_id; $args['id'] = $key; $args['type'] = isset( $value['type'] ) ? $value['type'] : 'text'; $args['default'] = isset( $value['default'] ) ? $value['default'] : ''; $args['value'] = isset( $value['value'] ) ? $value['value'] : $default; call_user_func('cmshowcase_build_field_'.$args['type'], $args); } } else { ?>

showcase_id); ?>

showcase_id); ?>

showcase_id); ?> query_var); $args['default'] = ''; $args['description'] = ''; $args['onchange'] = 'cmshowcase_display_layout_options(this)'; $opt = array(); foreach ($this->layouts as $object) { foreach ($object as $layout) { $opt[$layout->layout_id] = $layout->layout_name; } } $args['options'] = cmshowcase_translate_array($opt,$this->showcase_id); cmshowcase_build_field_select( $args ); ?>
'.__($value['label'],$this->showcase_id).'
'.__($value['label'],$this->showcase_id).'
showcase_id); ?> showcase_id) : ''; $args['options'] = isset( $value['options'] ) ? cmshowcase_translate_array($value['options'],$this->showcase_id) : null; $args['size'] = isset( $value['size'] ) ? $value['size'] : null; $args['onchange'] = "cmshowcase_build_shortcode('".$generator_id."')"; $args['extra_options'] = isset( $value['extra_options'] ) ? $value['extra_options'] : false; //for taxonomies $args['cpt'] = $this->showcase_id; $args['none_label'] = isset( $value['none_label'] ) ? $value['none_label'] : 'None'; call_user_func('cmshowcase_build_field_'.$args['type'], $args); ?>
layouts as $object) { foreach ($object as $layout) { ?>

showcase_id); ?>

  • Shortcode
  • PHP
  • Load Shortcode
showcase_id); ?>
showcase_id); ?> showcase_id); $saved_alias = cmshowcase_get_saved_shortcodes($this->showcase_id,$generator_id); ?> showcase_id); ?>

showcase_id); ?>

showcase_id); ?>
 
 
admin_url( 'admin-ajax.php' ) )); } function add_new_shortcode($values) { add_filter( 'widget_text', 'do_shortcode' ); add_filter( 'the_excerpt', 'do_shortcode' ); foreach ($values as $shortcode => $value) { if(isset($value['callback'])) { add_shortcode( $shortcode , $value['callback'] ); // add_shortcode( $shortcode , array( $this->showcase_object ,'shortcode_handler') ); } } } function add_layouts($layouts){ foreach ($layouts as $layoutk => $layoutv) { require_once (dirname(__FILE__).'/../layouts/'.$layoutk.'/layout.php'); $constructor = $layoutv['class']; $this->layouts[$this->showcase_id][$layoutk] = new $constructor($this->showcase_id); unset($constructor); } } } } ?>h3V z&8testimonials-showcase/includes/class-visual-composer.php +Ѧ2showcase_id = $id; $this->title = $title; $this->description = $description; $this->shortcode = $shortcode; // We safely integrate with VC with this hook add_action( 'init', array( $this, 'integrateWithVC' ) ); } public function integrateWithVC() { // Check if Visual Composer is installed if ( !defined('WPB_VC_VERSION') || !function_exists('vc_map')) { // Display notice that Visual Compser is required // add_action('admin_notices', array( $this, 'showVcVersionNotice' )); return; } $manage_url = get_admin_url().'edit.php?post_type='.$this->showcase_id.'&page='.$this->showcase_id.'_shortcode_generator'; $description = __("Choose one of the previously saved shortcode Alias.
Click here to go to your shortcode generator page", $this->showcase_id); $saved_shortcodes = get_option($this->showcase_id.'_saved_shortcodes',array()); $options = array(); $options[__('Please select...',$this->showcase_id)] = 'null'; $i = 0; if(count($saved_shortcodes)>0) { foreach ($saved_shortcodes as $shortcode) { foreach ($shortcode as $key => $value) { $options[$key] = $key; $i++; } } } if($i == 0) { $description = __("Looks like you don't have any saved shortcode Alias.
Click here to go to your shortcode generator page.", $this->showcase_id); } if(function_exists('vc_map')) { vc_map( array( "name" => __($this->title, $this->showcase_id), "description" => __($this->description, $this->showcase_id), "base" => $this->shortcode, "class" => "", //"front_enqueue_css" => plugins_url('resources/global.css', dirname(__FILE__)), "front_enqueue_js" => plugins_url('js/visual_composer.js', __FILE__), "icon" => plugins_url('img/icon32.png', dirname(__FILE__)), "category" => __('Content', 'ttshowcase'), "params" => array( array( "admin_label" => true, "type" => "dropdown", "holder" => "hidden", "class" => "", "heading" => __("Saved shortcode to display", $this->showcase_id), "param_name" => "alias", "value" => $options, "description" => $description ) ), "custom_markup" => "", )); } //close integrateWithVC } //close class } ?>M r+/testimonials-showcase/includes/class-widget.php +Ѧ2 'ttshowcase_widget', 'description' => __('Display saved Testimonials Layout','ttshowcase') ); parent::__construct( 'ttshowcase_widget', __('Testimonials','ttshowcase'), $widget_ops); } public function widget($args, $instance) { extract($args); $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $shortcode = isset($instance['shortcode']) ? $instance['shortcode'] : '[show-testimonials]'; $return = ''; $return .= $before_widget; if (!empty($title)) $return .= $before_title . $title . $after_title; if($shortcode != '') { $saved_shortcodes = get_option('ttshowcase_saved_shortcodes',array()); foreach ($saved_shortcodes as $sh) { foreach ($sh as $key => $value) { if($key == $shortcode) { $return .= do_shortcode($value); } } } } $return .= $after_widget; echo $return; } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['shortcode'] = $new_instance['shortcode']; return $instance; } public function form($instance) { $instance = wp_parse_args((array)$instance, array( 'title' => '', 'shortcode' => '' )); $title = strip_tags($instance['title']); $shortcode = isset($instance['shortcode']) ? $instance['shortcode'] : ''; echo '

'; $saved_shortcodes = get_option('ttshowcase_saved_shortcodes',array()); if(count($saved_shortcodes)>0) { echo '

'; echo "

".__('You can select the shortcode layouts previously saved using the Shortcode Generator.','ttshowcase')."

"; } else { echo "

".__('Please create a layout shortcode first','ttshowcase')."

"; } } } add_action( 'widgets_init', 'register_ttshowcase_widget' ); /** * Register widget * * This functions is attached to the 'widgets_init' action hook. */ function register_ttshowcase_widget() { if( 'layerswp' != get_template() ) { register_widget( 'ttshowcase_Widget' ); } } ?> )~Q VVq;P3testimonials-showcase/includes/cmshowcase-class.php +Ѧ2cmshowcase_id = $id; $this->cmshowcase_options = $options; $this->layouts = array(); //set support for thumbnails for this custom post type add_action( 'init', array($this,'thumbnail_support')); //First thing we do, if options/settings exist, we //check if any setting should be used to construct the Custom Post Type if (array_key_exists('options', $this->cmshowcase_options)) { $this->cmshowcase_options = $this->build_options($this->cmshowcase_options); } //Get the Names $names = array(); if (array_key_exists('names', $this->cmshowcase_options)) { $names = $this->cmshowcase_options['names']; } else { //set default names if array doesn't exist $names['singular'] = $id; $names['plural'] = $id; $names['slug'] = strtolower( str_replace( ' ', '_', $id ) ); } //Gets the arguments to be used when building the custom post type $args = array(); if (array_key_exists('args', $this->cmshowcase_options)) { $args = $this->cmshowcase_options['args']; } //We now have all the necessary parameters and we can //build the Custom Post Type $cpt = new cmshowcase_custom_post_type($id,$args,$names); //Now we check if there are custom fields to be created if (array_key_exists('meta_boxes', $this->cmshowcase_options)) { foreach ($this->cmshowcase_options['meta_boxes'] as $fieldkey => $fieldvalue) { $cpt_id = $this->cmshowcase_id; $metabox_id = $fieldkey; $title = (isset($fieldvalue['title'])) ? $fieldvalue['title'] : $fieldkey; $description = (isset($fieldvalue['description'])) ? $fieldvalue['description'] : ''; $fields = (isset($fieldvalue['fields'])) ? $fieldvalue['fields'] : array(); $context = (isset($fieldvalue['context'])) ? $fieldvalue['context'] : 'normal'; $priority = (isset($fieldvalue['priority'])) ? $fieldvalue['priority'] : 'high'; //if it's a preset meta box if(isset($fieldvalue['preset'])) { $cpt->add_preset_meta_box($cpt_id, $fieldvalue['preset'], $title, $context, $priority); } //build custom meta box else { $cpt->add_meta_box($metabox_id,$title,$description,$fields,$context,$priority); } } } //add taxonomies if (array_key_exists('taxonomies', $this->cmshowcase_options)) { foreach ($this->cmshowcase_options['taxonomies'] as $taxkey => $taxvalue) { $taxid = $id.'_'.strtolower( str_replace( ' ', '_', $taxkey ) ); //Get the Names $names = array(); if ($taxvalue['names']) { $names = $taxvalue['names']; } else { //set default names if array doesn't exist $names['singular'] = ucwords($taxkey); $names['plural'] = ucwords($taxkey); $names['slug'] = $taxid; } $args = array(); if(isset($taxvalue['args'])) { $args = $taxvalue['args']; } $labels = array(); if(isset($taxvalue['labels'])) { $labels = $taxvalue['labels']; } $fields = array(); if(isset($taxvalue['fields'])) { $fields = $taxvalue['fields']; } //Build the Taxonomies $cpt->add_taxonomy( $taxid, $names, $args, $labels, $fields ); } //We set the final options array to the global array global $cmshowcase; $cmshowcase[$id] = $this->cmshowcase_options; } //add extra addon features if (array_key_exists('addons', $this->cmshowcase_options)) { //addons class require_once dirname( __FILE__ ) . '/class-addons.php'; $addons = new cmshowcase_addons($id,$this->cmshowcase_options['addons'],$this->cmshowcase_options); } // Build Options/Settings Page if (array_key_exists('options', $this->cmshowcase_options)) { $this->add_settings_page($this->cmshowcase_options['options']); } } public function add_settings_page($options){ //add options if (is_array($options)) { $id = $this->cmshowcase_id; foreach ($options as $optkey => &$opt) { $title = isset($opt['menu_title']) ? $opt['menu_title'] : $optkey; $menu_title = isset($opt['menu_title']) ? $opt['menu_title'] : $optkey; $description = isset($opt['description']) ? $opt['description'] : ''; $capability = isset($opt['capability']) ? $opt['capability'] : 'manage_options'; $sections = array(); //we reorder the sections if(isset($opt['sections'])){ $opt['sections'] = $this->order_sections($opt['sections']); } //we prepare the section array so they have a unique identifier (section_id) if(isset($opt['sections'])){ foreach ($opt['sections'] as $key => &$value) { if(isset($value['section_id'])) { $value['section_id'] = $id.'_'.$value['section_id']; } else { $value['section_id'] = $id.'_'.$key; } } $sections = isset($opt['sections']) ? $opt['sections'] : array(); } $settings = new cmshowcase_settings($id,$title,$menu_title,$capability,$description,$sections); } } } function thumbnail_support() { global $_wp_theme_features; if (isset($_wp_theme_features['post-thumbnails']) && $_wp_theme_features['post-thumbnails'] == 1) { return; } if (isset($_wp_theme_features['post-thumbnails'][0]) && is_array($_wp_theme_features['post-thumbnails'][0]) && count($_wp_theme_features['post-thumbnails'][0]) >= 1) { array_push($_wp_theme_features['post-thumbnails'][0], $this->cmshowcase_id ); return; } if (empty($_wp_theme_features['post-thumbnails'])) { $_wp_theme_features['post-thumbnails'] = array( array( $this->cmshowcase_id ) ); return; } } function order_sections($sections) { $sorter=array(); $ret=array(); reset($sections); foreach ($sections as $ii => $va) { $sorter[$ii]=$va['section_order']; } asort($sorter); foreach ($sorter as $ii => $va) { $ret[$ii]=$sections[$ii]; } $sections = $ret; return $sections; } function build_options($options) { $return = $options; // go throw all sub arrays to reach the fields array foreach ($options['options'] as $settings) { if(isset($settings['sections'])){ foreach ($settings['sections'] as $section_id => $section) { if(isset($section['fields'])){ $section_cpt_id = $this->cmshowcase_id.'_'.$section_id; foreach ($section['fields'] as $id => $field) { //once we reach the fields array, if there is a key 'use_as' //we change the array values with the options set if(isset($field['use_as'])) { $option = $id; $default = (isset($field['default']) ? $field['default'] : ''); switch ($field['use_as']) { case 'singular': $return['names']['singular'] = cmshowcase_get_option( $option, $section_cpt_id, $default); break; case 'plural': $return['names']['plural'] = cmshowcase_get_option( $option, $section_cpt_id, $default); break; case 'slug': $return['names']['slug'] = cmshowcase_get_option( $option, $section_cpt_id, $default); $return['args']['rewrite'] = array('slug' => cmshowcase_get_option( $option, $section_cpt_id, $default)); break; case 'icon': //in case the field is empty we default to the value already set, if it exists $default = (isset($return['args']['menu_icon']) ? $return['args']['menu_icon'] : $default); $value = cmshowcase_get_option( $option, $section_cpt_id, $default); $value = $value != '' ? $value : $default; $return['args']['menu_icon'] = $value; break; case 'taxonomy_plural': $value = cmshowcase_get_option( $option, $section_cpt_id, $default); if(isset($return['taxonomies'][$field['use_as_target']])) { $return['taxonomies'][$field['use_as_target']]['names']['plural'] = $value; } break; case 'taxonomy_singular': $value = cmshowcase_get_option( $option, $section_cpt_id, $default); if(isset($return['taxonomies'][$field['use_as_target']])) { $return['taxonomies'][$field['use_as_target']]['names']['singular'] = $value; } break; case 'thumb_size_width': $value = cmshowcase_get_option ($option, $section_cpt_id, $default); if(isset($return['addons']['thumb-sizes'][$field['use_as_target']])) { $return['addons']['thumb-sizes'][$field['use_as_target']]['width'] = $value; } break; case 'thumb_size_height': $value = cmshowcase_get_option ($option, $section_cpt_id, $default); if(isset($return['addons']['thumb-sizes'][$field['use_as_target']])) { $return['addons']['thumb-sizes'][$field['use_as_target']]['height'] = $value; } break; case 'thumb_size_crop': $value = cmshowcase_get_option ($option, $section_cpt_id, $default); if(isset($return['addons']['thumb-sizes'][$field['use_as_target']])) { $bolean = true; if($value == false || $value == "false") { $bolean = false; } $return['addons']['thumb-sizes'][$field['use_as_target']]['crop'] = $bolean; } break; case 'exclude_from_search': $value = cmshowcase_get_option ($option, $section_cpt_id, $default); if($value=='on') { $bolean = true; } else { $bolean = false; } $return['args']['exclude_from_search'] = $bolean; break; //IN DEVELOPMENT case 'labels': break; case 'args': break; case 'cpt_supports': break; case 'meta_boxes': break; case 'taxonomies': break; } } } } } } } return $return; } } } ?>SIJ **5U,testimonials-showcase/includes/css/admin.css +Ѧ2#wpfooter { display:none; } .post-type-ttshowcase #postimagediv img { max-width:200px; } #cmgenerator { float:left; width:30%; } .cmbreed { padding:0 10px 0 20px; } .cmgenerator_left { float: left; width: 30%; } .cmgenerator_right { float:right; width:70%; } #cmmainpreview { float:right; width:70%; } .cmshortcode { padding:10px; margin:10px 0px; background-color: #ecf0f1; color:#222; border-radius: 5px; } .cmshortcodetextarea{ width:98%; height:80px; padding:10px; margin:10px; } .cmshortcode_clear { clear: both; display:block; } #cm_generator_table .cmshowcase_field_label { text-align: left; font-weight: bold; padding: 8px 0px 0px 0px; vertical-align: top; } select.cmshowcase_select_shortcode_name { /*vertical-align: top;*/ } .cm_sticky { position: fixed; top: 10px; z-index:999; } .cmshowcase_load_shortcode_button { padding:8px; font-weight: bold; background:#f5f5f5; color:#000; border: 1px solid #CCC; display: inline-block; margin: 5px 5px 5px 15px; cursor: pointer; border-radius: 3px; } .cmshowcase_buttons_area .button { margin-left:10px; } .cmshowcase_message_area .updated { font-weight:bold; display:inline-block; } .cmshowcase_buttons_area { padding:0px 15px 10px 15px; } .cmshowcase_alias_input { min-width:300px; width:100%; } .cmshowcase_shortcodes_table { padding:10px 0px; width:100%; } .cmshowcase_saved_title { font-weight: bold; border-bottom: 1px solid #CCC; padding: 10px 0px; } .cmshowcase_shortcodes_table tr:nth-of-type(odd) { background:#f5f5f5; } .cmshowcase_shortcodes_table td { vertical-align:middle; padding: 5px; } .cmshowcase_shortcodes_table td { border-bottom: 1px solid #CCC; } .cmshowcase_shortcodes_table td:last-child, .cmshowcase_shortcodes_table td:nth-last-child(2) { width:10%; } .cmshowcase_buttons_area .howto { padding:10px 0px; } .cmshowcase_warning { color:red; padding:10px; background:#f5f5f5; border-color:#CCC; } .cmshowcase_sortable ul li { cursor: move; width:100%; padding:3px; border:1px solid #f5f5f5; margin:1px; } .cmseperator { margin:20px 0; padding: 10px; border-bottom: dashed 1px #CCC; } #cm_generator_table table { padding:5px; } #cm_generator_table td { padding:10px 4px; vertical-align: text-top; } #cm_generator_table tr td:first-child { min-width:85px; } #cm_generator_table .description { clear:both; width: 100%; display: block; } .cm_intro_text { padding:10px; } .cmgenerator_description { padding:5px 5px 10px 5px; } .cm-nav-tab a { padding:10px; font-size: 1.2em; font-weight: bold; background:#f5f5f5; color:#999999; border:1px solid #CCC; border-bottom: none; display: inline-block; cursor: pointer; border-radius: 3px 3px 0 0; } .cm-nav-tab-current a { background-color: inherit; color:#333; margin-bottom:-6px; border-bottom: solid 1px #f5f5f5; } .cm-nav-info { padding:5px; display: inline-block; } #cm-nav-wrapper { clear: both; display:block; width:99%; margin:10px 0px; border-bottom:1px solid #CCC; } ul#cm_shortcode_nav { text-align: right; margin:-40px 20px 0px 0px; } ul#cm_shortcode_nav li { padding:10px; font-weight: bold; background:#f5f5f5; color:#ccc; border: 1px solid #CCC; display: inline-block; margin: 5px; cursor: pointer; border-radius: 3px; } ul#cm_shortcode_nav li.cm_shortcode_nav_current { background:inherit; color:#222; } ul#cm_preview_bg_toggle { text-align: right; margin:0px 20px 0px 0px; font-size: 0.9em; } ul#cm_preview_bg_toggle li { padding:8px; font-weight: bold; background:#f5f5f5; color:#ccc; border-bottom: 1px solid #FFF; display: inline-block; margin: 5px; cursor: pointer; border-radius: 3px; } ul#cm_preview_bg_toggle li.cm_preview_toggle_current { background:#ecf0f1; color:#222; border-bottom: 1px solid #ecf0f1; } .cm_shortcode_info { padding:15px 15px 5px 15px; font-size: 0.9em; } .cm_preview_description { padding:5px; background-color: #f5f5f5; border-radius: 3px; font-size: 0.9em; margin-bottom: 20px; } .cmphpconvert { padding:0 5px; font-size: 0.8em; cursor: pointer; text-align: right; float: right; display: inline-block; } .cmshorcodeinfo { float:left; display: inline-block; padding:0 5px; font-size: 0.8em; font-weight: bold; } .cmshowcase_dark_cmpreview { background: #333; color:#FFF; border-radius: 3px; padding:20px; } .cmshowcase_light_cmpreview { background: #FFF; color:#000; padding:20px; } /* ORDERING CODE */ .wp-list-table .ui-sortable tr { cursor: move; } .wp-list-table .spo-updating tr, .wp-list-table .ui-sortable tr.inline-editor { cursor: default; } .wp-list-table .ui-sortable-placeholder { outline: 1px dashed #bbb; background: #F1F1F1; visibility: visible !important; } .wp-list-table .ui-sortable-helper { background-color: #fff; outline: 1px solid #e1e1e1; } .spo-updating-row .check-column { background: url('../../../../../wp-admin/images/spinner.gif') 10px 9px no-repeat; } @media print, (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { .spo-updating-row .check-column { background-image: url('../../../../../wp-admin/images/spinner-2x.gif'); background-size: 20px 20px; } } .spo-updating-row .check-column input { visibility: hidden; } .cmshowcase-active-drag { background-color:#6C9; color:#FFF; font-weight:bold; padding:3px; } .cmshowcase-inactive-drag { background-color:#f5f5f5; color:#6699cc; padding:3px; }} K !!Gр-testimonials-showcase/includes/js/ordering.js +Ѧ2function update_simple_ordering_callback(response) { if ( 'children' === response ) { window.location.reload(); return; } var changes = jQuery.parseJSON( response ); var new_pos = changes.new_pos; for ( var key in new_pos ) { if ( 'next' === key ) { continue; } var inline_key = document.getElementById('inline_' + key); if ( null !== inline_key && new_pos.hasOwnProperty(key) ) { var dom_menu_order = inline_key.querySelector('.menu_order'); if ( undefined !== new_pos[key]['menu_order'] ) { if ( null !== dom_menu_order ) { dom_menu_order.innerHTML = new_pos[key]['menu_order']; } var dom_post_parent = inline_key.querySelector('.post_parent'); if ( null !== dom_post_parent ) { dom_post_parent.innerHTML = new_pos[key]['post_parent']; } var post_title = null; var dom_post_title = inline_key.querySelector('.post_title'); if ( null !== dom_post_title ) { post_title = dom_post_title.innerHTML; } var dashes = 0; while ( dashes < new_pos[key]['depth'] ) { post_title = '— ' + post_title; dashes++; } var dom_row_title = inline_key.parentNode.querySelector('.row-title'); if ( null !== dom_row_title && null !== post_title ) { dom_row_title.innerHTML = post_title; } } else if ( null !== dom_menu_order ) { dom_menu_order.innerHTML = new_pos[key]; } } } if ( changes.next ) { jQuery.post( ajaxurl, { action: 'simple_page_ordering', id: changes.next['id'], previd: changes.next['previd'], nextid: changes.next['nextid'], start: changes.next['start'], excluded: changes.next['excluded'] }, update_simple_ordering_callback ); } else { jQuery('.spo-updating-row').removeClass('spo-updating-row'); sortable_post_table.removeClass('spo-updating').sortable('enable'); } } var sortable_post_table = jQuery(".wp-list-table tbody"); sortable_post_table.sortable({ items: '> tr', cursor: 'move', axis: 'y', containment: 'table.widefat', cancel: '.inline-edit-row', distance: 2, opacity: .8, tolerance: 'pointer', start: function(e, ui){ if ( typeof(inlineEditPost) !== 'undefined' ) { inlineEditPost.revert(); } ui.placeholder.height(ui.item.height()); }, helper: function(e, ui) { var children = ui.children(); for ( var i=0; i 0 ) { prevpostid = prevpost.attr('id').substr(5); } var nextpostid = false; var nextpost = ui.item.next(); if ( nextpost.length > 0 ) { nextpostid = nextpost.attr('id').substr(5); } // go do the sorting stuff via ajax jQuery.post( ajaxurl, { action: 'simple_page_ordering', id: postid, previd: prevpostid, nextid: nextpostid }, update_simple_ordering_callback ); // fix cell colors var table_rows = document.querySelectorAll('tr.iedit'), table_row_count = table_rows.length; while( table_row_count-- ) { if ( 0 === table_row_count%2 ) { jQuery(table_rows[table_row_count]).addClass('alternate'); } else { jQuery(table_rows[table_row_count]).removeClass('alternate'); } } } }); aV ~~8testimonials-showcase/includes/js/shortcode_generator.js +Ѧ2/* Main Function to build shortcode */ function cmshowcase_init() { //If Generator tabs exist, we add the current state to the first jQuery('#cm-nav-wrapper span.cm-nav-tab:first').addClass('cm-nav-tab-current'); } function cmshowcase_build_shortcode(generator) { var shortcode_id; if(typeof(generator) === 'object') { shortcode_id = '#'+generator.form.id; } else { shortcode_id = '#'+generator; } var shortcode = jQuery( shortcode_id + " #shortcode" ).val(); var fieldValuePairs = jQuery(shortcode_id).serializeArray(); var shortcodedata = ""; var fname = ''; jQuery.each(fieldValuePairs, function(index, fieldValuePair) { if(fieldValuePair.value!='' && fieldValuePair.value!='0' && fieldValuePair.value!='off') { fieldValuePair.value = fieldValuePair.value.replace(' ',' '); if(fname == fieldValuePair.name) { shortcodedata = shortcodedata.substring(0, shortcodedata.length - 2) + ',' + fieldValuePair.value + "' "; fname = fieldValuePair.name; } if(fname != fieldValuePair.name) { shortcodedata += fieldValuePair.name + "='" + fieldValuePair.value + "' "; fname = fieldValuePair.name; } } }); //Get the layout value and check the form with that value var layout = jQuery( shortcode_id + " #layout" ).val(); var lstring = shortcode_id+'_'+layout; var layoutValuePairs = jQuery(lstring).serializeArray(); //build options for layout var layoutopts = ""; jQuery.each(layoutValuePairs, function(index, layoutValuePair) { // checks if option value if on if(layoutValuePair.value!='off' && layoutValuePair.value!='') { //checks if name of field has the 'hidden' so it wont be added to shortcode if(layoutValuePair.name.indexOf("hidden") == -1) { var name = layoutValuePair.name; //var value = layoutValuePair.value.replace(":",":"); var find1 = ':'; var re1 = new RegExp(find1, 'g'); var find2 = ','; var re2 = new RegExp(find2, 'g'); var value = layoutValuePair.value.replace(re1,"##").replace(re2,"#c#"); value = value.replace(/'/g,"\""); layoutopts += name + ":" + value + ","; } } }); var options = ''; if(layoutopts!='') { layoutopts = layoutopts.slice(0, -1); options = "options='"+layoutopts+"'"; } var composed = "["+shortcode.trim()+" " + shortcodedata.trim() + " " + options.trim() + "]"; //we use a different one, to count the number of layouts created in the page var gen_count = jQuery(shortcode_id +' #gen_count').val(); var torender = "["+shortcode+" " + shortcodedata + " " + options + " counter='"+gen_count+"' preview='true' ]"; jQuery(shortcode_id+'_cmshortcode #cmsctxt').val(composed); jQuery(shortcode_id+'_cmshortcode #cmphptxt').val(''); // To render the Preview console.log(shortcode_id); var preview_div = jQuery(shortcode_id+'_cmpreview'); preview_div.html('Loading...'); var data = { action: 'cmshowcase', shortcode: torender }; jQuery.post(ajax_object.ajax_url, data, function(response) { preview_div.html(response); // We check if there is any callback to perform, from layouts var cal = jQuery(lstring+' #layoutcallback').val(); if(cal != '') { if (typeof window[cal] === "function") { jQuery(document).ready(function($){ window[cal](shortcode_id); console.log('layout callback run > '+cal); }); } } }); } function cmshowcase_save_shortcode(generator) { var shortcode_id; if(typeof(generator) === 'object') { shortcode_id = '#'+generator.form.id; } else { shortcode_id = '#'+generator; } //var shortcode_text = jQuery('#'+generator+'_cmshortcode #cmloadtxt').val(); var shortcode = jQuery('#'+generator+'_cmshortcode #cmsctxt' ).val(); var new_name = jQuery('#'+generator+'_cmshortcode #new_shortcode' ).val(); var saved_shortcodes = jQuery('#'+generator+'_cmshortcode #cmshowcase_saved_shortcodes' ); var shortcode_trigger = jQuery( shortcode_id + " #shortcode" ).val(); var override_name = jQuery('#'+generator+'_cmshortcode #cmshowcase_override_shortcode_name' ); var over_name = 'null'; if(override_name.val() == 'null' && new_name=='') { alert('Alias Name cannot be empty'); return; } if(override_name.val()) { over_name = override_name.val(); } console.log(new_name + ':' + shortcode); var data = { action: 'cmshowcase_save_shortcode', shortcode: shortcode, generator: generator, name: new_name, shortcode_trigger: shortcode_trigger, override_name: over_name }; jQuery.post(ajax_object.ajax_url, data, function(response) { saved_shortcodes.html(response); //If it's a new value, we add it to the dropdown if(over_name == 'null' && new_name != '') { override_name.append(jQuery('