← Back
Editing: twitomatic-user-list.php
<?php $twitter_language_codes = array( 'en' => 'English' , 'aa' => 'Afar' , 'ab' => 'Abkhazian' , 'af' => 'Afrikaans' , 'am' => 'Amharic' , 'ar' => 'Arabic' , 'as' => 'Assamese' , 'ay' => 'Aymara' , 'az' => 'Azerbaijani' , 'ba' => 'Bashkir' , 'be' => 'Byelorussian' , 'bg' => 'Bulgarian' , 'bh' => 'Bihari' , 'bi' => 'Bislama' , 'bn' => 'Bengali/Bangla' , 'bo' => 'Tibetan' , 'br' => 'Breton' , 'ca' => 'Catalan' , 'co' => 'Corsican' , 'cs' => 'Czech' , 'cy' => 'Welsh' , 'da' => 'Danish' , 'de' => 'German' , 'dz' => 'Bhutani' , 'el' => 'Greek' , 'eo' => 'Esperanto' , 'es' => 'Spanish' , 'et' => 'Estonian' , 'eu' => 'Basque' , 'fa' => 'Persian' , 'fi' => 'Finnish' , 'fj' => 'Fiji' , 'fo' => 'Faeroese' , 'fr' => 'French' , 'fy' => 'Frisian' , 'ga' => 'Irish' , 'gd' => 'Scots/Gaelic' , 'gl' => 'Galician' , 'gn' => 'Guarani' , 'gu' => 'Gujarati' , 'ha' => 'Hausa' , 'hi' => 'Hindi' , 'hr' => 'Croatian' , 'hu' => 'Hungarian' , 'hy' => 'Armenian' , 'ia' => 'Interlingua' , 'ie' => 'Interlingue' , 'ik' => 'Inupiak' , 'in' => 'Indonesian' , 'is' => 'Icelandic' , 'it' => 'Italian' , 'iw' => 'Hebrew' , 'ja' => 'Japanese' , 'ji' => 'Yiddish' , 'jw' => 'Javanese' , 'ka' => 'Georgian' , 'kk' => 'Kazakh' , 'kl' => 'Greenlandic' , 'km' => 'Cambodian' , 'kn' => 'Kannada' , 'ko' => 'Korean' , 'ks' => 'Kashmiri' , 'ku' => 'Kurdish' , 'ky' => 'Kirghiz' , 'la' => 'Latin' , 'ln' => 'Lingala' , 'lo' => 'Laothian' , 'lt' => 'Lithuanian' , 'lv' => 'Latvian/Lettish' , 'mg' => 'Malagasy' , 'mi' => 'Maori' , 'mk' => 'Macedonian' , 'ml' => 'Malayalam' , 'mn' => 'Mongolian' , 'mo' => 'Moldavian' , 'mr' => 'Marathi' , 'ms' => 'Malay' , 'mt' => 'Maltese' , 'my' => 'Burmese' , 'na' => 'Nauru' , 'ne' => 'Nepali' , 'nl' => 'Dutch' , 'no' => 'Norwegian' , 'oc' => 'Occitan' , 'om' => '(Afan)/Oromoor/Oriya' , 'pa' => 'Punjabi' , 'pl' => 'Polish' , 'ps' => 'Pashto/Pushto' , 'pt' => 'Portuguese' , 'qu' => 'Quechua' , 'rm' => 'Rhaeto-Romance' , 'rn' => 'Kirundi' , 'ro' => 'Romanian' , 'ru' => 'Russian' , 'rw' => 'Kinyarwanda' , 'sa' => 'Sanskrit' , 'sd' => 'Sindhi' , 'sg' => 'Sangro' , 'sh' => 'Serbo-Croatian' , 'si' => 'Singhalese' , 'sk' => 'Slovak' , 'sl' => 'Slovenian' , 'sm' => 'Samoan' , 'sn' => 'Shona' , 'so' => 'Somali' , 'sq' => 'Albanian' , 'sr' => 'Serbian' , 'ss' => 'Siswati' , 'st' => 'Sesotho' , 'su' => 'Sundanese' , 'sv' => 'Swedish' , 'sw' => 'Swahili' , 'ta' => 'Tamil' , 'te' => 'Tegulu' , 'tg' => 'Tajik' , 'th' => 'Thai' , 'ti' => 'Tigrinya' , 'tk' => 'Turkmen' , 'tl' => 'Tagalog' , 'tn' => 'Setswana' , 'to' => 'Tonga' , 'tr' => 'Turkish' , 'ts' => 'Tsonga' , 'tt' => 'Tatar' , 'tw' => 'Twi' , 'uk' => 'Ukrainian' , 'ur' => 'Urdu' , 'uz' => 'Uzbek' , 'vi' => 'Vietnamese' , 'vo' => 'Volapuk' , 'wo' => 'Wolof' , 'xh' => 'Xhosa' , 'yo' => 'Yoruba' , 'zh' => 'Chinese' , 'zu' => 'Zulu' , ); function twitomatic_users_panel() { $twitomatic_Main_Settings = get_option('twitomatic_Main_Settings', false); if(isset($twitomatic_Main_Settings['app_id']) && trim($twitomatic_Main_Settings['app_id']) != '') { if(isset($twitomatic_Main_Settings['app_secret']) && $twitomatic_Main_Settings['app_secret'] != '') { } else { ?> <h1><?php echo esc_html__("You must add a Twitter App Secret before you can use this feature!", 'twitomatic-twitter-post-generator');?></h1> <?php return; } } else { ?> <h1><?php echo esc_html__("You must add a Twitter App ID and Secret before you can use this feature!", 'twitomatic-twitter-post-generator');?></h1> <?php return; } ?> <div class="wp-header-end"></div> <div class="wrap gs_popuptype_holder seo_pops"> <div> <form id="myForm" method="post" action="admin.php?page=twitomatic_users_panel"> <?php wp_nonce_field('twitomatic_save_rules', '_twitomaticr_nonce'); if (isset($_GET['settings-updated'])) { ?> <div> <p class="cr_saved_notif"><strong><?php echo esc_html__("Settings saved.", 'twitomatic-twitter-post-generator');?></strong></p> </div> <?php } ?> <div> <div class="hideMain"> <hr/> <div class="table-responsive"> <table id="mainRules" class="responsive table cr_main_table"> <thead> <tr> <th> <?php echo esc_html__("ID", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo sprintf( wp_kses( __( "This is the ID of the rule.", 'twitomatic-twitter-post-generator'), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ) ); ?> </div> </div> </th> <th> <?php echo esc_html__("List Slug", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Input the slug of the list to query. Example: for the list https://twitter.com/Sunny_me_/lists/novinaricg - the slug is novinaricg", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th> <?php echo esc_html__("List Owner's Username", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Input the list owner's user name. This field is required.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th> <?php echo esc_html__("Schedule", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php $unlocker = get_option('twitomatic_minute_running_unlocked', false); if($unlocker == '1') { echo esc_html__("Select the interval in minutes after which you want this rule to run. Defined in minutes.", 'twitomatic-twitter-post-generator'); } else { echo esc_html__("Select the interval in hours after which you want this rule to run. Defined in hours.", 'twitomatic-twitter-post-generator'); } ?> </div> </div> </th> <th> <?php echo esc_html__("Max # Posts", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the maximum number of posts that this rule can create at once. 0-100 interval allowed.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th> <?php echo esc_html__("Post Status", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the status that you want for the automatically generated posts to have.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th> <?php echo esc_html__("Item Type", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the type (post/page) for your automatically generated item.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th> <?php echo esc_html__("Post Author", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the author that you want to assign for the automatically generated posts.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th> <?php echo esc_html__("More Options", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Shows advanced settings for this rule.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th class="cr_max_width_40"> <?php echo esc_html__("Del", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to delete this rule?", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th class="cr_max_55"> <?php echo esc_html__("Active", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to enable this rule? You can deactivate any rule (you don't have to delete them to deactivate them).", 'twitomatic-twitter-post-generator'); ?> </div> </div> <br/> <input type="checkbox" onchange="thisonChangeHandler(this)" id="exclusion"> </th> <th class="cr_max_42"> <?php echo esc_html__("Info", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("The number of items (posts, pages) this rule has generated so far.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> <th class="cr_actions"> <?php echo esc_html__("Actions", 'twitomatic-twitter-post-generator');?> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to run this rule now? Note that only one instance of a rule is allowed at once.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </th> </tr> </thead> <tbody> <?php echo twitomatic_expand_rules_user(); ?> <tr> <td class="cr_short_td">-</td> <td class="cr_select_option"><input type="text" name="twitomatic_users_list[rule_keywords][]" placeholder="Please input your search keywords" value="" class="cr_width_full"/></td> <td class="cr_ts_min_cust"> <input type="text" name="twitomatic_users_list[ids][]" placeholder="Username - Required" value=""/> </td> <td class="cr_comm_td"><input type="number" step="1" min="1" name="twitomatic_users_list[schedule][]" max="8765812" class="cr_width_60" placeholder="Select the rule schedule interval" value="24"/></td> <td class="cr_comm_td"><input type="number" step="1" min="0" max="100" name="twitomatic_users_list[max][]" placeholder="Select the max # of generated posts" value="10" class="cr_width_60"/></td> <td class="cr_status"> <select id="submit_status" name="twitomatic_users_list[submit_status][]" class="cr_width_70"> <option value="pending"><?php echo esc_html__("Pending -> Moderate", 'twitomatic-twitter-post-generator');?></option> <option value="draft"><?php echo esc_html__("Draft -> Moderate", 'twitomatic-twitter-post-generator');?></option> <option value="publish" selected><?php echo esc_html__("Published", 'twitomatic-twitter-post-generator');?></option> <option value="private"><?php echo esc_html__("Private", 'twitomatic-twitter-post-generator');?></option> <option value="trash"><?php echo esc_html__("Trash", 'twitomatic-twitter-post-generator');?></option> </select> </td> <td class="cr_comm_td"><select id="default_type" name="twitomatic_users_list[default_type][]" class="cr_width_full"> <?php $is_first = true; foreach ( get_post_types( '', 'names' ) as $post_type ) { echo '<option value="' . esc_attr($post_type) . '"'; if($is_first === true) { echo ' selected'; $is_first = false; } echo '>' . esc_html($post_type) . '</option>'; } ?> </select> </td> <td class="cr_author"><select id="post_author" name="twitomatic_users_list[post_author][]" class="cr_width_full"> <?php $blogusers = get_users( [ 'role__in' => [ 'contributor', 'author', 'editor', 'administrator' ] ] ); foreach ($blogusers as $user) { echo '<option value="' . esc_html($user->ID) . '"'; echo '>' . esc_html($user->display_name) . '</option>'; } ?> </select> </td> <td class="cr_width_70"> <input type="button" id="mybtnfzr" value="Settings"> <div id="mymodalfzr" class="codemodalfzr"> <div class="codemodalfzr-content"> <div class="codemodalfzr-header"> <span id="twitomatic_close" class="codeclosefzr">×</span> <h2><span class="cr_color_white"><?php echo esc_html__("New Rule", 'twitomatic-twitter-post-generator');?></span> <?php echo esc_html__("Advanced Settings", 'twitomatic-twitter-post-generator');?></h2> </div> <div class="codemodalfzr-body"> <div class="table-responsive"> <table class="responsive table cr_main_table_nowr"> <tr> <td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Set the title of the generated posts for user rules. You can use the following shortcodes: %%random_sentence%%, %%random_sentence2%%, %%item_title%%, %%item_description%%, %%item_content%%, %%item_cat%%, %%item_tags%%", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Generated Post Title:", 'twitomatic-twitter-post-generator');?></b> <b><a href="https://coderevolution.ro/knowledge-base/faq/post-template-reference-advanced-usage/" target="_blank">ⓘ</a></b> </td> <td> <input type="text" name="twitomatic_users_list[post_title][]" value="%%item_title%%" placeholder="Please insert your desired post title. Example: %%item_title%%" class="cr_width_full"> </div> </td> </tr> <tr> <td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Set the content of the generated posts for user rules. You can use the following shortcodes: %%item_title%%, %%item_content%%, %%item_url%%, %%item_content_plain_text%%, %%item_read_more_button%%, %%item_show_image%%, %%twitter_tweet_button%%, %%item_image_URL%%, %%item_retweet_count%%, %%item_fav_count%%, %%video_url%%, %%item_user_screen_name%%, %%item_user_name%%, %%item_media%%, %%item_description%%, %%item_card%%, %%item_longitude%%, %%item_latitude%%, %%author_link%%, %%author%%, %%random_sentence%%, %%random_sentence2%%, %%custom_html%%, %%custom_html2%%, %%item_cat%%, %%item_tags%%, %%item_screenshot_url%%, %%item_show_screenshot%%", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Generated Post Content:", 'twitomatic-twitter-post-generator');?></b> <b><a href="https://coderevolution.ro/knowledge-base/faq/post-template-reference-advanced-usage/" target="_blank">ⓘ</a></b> </td> <td> <textarea rows="2" cols="70" name="twitomatic_users_list[post_content][]" placeholder="Please insert your desired post content. Example:%%item_content%%" class="cr_width_full">%%item_content%% %%item_media%%</textarea> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to remember last posted item and continue search from it the next time the importing rule runs?", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Cache Items For Continuous Posting (disable to get latest posts only):", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="continue_search" name="twitomatic_users_list[continue_search][]" checked> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to to set the post published date as the date grabbed from the Twitter post? If you disable this feature, the date when the rule is run will be used.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Get Post Publish Date From Twitter Post Date:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="import_date" name="twitomatic_users_list[import_date][]"> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Run regex on post content. To disable this feature, leave this field blank. No Regex separators are required here. You can add also multiple Regex expressions, each on a new line.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Run Regex On Content:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <textarea rows="1" class="cr_width_full" name="twitomatic_users_list[strip_by_regex][]" placeholder="regex expression" class="cr_width_full"></textarea> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Replace the above regex matches with this regex expression. If you want to strip matched content, leave this field blank. No Regex separators are required here. You can add also multiple replacement expressions, each on a new line.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Replace Matches From Regex (Content):", 'twitomatic-twitter-post-generator');?></b> </td> <td> <textarea rows="1" class="cr_width_full" name="twitomatic_users_list[replace_regex][]" placeholder="regex replacement" class="cr_width_full"></textarea> </div> </td> </tr> <tr> <td colspan="2"> <h3><?php echo esc_html__("Scheduling Options:", 'twitomatic-twitter-post-generator');?></h3> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Add a time period between the plugin will run importing at a schedule. To disable this feature, leave this field blank. This works based on your current server timezone and time. Your current server time is: ", 'twitomatic-twitter-post-generator') . date("h:i A"); ?> </div> </div> <b><?php echo esc_html__("Automatically Run Rules Only Between These Hour Periods Each Day:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="time" id="run_after" name="twitomatic_users_list[run_after][]" value="" placeholder="<?php echo esc_html__("Run Rules Only After This Hour", 'twitomatic-twitter-post-generator');?>"> - <input type="time" id="run_before" name="twitomatic_users_list[run_before][]" value="" placeholder="<?php echo esc_html__("Run Rules Only Before This Hour", 'twitomatic-twitter-post-generator');?>"> </div> </td> </tr> <tr> <td colspan="2"> <h3><?php echo esc_html__("Posting Restrictions:", 'twitomatic-twitter-post-generator');?></h3> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do not include posts that's title or content contains at least one of these words. Separate words by comma. To disable this feature, leave this field blank.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Banned Words List:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="text" class="cr_width_full" name="twitomatic_users_list[banned_words][]" value="" placeholder="banned1, banned2, banned3" class="cr_width_full"> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Include only posts that's title or content contains at least one of these words. Separate words by comma. To disable this feature, leave this field blank. If you wish to input a keyword that must be required in all cases (AND), please use it in this format: &&keyword. Example: granny, dad, &&mom. This translates into: (granny OR dad) AND MOM", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Required Words List:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="text" class="cr_width_full" name="twitomatic_users_list[required_words][]" value="" placeholder="required1, required2, required3" class="cr_width_full"> </div> </td> </tr> <tr> <td colspan="2"> <h3><?php echo esc_html__("Post Customizations:", 'twitomatic-twitter-post-generator');?></h3> </td> </tr> <tr> <td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("If your template supports 'Post Formats', than you can select one here. If not, leave this at it's default value.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Generated Post Format:", 'twitomatic-twitter-post-generator');?></b> </td> <td class="cr_min_width_200"> <select id="post_format" name="twitomatic_users_list[post_format][]" class="cr_width_full"> <option value="post-format-standard" selected><?php echo esc_html__("Standard", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-aside"><?php echo esc_html__("Aside", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-gallery"><?php echo esc_html__("Gallery", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-link"><?php echo esc_html__("Link", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-image"><?php echo esc_html__("Image", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-quote"><?php echo esc_html__("Quote", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-status"><?php echo esc_html__("Status", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-video"><?php echo esc_html__("Video", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-audio"><?php echo esc_html__("Audio", 'twitomatic-twitter-post-generator');?></option> <option value="post-format-chat"><?php echo esc_html__("Chat", 'twitomatic-twitter-post-generator');?></option> </select> </div> </td> </tr> <tr> <td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the post category that you want for the automatically generated posts to have.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Additional Post Category:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <select id="default_category" name="twitomatic_users_list[default_category][]" class="cr_width_full"> <option value="twitomatic_no_category_12345678" selected><?php echo esc_html__("Do Not Add a Category", 'twitomatic-twitter-post-generator');?></option> <?php $cat_args = array( 'orderby' => 'name', 'hide_empty' => 0, 'order' => 'ASC' ); $categories = get_categories($cat_args); foreach ($categories as $category) { ?> <option value="<?php echo esc_html($category->term_id); ?>"><?php echo esc_html(sanitize_text_field($category->name)); ?></option> <?php } ?> </select> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to automatically add post categories from the Twitter items?", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Auto Add Categories:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <select class="cr_width_full" id="auto_categories" name="twitomatic_users_list[auto_categories][]"> <option value="disabled" selected><?php echo esc_html__("Disabled", 'twitomatic-twitter-post-generator');?></option> <option value="user"><?php echo esc_html__("User Names", 'twitomatic-twitter-post-generator');?></option> <option value="hashtags"><?php echo esc_html__("HashTags", 'twitomatic-twitter-post-generator');?></option> <option value="content"><?php echo esc_html__("Content", 'twitomatic-twitter-post-generator');?></option> <option value="both"><?php echo esc_html__("HashTags and Content", 'twitomatic-twitter-post-generator');?></option> </select> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the auto created categories parent category id. If you leave this field blank, automatically created categories will be a root category (no parent).", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Auto Created Categories Parent Category ID:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="number" min="0" step="1" id="parent_category_id" name="twitomatic_users_list[parent_category_id][]" value="" placeholder="Parent category id" class="cr_width_full"> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("This feature will try to remove the WordPress's default post category. This may fail in case no additional categories are added, because WordPress requires at least one post category for every post.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Remove WP Default Post Category:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="remove_default" name="twitomatic_users_list[remove_default][]" checked> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to automatically add post tags from the Twitter items?", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Auto Add Tags:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <select class="cr_width_full" id="auto_tags" name="twitomatic_users_list[auto_tags][]"> <option value="disabled" selected><?php echo esc_html__("Disabled", 'twitomatic-twitter-post-generator');?></option> <option value="user"><?php echo esc_html__("User Names", 'twitomatic-twitter-post-generator');?></option> <option value="hashtags"><?php echo esc_html__("HashTags", 'twitomatic-twitter-post-generator');?></option> <option value="content"><?php echo esc_html__("Content", 'twitomatic-twitter-post-generator');?></option> <option value="both"><?php echo esc_html__("HashTags and Content", 'twitomatic-twitter-post-generator');?></option> </select> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Select the post tags that you want for the automatically generated posts to have.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Additional Post Tags:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="text" name="twitomatic_users_list[default_tags][]" value="" placeholder="Please insert your additional post tags here" class="cr_width_full"> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to enable comments for the generated posts?", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Enable Comments For Posts:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="enable_comments" name="twitomatic_users_list[enable_comments][]" checked> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to enable pingbacks/trackbacks for the generated posts?", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Enable Pingback/Trackback:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="enable_pingback" name="twitomatic_users_list[enable_pingback][]" checked> </div> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Do you want to set featured image for generated post (to the first image that was found in the post)?", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Auto Get Featured Image:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="featured_image" name="twitomatic_users_list[featured_image][]" checked> </div> </td> </tr> <tr> <td> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Insert a comma separated list of links to valid images that will be set randomly for the featured image for the posts that do not have a valid image attached or if you disabled automatical featured image generation. You can also use image numeric IDs from images found in the Media Gallery. To disable this feature, leave this field blank.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Default Featured Image List:", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input class="cr_width_60p" type="text" name="twitomatic_users_list[image_url][]" placeholder="Please insert the link to a valid image" id="cr_input_box" value=""/> <input class="cr_width_33p twitomatic_image_button" type="button" value=">>>"/> </td> </tr> <tr> <td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("This works only if you configured phantomjs usage, from the Main Settings of the plugin. Choose if you want to use phantomjs to generate the screenshot for the page you are crawling and attach it to the generated post, regardless if you use the %%item_show_screenshot%% and %%item_screenshot_url%% shortcodes.", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Attach Screenshot to All Generated Posts", 'twitomatic-twitter-post-generator');?></b> </td> <td> <input type="checkbox" id="attach_screen" name="twitomatic_users_list[attach_screen][]"> </div> </td> </tr> <tr> <td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("Set the custom fields that will be set for generated posts. The syntax for this field is the following: custom_field_name1 => custom_field_value1, custom_field_name2 => custom_field_value2, ... . In custom_field_valueX, you can use shortcodes, same like in post content. You can also assign the data to array custom fields, using this format: array_field[index_name1] => custom_field_value1, array_field[index_name2] => custom_field_value2. Example (without quotes): 'title_custom_field => %%item_title%%'. You can use the following shortcodes: %%item_title%%, %%item_content%%, %%item_url%%, %%item_content_plain_text%%, %%item_read_more_button%%, %%item_show_image%%, %%twitter_tweet_button%%, %%item_image_URL%%, %%item_retweet_count%%, %%item_fav_count%%, %%video_url%%, %%item_user_screen_name%%, %%item_user_name%%, %%item_media%%, %%item_description%%, %%item_card%%, %%item_longitude%%, %%item_latitude%%, %%author_link%%, %%author%%, %%random_sentence%%, %%random_sentence2%%, %%custom_html%%, %%custom_html2%%, %%item_cat%%, %%item_tags%%, %%item_screenshot_url%%, %%item_show_screenshot%%", 'twitomatic-twitter-post-generator'); ?> </div> </div> <b><?php echo esc_html__("Post Custom Fields:", 'twitomatic-twitter-post-generator');?></b> <b><a href="https://coderevolution.ro/knowledge-base/faq/post-template-reference-advanced-usage/" target="_blank">ⓘ</a></b> </td> <td> <textarea rows="1" cols="70" name="twitomatic_users_list[custom_fields][]" placeholder="Please insert your desired custom fields. Example: title_custom_field => %%item_title%%" class="cr_width_full"></textarea> </div> </td> </tr> </table> </div> </div> <div class="codemodalfzr-footer"> <br/> <h3 class="cr_inline">Twitomatic Automatic Post Generator</h3> <span id="twitomatic_ok" class="codeokfzr cr_inline">OK </span> <br/><br/> </div> </div> </div> </td> <td class="cr_shrt_td2"><span class="cr_gray20">X</span></td> <td class="cr_short_td"><input type="checkbox" name="twitomatic_users_list[active][]" value="1" checked /> <input type="hidden" name="twitomatic_users_list[last_run][]" value="1988-01-27 00:00:00"/> </td> <td class="cr_short_td"> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px"> <?php echo esc_html__("No info.", 'twitomatic-twitter-post-generator'); ?> </div> </div> </td> <td class="cr_center"> <div> <img src="<?php echo esc_url_raw(plugin_dir_url(dirname(__FILE__)) . 'images/running.gif'); ?>" alt="Running" class="cr_running"> <div class="codemainfzr cr_gray_back"> <select id="actions" class="actions" name="actions" disabled> <option value="select" disabled selected><?php echo esc_html__("Select an Action", 'twitomatic-twitter-post-generator');?></option> <option value="run" onclick=""><?php echo esc_html__("Run This Rule Now", 'twitomatic-twitter-post-generator');?></option> <option value="trash" onclick=""><?php echo esc_html__("Move All Posts To Trash", 'twitomatic-twitter-post-generator');?></option> <option value="duplicate" onclick=""><?php echo esc_html__("Duplicate This Rule", 'twitomatic-twitter-post-generator');?></option> <option value="delete" onclick=""><?php echo esc_html__("Permanently Delete All Posts", 'twitomatic-twitter-post-generator');?></option> </select> </div> </div> </td> </tr> </tbody> </table> </div> </div> </div> <hr/> <div> <p class="crsubmit"><input type="submit" name="btnSubmit" id="btnSubmit" class="button button-primary" onclick="unsaved = false;" value="<?php echo esc_html__("Save Settings", 'twitomatic-twitter-post-generator');?>"/></p> </div> <div> <?php echo esc_html__("New! AI generated shortcodes supported, click for details:", 'twitomatic-twitter-post-generator');?> <a href="https://coderevolution.ro/knowledge-base/faq/how-to-create-ai-generated-content-from-any-plugin-built-by-coderevolution/" target="_blank"><img src="https://i.ibb.co/WGQ1rtF/ai.webp" alt="artificial-intelligence-badge" title="AI content generator support, when used together with the Aiomatic plugin"></a><br/><br/><a href="https://www.youtube.com/watch?v=5rbnu_uis7Y" target="_blank"><?php echo esc_html__("Nested Shortcodes also supported!", 'twitomatic-twitter-post-generator');?></a><br/><?php echo esc_html__("Confused about rule running status icons?", 'twitomatic-twitter-post-generator');?> <a href="http://coderevolution.ro/knowledge-base/faq/how-to-interpret-the-rule-running-visual-indicators-red-x-yellow-diamond-green-tick-from-inside-plugins/" target="_blank"><?php echo esc_html__("More info", 'twitomatic-twitter-post-generator');?></a><br/> <div class="cr_none" id="midas_icons"> <table> <tr> <td><img id="run_img" src="<?php echo esc_url_raw(plugin_dir_url(dirname(__FILE__)) . 'images/running.gif');?>" alt="Running" title="status"></td> <td><?php echo esc_html__("In Progress", 'twitomatic-twitter-post-generator');?> - <b><?php echo esc_html__("Importing is Running", 'twitomatic-twitter-post-generator');?></b></td> </tr> <tr> <td><img id="ok_img" src="<?php echo esc_url_raw(plugin_dir_url(dirname(__FILE__)) . 'images/ok.gif');?>" alt="OK" title="status"></td> <td><?php echo esc_html__("Success", 'twitomatic-twitter-post-generator');?> - <b><?php echo esc_html__("New Posts Created", 'twitomatic-twitter-post-generator');?></b></td> </tr> <tr> <td><img id="fail_img" src="<?php echo esc_url_raw(plugin_dir_url(dirname(__FILE__)) . 'images/failed.gif');?>" alt="Faield" title="status"></td> <td><?php echo esc_html__("Failed", 'twitomatic-twitter-post-generator');?> - <b><?php echo esc_html__("An Error Occurred.", 'twitomatic-twitter-post-generator');?> <b><?php echo esc_html__("Please check 'Activity and Logging' plugin menu for details.", 'twitomatic-twitter-post-generator');?></b></td> </tr> <tr> <td><img id="nochange_img" src="<?php echo esc_url_raw(plugin_dir_url(dirname(__FILE__)) . 'images/nochange.gif');?>" alt="NoChange" title="status"></td> <td><?php echo esc_html__("No Change - No New Posts Created", 'twitomatic-twitter-post-generator');?> - <b><?php echo esc_html__("Possible reasons:", 'twitomatic-twitter-post-generator');?></b></td> </tr> <tr> <td></td> <td> <ul> <li>► <?php echo esc_html__("Already all posts are published that match your search and posts will be posted when new content will be available", 'twitomatic-twitter-post-generator');?></li> <li>► <?php echo esc_html__("Some restrictions you defined in the plugin's 'Main Settings'", 'twitomatic-twitter-post-generator');?> <i>(<?php echo esc_html__("example: 'Minimum Content Word Count', 'Maximum Content Word Count', 'Minimum Title Word Count', 'Maximum Title Word Count', 'Banned Words List', 'Reuired Words List', 'Skip Posts Without Images'", 'twitomatic-twitter-post-generator');?>)</i> <?php echo esc_html__("prevent posting of new posts.", 'twitomatic-twitter-post-generator');?></li> </ul> </td> </tr> </table> </div> </div> </form> </div> </div> <?php } if (isset($_POST['twitomatic_users_list'])) { add_action('admin_init', 'twitomatic_save_rules_user'); } function twitomatic_save_rules_user($data2) { check_admin_referer('twitomatic_save_rules', '_twitomaticr_nonce'); $data2 = $_POST['twitomatic_users_list']; $rules = array(); $cont = 0; if (isset($data2['rule_keywords'][0])) { for ($i = 0; $i < sizeof($data2['rule_keywords']); ++$i) { $bundle = array(); if (isset($data2['schedule'][$i]) && $data2['schedule'][$i] != '' && $data2['rule_keywords'][$i] != '') { $bundle[] = trim($data2['ids'][$i]); $bundle[] = trim(sanitize_text_field($data2['schedule'][$i])); if (isset($data2['active'][$i])) { $bundle[] = trim(sanitize_text_field($data2['active'][$i])); } else { $bundle[] = '0'; } $bundle[] = trim(sanitize_text_field($data2['last_run'][$i])); $bundle[] = trim(sanitize_text_field($data2['max'][$i])); $bundle[] = trim(sanitize_text_field($data2['submit_status'][$i])); $bundle[] = trim(sanitize_text_field($data2['default_type'][$i])); $bundle[] = trim(sanitize_text_field($data2['post_author'][$i])); $bundle[] = trim(sanitize_text_field($data2['default_tags'][$i])); $bundle[] = trim(sanitize_text_field($data2['default_category'][$i])); $bundle[] = trim(sanitize_text_field($data2['auto_categories'][$i])); $bundle[] = trim(sanitize_text_field($data2['auto_tags'][$i])); $bundle[] = trim(sanitize_text_field($data2['enable_comments'][$i])); $bundle[] = trim(sanitize_text_field($data2['featured_image'][$i])); $bundle[] = trim($data2['image_url'][$i]); $bundle[] = $data2['post_title'][$i]; $bundle[] = $data2['post_content'][$i]; $bundle[] = trim(sanitize_text_field($data2['enable_pingback'][$i])); $bundle[] = trim(sanitize_text_field($data2['post_format'][$i])); $bundle[] = trim($data2['rule_keywords'][$i]); $bundle[] = trim(sanitize_text_field($data2['remove_default'][$i])); $bundle[] = trim(sanitize_text_field($data2['continue_search'][$i])); $bundle[] = trim($data2['custom_fields'][$i]); $bundle[] = trim(sanitize_text_field($data2['parent_category_id'][$i])); $bundle[] = trim(sanitize_text_field($data2['attach_screen'][$i])); $bundle[] = trim(sanitize_text_field($data2['import_date'][$i])); $bundle[] = trim($data2['strip_by_regex'][$i]); $bundle[] = trim($data2['replace_regex'][$i]); $bundle[] = trim(sanitize_text_field($data2['banned_words'][$i])); $bundle[] = trim(sanitize_text_field($data2['required_words'][$i])); $bundle[] = trim(sanitize_text_field($data2['run_after'][$i])); $bundle[] = trim(sanitize_text_field($data2['run_before'][$i])); $rules[$cont] = $bundle; $cont++; } } } update_option('twitomatic_users_list', $rules, false); } function twitomatic_expand_rules_user() { $cat_args = array( "orderby" => "name", "hide_empty" => 0, "order" => "ASC" ); $categories = get_categories($cat_args); if (!get_option('twitomatic_running_list')) { $running = array(); } else { $running = get_option('twitomatic_running_list'); } $twitomatic_Main_Settings = get_option('twitomatic_Main_Settings', false); $GLOBALS['wp_object_cache']->delete('twitomatic_users_list', 'options'); $rules = get_option('twitomatic_users_list'); if(!is_array($rules)) { $rules = array(); } $output = ''; $cont = 0; if (!empty($rules)) { $posted_items = array(); $post_list = array(); $postsPerPage = 50000; $paged = 0; do { $postOffset = $paged * $postsPerPage; $query = array( 'post_status' => array( 'publish', 'draft', 'pending', 'trash', 'private', 'future' ), 'post_type' => array( 'any' ), 'numberposts' => $postsPerPage, 'meta_key' => 'twitomatic_parent_rule', 'fields' => 'ids', 'offset' => $postOffset ); $got_me = get_posts($query); $post_list = array_merge($post_list, $got_me); $paged++; }while(!empty($got_me)); wp_suspend_cache_addition(true); foreach ($post_list as $post) { $rule_id = get_post_meta($post, 'twitomatic_parent_rule', true); if ($rule_id != '') { $exp = explode('-', $rule_id); if(isset($exp[0]) && isset($exp[1]) && $exp[0] == '2') { $posted_items[] = $exp[1]; } } } wp_suspend_cache_addition(false); $counted_vals = array_count_values($posted_items); $unlocker = get_option('twitomatic_minute_running_unlocked', false); foreach ($rules as $request => $bundle[]) { if (isset($counted_vals[$cont])) { $generated_posts = $counted_vals[$cont]; } else { $generated_posts = 0; } $bundle_values = array_values($bundle); $myValues = $bundle_values[$cont]; $array_my_values = array_values($myValues);for($iji=0;$iji<count($array_my_values);++$iji){if(is_string($array_my_values[$iji])){$array_my_values[$iji]=stripslashes($array_my_values[$iji]);}} $ids = $array_my_values[0]; $schedule = $array_my_values[1]; $active = $array_my_values[2]; $last_run = $array_my_values[3]; $max = $array_my_values[4]; $status = $array_my_values[5]; $def_type = $array_my_values[6]; $post_user_name = $array_my_values[7]; $default_tags = $array_my_values[8]; $default_category = $array_my_values[9]; $auto_categories = $array_my_values[10]; $auto_tags = $array_my_values[11]; $enable_comments = $array_my_values[12]; $featured_image = $array_my_values[13]; $image_url = $array_my_values[14]; $post_title = $array_my_values[15]; $post_content = $array_my_values[16]; $enable_pingback = $array_my_values[17]; $post_format = $array_my_values[18]; $rule_keywords = $array_my_values[19]; $remove_default = $array_my_values[20]; $continue_search = $array_my_values[21]; $custom_fields = $array_my_values[22]; $parent_category_id = $array_my_values[23]; $attach_screen = $array_my_values[24]; $import_date = $array_my_values[25]; $strip_by_regex = $array_my_values[26]; $replace_regex = $array_my_values[27]; $banned_words = $array_my_values[28]; $required_words = $array_my_values[29]; $run_after = $array_my_values[30]; $run_before = $array_my_values[31]; wp_add_inline_script('twitomatic-footer-script', 'createAdmin(' . esc_html($cont) . ');', 'after'); $output .= '<tr> <td class="cr_short_td">' . esc_html($cont) . '</td> <td class="cr_select_option"><input type="text" name="twitomatic_users_list[rule_keywords][]" placeholder="Please input your search keywords" value="' . esc_attr($rule_keywords) . '" class="cr_width_full"/></td> </td> <td class="cr_ts_min_cust"> <input type="text" name="twitomatic_users_list[ids][]" placeholder="Username - Required" value="' . esc_attr($ids) . '" required/> </td> <td class="cr_comm_td"><input type="number" step="1" min="1" placeholder="# h" name="twitomatic_users_list[schedule][]" max="8765812" value="' . esc_attr($schedule) . '" class="cr_width_60" required></td> <td class="cr_comm_td"><input type="number" step="1" min="0" placeholder="# max" max="100" name="twitomatic_users_list[max][]" value="' . esc_attr($max) . '" class="cr_width_60" required></td> <td class="cr_status"><select id="submit_status" name="twitomatic_users_list[submit_status][]" class="cr_width_70"> <option value="pending"'; if ($status == 'pending') { $output .= ' selected'; } $output .= '>' . esc_html__("Pending -> Moderate", 'twitomatic-twitter-post-generator') . '</option> <option value="draft"'; if ($status == 'draft') { $output .= ' selected'; } $output .= '>' . esc_html__("Draft -> Moderate", 'twitomatic-twitter-post-generator') . '</option> <option value="publish"'; if ($status == 'publish') { $output .= ' selected'; } $output .= '>' . esc_html__("Published", 'twitomatic-twitter-post-generator') . '</option> <option value="private"'; if ($status == 'private') { $output .= ' selected'; } $output .= '>' . esc_html__("Private", 'twitomatic-twitter-post-generator') . '</option> <option value="trash"'; if ($status == 'trash') { $output .= ' selected'; } $output .= '>' . esc_html__("Trash", 'twitomatic-twitter-post-generator') . '</option> </select> </td> <td class="cr_comm_td"><select id="default_type" name="twitomatic_users_list[default_type][]" class="cr_width_full">'; foreach ( get_post_types( '', 'names' ) as $post_type ) { $output .= '<option value="' . esc_attr($post_type) . '"'; if ($def_type == $post_type) { $output .= ' selected'; } $output .= '>' . esc_html($post_type) . '</option>'; } $output .= '</select> </td> <td class="cr_author"><select id="post_author" name="twitomatic_users_list[post_author][]" class="cr_width_full">'; $blogusers = get_users( [ 'role__in' => [ 'contributor', 'author', 'editor', 'administrator' ] ] ); foreach ($blogusers as $user) { $output .= '<option value="' . esc_html($user->ID) . '"'; if ($post_user_name == $user->ID) { $output .= " selected"; } $output .= '>' . esc_html($user->display_name) . '</option>'; } $output .= '</select> </td> <td class="cr_width_70"> <input type="button" id="mybtnfzr' . esc_html($cont) . '" value="Settings"> <div id="mymodalfzr' . esc_html($cont) . '" class="codemodalfzr"> <div class="codemodalfzr-content"> <div class="codemodalfzr-header"> <span id="twitomatic_close' . esc_html($cont) . '" class="codeclosefzr">×</span> <h2>' . esc_html__('Rule', 'twitomatic-twitter-post-generator') . ' <span class="cr_color_white">ID ' . esc_html($cont) . '</span> ' . esc_html__('Advanced Settings', 'twitomatic-twitter-post-generator') . '</h2> </div> <div class="codemodalfzr-body"> <div class="table-responsive"> <table class="responsive table cr_main_table_nowr"> <tr><td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Set the title of the generated posts for user rules. You can use the following shortcodes: %%random_sentence%%, %%random_sentence2%%, %%item_title%%, %%item_description%%, %%item_content%%, %%item_cat%%, %%item_tags%%", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Generated Post Title", 'twitomatic-twitter-post-generator') . ':</b> <b><a href="https://coderevolution.ro/knowledge-base/faq/post-template-reference-advanced-usage/" target="_blank">ⓘ</a></b> </td><td> <input type="text" name="twitomatic_users_list[post_title][]" value="' . esc_attr(htmlspecialchars($post_title)) . '" placeholder="Please insert your desired post title. Example: %%item_title%%" class="cr_width_full"> </div> </td></tr><tr><td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Set the content of the generated posts for user rules. You can use the following shortcodes: %%item_title%%, %%item_content%%, %%item_url%%, %%item_content_plain_text%%, %%item_read_more_button%%, %%item_show_image%%, %%twitter_tweet_button%%, %%item_image_URL%%, %%item_retweet_count%%, %%item_fav_count%%, %%video_url%%, %%item_user_screen_name%%, %%item_user_name%%, %%item_media%%, %%item_description%%, %%item_card%%, %%item_longitude%%, %%item_latitude%%, %%author_link%%, %%author%%, %%random_sentence%%, %%random_sentence2%%, %%custom_html%%, %%custom_html2%%, %%item_cat%%, %%item_tags%%, %%item_screenshot_url%%, %%item_show_screenshot%%", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Generated Post Content", 'twitomatic-twitter-post-generator') . ':</b> <b><a href="https://coderevolution.ro/knowledge-base/faq/post-template-reference-advanced-usage/" target="_blank">ⓘ</a></b> </td><td> <textarea rows="2" cols="70" name="twitomatic_users_list[post_content][]" placeholder="Please insert your desired post content. Example:%%item_content%%" class="cr_width_full">' . htmlspecialchars($post_content) . '</textarea> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to remember last posted item and continue search from it the next time the importing rule runs?", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Cache Items For Continuous Posting (disable to get latest posts only)", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="continue_search" name="twitomatic_users_list[continue_search][]"'; if ($continue_search == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to to set the post published date as the date grabbed from the Twitter post? If you disable this feature, the date when the rule is run will be used.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Get Post Publish Date From Twitter Post Date", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="import_date" name="twitomatic_users_list[import_date][]"'; if($import_date == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Run regex on post content. To disable this feature, leave this field blank. No Regex separators are required here. You can add also multiple Regex expressions, each on a new line.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Run Regex On Content", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <textarea rows="1" class="cr_width_full" name="twitomatic_users_list[strip_by_regex][]" placeholder="regex" class="cr_width_full">' . esc_textarea($strip_by_regex) . '</textarea> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Replace the above regex matches with this regex expression. If you want to strip matched content, leave this field blank. No Regex separators are required here. You can add also multiple replacement expressions, each on a new line.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Replace Matches From Regex (Content)", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <textarea rows="1" class="cr_width_full" name="twitomatic_users_list[replace_regex][]" placeholder="regex replacement" class="cr_width_full">' . esc_textarea($replace_regex) . '</textarea> </div> </td></tr> <tr> <td colspan="2"> <h3>' . esc_html__("Scheduling Options:", 'twitomatic-twitter-post-generator') . '</h3> </td> </tr> <tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Add a time period between the plugin will run importing at a schedule. To disable this feature, leave this field blank. This works based on your current server timezone and time. Your current server time is: ", 'twitomatic-twitter-post-generator') . date("h:i A") . ' </div> </div> <b>' . esc_html__("Automatically Run Rules Only Between These Hour Periods Each Day", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="time" id="run_after" name="twitomatic_users_list[run_after][]" value="' . esc_attr($run_after) . '" placeholder="' . esc_html__("Run Rules Only After This Hour", 'twitomatic-twitter-post-generator') . '"> - <input type="time" id="run_before" name="twitomatic_users_list[run_before][]" value="' . esc_attr($run_before) . '" placeholder="' . esc_html__("Run Rules Only Before This Hour", 'twitomatic-twitter-post-generator') . '"> </div> </td></tr> <tr> <td colspan="2"> <h3>' . esc_html__("Posting Restrictions:", 'twitomatic-twitter-post-generator') . '</h3> </td> </tr><tr><td class="cr_min_width_200"><div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do not include posts that\'s title or content contains at least one of these words. Separate words by comma. To disable this feature, leave this field blank.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Banned Words List", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="text" class="cr_width_full" name="twitomatic_users_list[banned_words][]" value="' . esc_attr($banned_words) . '" placeholder="banned1, banned2, banned3" class="cr_width_full"> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do not include posts that\'s title or content does not contain at least one of these words. Separate words by comma. To disable this feature, leave this field blank. If you wish to input a keyword that must be required in all cases (AND), please use it in this format: &&keyword. Example: granny, dad, &&mom. This translates into: (granny OR dad) AND MOM", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Required Words List", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="text" class="cr_width_full" name="twitomatic_users_list[required_words][]" value="' . esc_attr($required_words) . '" placeholder="required1, required2, required3" class="cr_width_full"> </div> </td></tr> <tr> <td colspan="2"> <h3>' . esc_html__("Post Customizations:", 'twitomatic-twitter-post-generator') . '</h3> </td> </tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__('If your template supports "Post Formats", than you can select one here. If not, leave this at it\'s default value.', 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Generated Post Format", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <select id="post_format" name="twitomatic_users_list[post_format][]" class="cr_width_full"> <option value="post-format-standard"'; if ($post_format == 'post-format-standard') { $output .= ' selected'; } $output .= '>' . esc_html__("Standard", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-aside"'; if ($post_format == 'post-format-aside') { $output .= ' selected'; } $output .= '>' . esc_html__("Aside", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-gallery"'; if ($post_format == 'post-format-gallery') { $output .= ' selected'; } $output .= '>' . esc_html__("Gallery", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-link"'; if ($post_format == 'post-format-link') { $output .= ' selected'; } $output .= '>' . esc_html__("Link", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-image"'; if ($post_format == 'post-format-image') { $output .= ' selected'; } $output .= '>' . esc_html__("Image", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-quote"'; if ($post_format == 'post-format-quote') { $output .= ' selected'; } $output .= '>' . esc_html__("Quote", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-status"'; if ($post_format == 'post-format-status') { $output .= ' selected'; } $output .= '>' . esc_html__("Status", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-video"'; if ($post_format == 'post-format-video') { $output .= ' selected'; } $output .= '>' . esc_html__("Video", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-audio"'; if ($post_format == 'post-format-audio') { $output .= ' selected'; } $output .= '>' . esc_html__("Audio", 'twitomatic-twitter-post-generator') . '</option> <option value="post-format-chat"'; if ($post_format == 'post-format-chat') { $output .= ' selected'; } $output .= '>' . esc_html__("Chat", 'twitomatic-twitter-post-generator') . '</option> </select> </div> </td></tr><tr><td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Select the post category that you want for the automatically generated posts to have.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Additional Post Category", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <select class="cr_width_full" id="default_category" name="twitomatic_users_list[default_category][]"> <option value="twitomatic_no_category_12345678">' . esc_html__("Do Not Add a Category", 'twitomatic-twitter-post-generator') . '</option>'; foreach ($categories as $category) { $output .= '<option value="' . esc_attr($category->term_id) . '"'; if ($category->term_id == $default_category) { $output .= ' selected'; } $output .= '>' . sanitize_text_field($category->name) . '</option>'; } $output .= '</select> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to automatically add post categories from the feed items?", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Auto Add Categories", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <select class="cr_width_full" id="auto_categories" name="twitomatic_users_list[auto_categories][]"> <option value="disabled"'; if ($auto_categories == 'disabled') { $output .= ' selected'; } $output .= '>' . esc_html__("Disabled", 'twitomatic-twitter-post-generator') . '</option> <option value="user"'; if ($auto_categories == 'user') { $output .= ' selected'; } $output .= '>' . esc_html__("User Names", 'twitomatic-twitter-post-generator') . '</option> <option value="hashtags"'; if ($auto_categories == 'hashtags') { $output .= ' selected'; } $output .= '>' . esc_html__("HashTags", 'twitomatic-twitter-post-generator') . '</option> <option value="content"'; if ($auto_categories == 'content') { $output .= ' selected'; } $output .= '>' . esc_html__("Content", 'twitomatic-twitter-post-generator') . '</option> <option value="both"'; if ($auto_categories == 'both') { $output .= ' selected'; } $output .= '>' . esc_html__("HashTags and Content", 'twitomatic-twitter-post-generator') . '</option> </select> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Select the auto created categories parent category id. If you leave this field blank, automatically created categories will be a root category (no parent).", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Auto Created Categories Parent Category ID", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="number" min="0" step="1" id="parent_category_id" name="twitomatic_users_list[parent_category_id][]" value="' . esc_attr($parent_category_id) . '" placeholder="Parent category id" class="cr_width_full"> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("This feature will try to remove the WordPress\'s default post category. This may fail in case no additional categories are added, because WordPress requires at least one post category for every post.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Remove WP Default Post Category", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="remove_default" name="twitomatic_users_list[remove_default][]"'; if($remove_default == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to automatically add post tags from the feed items?", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Auto Add Tags", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <select class="cr_width_full" id="auto_tags" name="twitomatic_users_list[auto_tags][]"> <option value="disabled"'; if ($auto_tags == 'disabled') { $output .= ' selected'; } $output .= '>' . esc_html__("Disabled", 'twitomatic-twitter-post-generator') . '</option> <option value="user"'; if ($auto_tags == 'user') { $output .= ' selected'; } $output .= '>' . esc_html__("User Names", 'twitomatic-twitter-post-generator') . '</option> <option value="hashtags"'; if ($auto_tags == 'hashtags') { $output .= ' selected'; } $output .= '>' . esc_html__("HashTags", 'twitomatic-twitter-post-generator') . '</option> <option value="content"'; if ($auto_tags == 'content') { $output .= ' selected'; } $output .= '>' . esc_html__("Content", 'twitomatic-twitter-post-generator') . '</option> <option value="both"'; if ($auto_tags == 'both') { $output .= ' selected'; } $output .= '>' . esc_html__("HashTags and Content", 'twitomatic-twitter-post-generator') . '</option> </select> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Select the post tags that you want for the automatically generated posts to have.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Additional Post Tags", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input class="cr_width_full" type="text" name="twitomatic_users_list[default_tags][]" value="' . esc_attr($default_tags) . '" placeholder="Please insert your additional post tags here" > </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to enable comments for the generated posts?", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Enable Comments For Posts", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="enable_comments" name="twitomatic_users_list[enable_comments][]"'; if ($enable_comments == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to enable pingbacks and trackbacks for the generated posts?", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Enable Pingback/Trackback", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="enable_pingback" name="twitomatic_users_list[enable_pingback][]"'; if ($enable_pingback == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Do you want to set featured image for generated post (to the first image that was found in the post)?", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Auto Get Featured Image", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="featured_image" name="twitomatic_users_list[featured_image][]"'; if ($featured_image == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Insert a comma separated list of links to valid images that will be set randomly for the featured image for the posts that do not have a valid image attached or if you disabled automatical featured image generation. You can also use image numeric IDs from images found in the Media Gallery. To disable this feature, leave this field blank.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Default Featured Image List", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input class="cr_width_full" type="text" name="twitomatic_users_list[image_url][]" placeholder="Please insert the link to a valid image" value="' . esc_attr($image_url) . '"/> </td></tr><tr><td> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("This works only if you configured phantomjs usage, from the Main Settings of the plugin. Choose if you want to use phantomjs to generate the screenshot for the page you are crawling and attach it to the generated post, regardless if you use the %%item_show_screenshot%% and %%item_screenshot_url%% shortcodes.", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Attach Screenshot to All Generated Posts", 'twitomatic-twitter-post-generator') . ':</b> </td><td> <input type="checkbox" id="attach_screen" name="twitomatic_users_list[attach_screen][]"'; if ($attach_screen == '1') { $output .= ' checked'; } $output .= '> </div> </td></tr><tr><td class="cr_min_width_200"> <div> <div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . esc_html__("Set the custom fields that will be set for generated posts. The syntax for this field is the following: custom_field_name1 => custom_field_value1, custom_field_name2 => custom_field_value2, ... . In custom_field_valueX, you can use shortcodes, same like in post content. You can also assign the data to array custom fields, using this format: array_field[index_name1] => custom_field_value1, array_field[index_name2] => custom_field_value2. Example (without quotes): \'title_custom_field => %%item_title%%\'. You can use the following shortcodes: %%item_title%%, %%item_content%%, %%item_url%%, %%item_content_plain_text%%, %%item_read_more_button%%, %%item_show_image%%, %%twitter_tweet_button%%, %%item_image_URL%%, %%item_retweet_count%%, %%item_fav_count%%, %%video_url%%, %%item_user_screen_name%%, %%item_user_name%%, %%item_media%%, %%item_description%%, %%item_card%%, %%item_longitude%%, %%item_latitude%%, %%author_link%%, %%author%%, %%random_sentence%%, %%random_sentence2%%, %%custom_html%%, %%custom_html2%%, %%item_cat%%, %%item_tags%%, %%item_screenshot_url%%, %%item_show_screenshot%%", 'twitomatic-twitter-post-generator') . ' </div> </div> <b>' . esc_html__("Post Custom Fields", 'twitomatic-twitter-post-generator') . ':</b> <b><a href="https://coderevolution.ro/knowledge-base/faq/post-template-reference-advanced-usage/" target="_blank">ⓘ</a></b> </td><td> <textarea rows="1" cols="70" name="twitomatic_users_list[custom_fields][]" placeholder="Please insert your desired custom fields. Example: title_custom_field => %%item_title%%" class="cr_width_full">' . esc_textarea($custom_fields) . '</textarea> </div> </td></tr></table></div> </div> <div class="codemodalfzr-footer"> <br/> <h3 class="cr_inline">Twitomatic Automatic Post Generator</h3><span id="twitomatic_ok' . esc_html($cont) . '" class="codeokfzr cr_inline">OK </span> <br/><br/> </div> </div> </div> </td> <td class="cr_shrt_td2"><span class="wptwitomatic-delete">X</span></td> <td class="cr_short_td"><input type="checkbox" name="twitomatic_users_list[active][]" class="activateDeactivateClass" value="1"'; if (isset($active) && $active === '1') { $output .= ' checked'; } $output .= '/> <input type="hidden" name="twitomatic_users_list[last_run][]" value="' . esc_attr($last_run) . '"/></td> <td class="cr_shrt_td2"><div class="bws_help_box bws_help_box_right dashicons dashicons-editor-help cr_align_middle"> <div class="bws_hidden_help_text cr_min_260px">' . sprintf( wp_kses( __( 'Shortcode for this rule<br/>(to cross-post from this plugin in other plugins):', 'twitomatic-twitter-post-generator'), array( 'br' => array( ) ) ) ) . '<br/><b>%%twitomatic_2_' . esc_html($cont) . '%% and %%twitomatic_title_2_' . esc_html($cont) . '%%</b><br/>' . esc_html__('Posts Generated:', 'twitomatic-twitter-post-generator') . ' ' . esc_html($generated_posts) . '<br/>'; if ($generated_posts != 0) { if (isset($twitomatic_Main_Settings['post_source_custom']) && $twitomatic_Main_Settings['post_source_custom'] != '') { $output .= '<a href="' . get_admin_url() . 'edit.php?coderevolution_post_source=' . str_replace(' ', '-', $twitomatic_Main_Settings['post_source_custom']) . '&post_type=' . esc_html($def_type) . '" target="_blank">' . esc_html__('View Generated Posts', 'twitomatic-twitter-post-generator') . '</a><br/>'; } else { $output .= '<a href="' . get_admin_url() . 'edit.php?coderevolution_post_source=Twitomatic_2_' . esc_html($cont) . '&post_type=' . esc_html($def_type) . '" target="_blank">' . esc_html__('View Generated Posts', 'twitomatic-twitter-post-generator') . '</a><br/>'; } } $output .= esc_html__('Last Run: ', 'twitomatic-twitter-post-generator'); if ($last_run == '1988-01-27 00:00:00') { $output .= 'Never'; } else { $output .= $last_run; } $output .= '<br/>' . esc_html__('Next Run: ', 'twitomatic-twitter-post-generator'); if($unlocker == '1') { $nextrun = twitomatic_add_minute($last_run, $schedule); } else { $nextrun = twitomatic_add_hour($last_run, $schedule); } $now = twitomatic_get_date_now(); if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) { $output .= esc_html__('WP-CRON Disabled. Rules will not automatically run!', 'twitomatic-twitter-post-generator'); } else { if (isset($active) && $active === '1') { if($unlocker == '1') { $twitomatic_hour_diff = (int) twitomatic_minute_diff($now, $nextrun); } else { $twitomatic_hour_diff = (int) twitomatic_hour_diff($now, $nextrun); } if ($twitomatic_hour_diff >= 0) { $append = 'Now.'; $cron = _get_cron_array(); if ($cron != FALSE) { $date_format = _x('Y-m-d H:i:s', 'Date Time Format1', 'twitomatic-twitter-post-generator'); foreach ($cron as $timestamp => $cronhooks) { foreach ((array) $cronhooks as $hook => $events) { if ($hook == 'twitomaticaction') { foreach ((array) $events as $key => $event) { $append = date_i18n($date_format, $timestamp); } } } } } $output .= $append; } else { $output .= $nextrun; } } else { $output .= esc_html__('Rule Disabled', 'twitomatic-twitter-post-generator'); } } $output .= '<br/>' . esc_html__('Local Time: ', 'twitomatic-twitter-post-generator') . $now; $output .= '</div> </div></td> <td class="cr_center"> <div> <img id="run_img' . esc_html($cont) . '" src="' . plugin_dir_url(dirname(__FILE__)) . 'images/running.gif' . '" alt="Running" class="cr_status_icon'; if (!empty($running)) { if (!in_array($cont, $running)) { $output .= ' cr_hidden'; } else { $f = fopen(get_temp_dir() . 'twitomatic_' . $cont, 'w'); if($f !== false) { if (!flock($f, LOCK_EX | LOCK_NB)) { } else { $output .= ' cr_hidden'; flock($f, LOCK_UN); if (($xxkey = array_search($cont, $running)) !== false) { unset($running[$xxkey]); update_option('twitomatic_running_list', $running); } } } } } else { $output .= ' cr_hidden'; } $output .= '" title="status"> <div class="codemainfzr"> <select id="actions" class="actions" name="actions" onchange="actionsChangedManual(' . esc_html($cont) . ', this.value, 2);" onfocus="this.selectedIndex = 0;"> <option value="select" disabled selected>' . esc_html__("Select an Action", 'twitomatic-twitter-post-generator') . '</option> <option value="run">' . esc_html__("Run This Rule Now", 'twitomatic-twitter-post-generator') . '</option> <option value="trash">' . esc_html__("Move All Posts To Trash", 'twitomatic-twitter-post-generator') . '</option> <option value="duplicate">' . esc_html__("Duplicate This Rule", 'twitomatic-twitter-post-generator') . '</option> <option value="delete">' . esc_html__("Permanently Delete All Posts", 'twitomatic-twitter-post-generator') . '</option> </select> </div> </div> </td> </tr> '; $cont = $cont + 1; } } return $output; } ?>
Save File
Cancel