/** * * @param array $atts * @param string $content * @param string $callback * @return string */ function persona_handler($atts, $content = null, $callback = null) { //$time_start = microtime( true ); global $post; try { $block = ''; $persona_id = $atts['personid']; if ($persona_id == '0') { unset($persona_id); } if (isset($persona_id)) { $batch_id = isset($atts['batchid']) ? $atts['batchid'] : '1'; $options = get_option('persona_plugin'); if ((empty($callback) || strtolower($callback) == 'rootspersona') && isset($options['custom_page']) && !empty($options['custom_page'])) { $picfile1 = isset($atts['picfile1']) ? $atts['picfile1'] : plugins_url('images/boy-silhouette.gif', __FILE__); $pageContent = html_entity_decode($options['custom_page'], ENT_QUOTES); $pageContent = str_replace("{%personid%}", $persona_id, $pageContent); $pageContent = str_replace("{%batchid%}", $batch_id, $pageContent); $pageContent = str_replace("{%picfile1%}", $picfile1, $pageContent); $block = do_shortcode($pageContent); } else { $builder = new RP_Persona_Page_Builder(); $options = $builder->get_persona_options($atts, $callback, $options); $factory = new RP_Persona_Factory($this->credentials); $persona = $factory->get_with_options($persona_id, $batch_id, $options); //if($persona->full_name == 'Private') // $post->post_title = 'Private'; $block = $builder->build($persona, $options, RP_Persona_Helper::get_page_id()); } } else { $msg = __('Invalid person id.', 'rootspersona'); $block = RP_Persona_Helper::return_default_empty($msg, WP_PLUGIN_URL); } //$time = microtime( true ) - $time_start; //echo "\nDone in $time seconds using " // . memory_get_peak_usage( true ) / 1024 / 1024 . 'MB.'; return $block; } catch (Exception $e) { error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0); return '<span style="color:red;margin-top:20px;display:inline-block;">' . $e->getMessage() . "::" . RP_Persona_Helper::trace_caller() . '</span>'; } }