public function newDIID() { $newDIID = Utils::hashKey(Utils::randomHash()); $this->_DIID = $newDIID; DIStore::$instances[$newDIID] = $this; return DIStore::$instances[$newDIID]; }
public function __construct() { if (function_exists('igbinary_serialize')) { $this->_has_igbinary_status = true; } $bag = Utils::randomHash(); $this->_bag = crc32($bag); }
public function create_traffic_module_options($input_parameters = false) { $resultData = array('module' => '', 'module_id' => ''); if (!$input_parameters) { $input_parameters = array(); } $moduleId = ''; if (isset($input_parameters['module_id']) && $input_parameters['module_id']) { $moduleId = $input_parameters['module_id']; } if (!$moduleId) { $moduleId = Hash::crc32b(Utils::randomHash()); } $resultData['module_id'] = $moduleId; if ('traffic_module_sample_id' === $moduleId) { $input_parameters['moduleOptionsData']['enable_thumbnails'] = 'on'; $input_parameters['moduleOptionsData']['enable_items_title'] = 'on'; $input_parameters['moduleOptionsData']['enable_items_excerpt'] = 'on'; $input_parameters['moduleOptionsData']['title_of_module'] = 'Related articles :'; $input_parameters['moduleOptionsData']['enable_open_links_in_new_windows'] = 'on'; } if (!isset($input_parameters['moduleOptionsData']['maximum_number_characters_items_title'])) { $input_parameters['moduleOptionsData']['maximum_number_characters_items_title'] = '60'; } if (!isset($input_parameters['moduleOptionsData']['maximum_number_characters_items_excerpt'])) { $input_parameters['moduleOptionsData']['maximum_number_characters_items_excerpt'] = '120'; } $resultData['module'] .= ' <div id="' . $moduleId . '" class="wppepvn_green_block optimize_traffic_module_container"> <h5 class="optimize_traffic_module_container_head">Traffic Module - ID : <span>' . $moduleId . '</span> - <a href="#" class="optimize_traffic_module_button_remove">Remove Module</a> - <a href="#" style="font-size: 80%;" class="optimize_traffic_module_button_minimize_maximize">Minimize/Maximize</a></h5> <input type="hidden" name="optimize_traffic_modules[' . $moduleId . '][module_id]" value="' . $moduleId . '" /> <div class="optimize_traffic_module_container_body"> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">Module Type</span> : <select name="optimize_traffic_modules[' . $moduleId . '][module_type]" style="width: 200px;margin-left: 2%;"> <option value="fixed" ' . (isset($input_parameters['moduleOptionsData']['module_type']) && 'fixed' === $input_parameters['moduleOptionsData']['module_type'] ? ' selected="selected" ' : '') . ' >Fixed</option> <option value="flyout" ' . (isset($input_parameters['moduleOptionsData']['module_type']) && 'flyout' === $input_parameters['moduleOptionsData']['module_type'] ? ' selected="selected" ' : '') . ' >Flyout</option> </select> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>Fixed : ' . __('Module will appear at fixed location as your choice in post\'s content', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> <li>Flyout : ' . __('Module will appear on the right or left of user\'s screen', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">Module Style</span> : <select name="optimize_traffic_modules[' . $moduleId . '][module_style]" style="width: 200px;margin-left: 2%;"> <option value="style_1" ' . (isset($input_parameters['moduleOptionsData']['module_style']) && 'style_1' === $input_parameters['moduleOptionsData']['module_style'] ? ' selected="selected" ' : '') . ' >Style 1</option> <option value="style_2" ' . (isset($input_parameters['moduleOptionsData']['module_style']) && 'style_2' === $input_parameters['moduleOptionsData']['module_style'] ? ' selected="selected" ' : '') . ' >Style 2</option> </select> </h6> </div> <div class="optimize_traffic_module_options postbox wppepvn_hide" style="padding-top: 12px; padding-bottom: 12px;display:none;"> <h6> <span class="optimize_traffic_module_options_tilte">Display Animation Type</span> : <select name="optimize_traffic_modules[' . $moduleId . '][animation_type]" style="width: 200px;margin-left: 2%;"> <option value="slideout">Slideout</option> <option value="fade">Fade</option> </select> </h6> </div> <div class="optimize_traffic_module_options postbox wppepvn_hide" style="padding-top: 12px; padding-bottom: 12px;"> <h6> ' . __('When should the Module appear?', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' </h6> <br /> <h6> <span class="optimize_traffic_module_options_tilte">' . __('When user scroll length of site\'s height', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '(px or %)</span> : <input name="optimize_traffic_modules[' . $moduleId . '][module_appear_when_user_scroll_length]" value="' . (isset($input_parameters['moduleOptionsData']['module_appear_when_user_scroll_length']) ? $input_parameters['moduleOptionsData']['module_appear_when_user_scroll_length'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>' . __('When the user scrolls to the location you set, the module will appear.', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> <li>' . __('You can set up the "80%" or "80" (px). All values are based on the height of the site', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> <br /> <h6> <span class="optimize_traffic_module_options_tilte">' . __('When user view for seconds', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][module_appear_when_user_read_for_seconds]" value="' . (isset($input_parameters['moduleOptionsData']['module_appear_when_user_read_for_seconds']) ? $input_parameters['moduleOptionsData']['module_appear_when_user_read_for_seconds'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>' . __('When the user access and view your website in number of seconds, the module will appear.', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> </div> <div class="optimize_traffic_module_options postbox wppepvn_hide" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">Margin bottom (px)</span> : <input name="optimize_traffic_modules[' . $moduleId . '][module_margin_bottom]" value="' . (isset($input_parameters['moduleOptionsData']['module_margin_bottom']) ? $input_parameters['moduleOptionsData']['module_margin_bottom'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> <h6> <span class="optimize_traffic_module_options_tilte">Margin left (px)</span> : <input name="optimize_traffic_modules[' . $moduleId . '][module_margin_left]" value="' . (isset($input_parameters['moduleOptionsData']['module_margin_left']) ? $input_parameters['moduleOptionsData']['module_margin_left'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> </div> '; $resultData['module'] .= ' <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Position of Module', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <select name="optimize_traffic_modules[' . $moduleId . '][module_position]" style="width: 200px;margin-left: 2%;" pepvn_data_val="' . (isset($input_parameters['moduleOptionsData']['module_position']) ? $input_parameters['moduleOptionsData']['module_position'] : '') . '" >'; $resultData['module'] .= ' </select> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>' . __('When the position is %, module will appear in post\'s content corresponding to the value you set', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> <li>' . __('When the position is Left/Right, module will appear on Left/Right side of user\'s screen', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Title of Module', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][title_of_module]" value="' . (isset($input_parameters['moduleOptionsData']['title_of_module']) ? $input_parameters['moduleOptionsData']['title_of_module'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">Custom class (CSS) of Module</span> : <input name="optimize_traffic_modules[' . $moduleId . '][custom_class_css_of_module]" value="' . (isset($input_parameters['moduleOptionsData']['custom_class_css_of_module']) ? $input_parameters['moduleOptionsData']['custom_class_css_of_module'] : '') . '" type="text" style="width:300px;margin-left: 2%;" placeholder="Ex : your_custom_class_1 your_custom_class_2" /> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>' . __('This option will help you design module according to your wishes through CSS', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> <h6 style="display:none;"> <span class="optimize_traffic_module_options_tilte">Custom ID (CSS) of Module</span> : <input name="optimize_traffic_modules[' . $moduleId . '][custom_id_css_of_module]" type="text" style="width:300px;margin-left: 2%;" placeholder="Ex : your_custom_id" /> </h6> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Maximum Number of Items', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <select name="optimize_traffic_modules[' . $moduleId . '][module_mumber_of_items]" style="width: 200px;margin-left: 2%;">'; for ($iOne = 1; $iOne < 11; $iOne++) { $resultData['module'] .= ' <option value="' . $iOne . '" ' . (isset($input_parameters['moduleOptionsData']['module_mumber_of_items']) && $iOne == $input_parameters['moduleOptionsData']['module_mumber_of_items'] ? ' selected="selected" ' : '') . ' >' . $iOne . '</option>'; } $resultData['module'] .= ' </select> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>' . __('Maximum number of items (posts) in this module', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">Thumbnails</span> : <input name="optimize_traffic_modules[' . $moduleId . '][enable_thumbnails]" type="checkbox" style="margin-left: 2%;" ' . (isset($input_parameters['moduleOptionsData']['enable_thumbnails']) ? ' checked="checked" ' : '') . ' /> ' . __('Enable Thumbnails', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' </h6> <div class="wppepvn_hide wpoptimizebyxtraffic_enabled_thumbnails"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Default Thumbnail Url (include http:// or https://)', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][default_thumbnail_url]" value="' . (isset($input_parameters['moduleOptionsData']['default_thumbnail_url']) ? $input_parameters['moduleOptionsData']['default_thumbnail_url'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> <span class="wppepvn_help_icon wppepvn_tooltip" title="" data_content="' . base64_encode('<ul> <li>' . __('When the item does not have thumbnail image, plugin will get this image to make an thumbnail', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</li> </ul>') . '"></span> </h6> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Thumbnail Width', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' (px)</span> : <input name="optimize_traffic_modules[' . $moduleId . '][thumbnail_width]" value="' . (isset($input_parameters['moduleOptionsData']['thumbnail_width']) ? (int) $input_parameters['moduleOptionsData']['thumbnail_width'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Thumbnail Height', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' (px)</span> : <input name="optimize_traffic_modules[' . $moduleId . '][thumbnail_height]" value="' . (isset($input_parameters['moduleOptionsData']['thumbnail_height']) ? (int) $input_parameters['moduleOptionsData']['thumbnail_height'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> </div> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Maximum width of each item?', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' (px)</span> : <input name="optimize_traffic_modules[' . $moduleId . '][maximum_width_each_item]" value="' . (isset($input_parameters['moduleOptionsData']['maximum_width_each_item']) ? (int) $input_parameters['moduleOptionsData']['maximum_width_each_item'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Items\'s Title', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][enable_items_title]" type="checkbox" style="margin-left: 2%;" ' . (isset($input_parameters['moduleOptionsData']['enable_items_title']) ? ' checked="checked" ' : '') . ' /> Enable Items\'s Title </h6> <div class="wppepvn_hide wpoptimizebyxtraffic_enabled_items_title"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Maximum number of characters for items\'s title?', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][maximum_number_characters_items_title]" value="' . (isset($input_parameters['moduleOptionsData']['maximum_number_characters_items_title']) ? (int) $input_parameters['moduleOptionsData']['maximum_number_characters_items_title'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> </div> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Items\'s Excerpt', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][enable_items_excerpt]" type="checkbox" style="margin-left: 2%;" ' . (isset($input_parameters['moduleOptionsData']['enable_items_excerpt']) ? ' checked="checked" ' : '') . ' /> ' . __('Enable Items\'s Excerpt', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' </h6> <div class="wppepvn_hide wpoptimizebyxtraffic_enabled_items_excerpt"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Maximum number of characters for items\'s excerpt?', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][maximum_number_characters_items_excerpt]" value="' . (isset($input_parameters['moduleOptionsData']['maximum_number_characters_items_excerpt']) ? (int) $input_parameters['moduleOptionsData']['maximum_number_characters_items_excerpt'] : '') . '" type="text" style="width:300px;margin-left: 2%;" /> </h6> </div> </div> <div class="optimize_traffic_module_options postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Open Links In New Window', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</span> : <input name="optimize_traffic_modules[' . $moduleId . '][enable_open_links_in_new_windows]" type="checkbox" style="margin-left: 2%;" ' . (isset($input_parameters['moduleOptionsData']['enable_open_links_in_new_windows']) ? ' checked="checked" ' : '') . ' /> ' . __('Enable Open Links In New Window', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' </h6> </div> <div class="optimize_traffic_module_options optimize_traffic_module_preview_container postbox" style="padding-top: 12px; padding-bottom: 12px;"> <h6> <span class="optimize_traffic_module_options_tilte">' . __('Preview Module', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . ' ( <a href="#" class="optimize_traffic_module_preview_button_show_me"><b>' . __('Show me', WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_SLUG) . '</b></a> )</span> : </h6> <div class="optimize_traffic_module_preview postbox" style="padding: 12px;margin-top: 26px;"> </div> </div> </div> </div> '; return $resultData; }