| @@ -1,0 +1,1252 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Admin Dashboard Page | |
| 4 | + * | |
| 5 | + * @package AutomatorWP\Admin\Dashboard | |
| 6 | + * @author AutomatorWP <[email protected]>, Ruben Garcia <[email protected]> | |
| 7 | + * @since 2.0.0 | |
| 8 | + */ | |
| 9 | +// Exit if accessed directly | |
| 10 | +if( !defined( 'ABSPATH' ) ) exit; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * Dashboard page | |
| 14 | + * | |
| 15 | + * @since 2.0.0 | |
| 16 | + */ | |
| 17 | +function automatorwp_dashboard_page() { | |
| 18 | + ?> | |
| 19 | + <div class="wrap automatorwp-dashboard"> | |
| 20 | + | |
| 21 | + <div id="icon-options-general" class="icon32"></div> | |
| 22 | + <h1 class="wp-heading-inline"><?php esc_html_e( 'Dashboard', 'automatorwp' ); ?></h1> | |
| 23 | + <hr class="wp-header-end"> | |
| 24 | + | |
| 25 | + <div id="dashboard-widgets-wrap"> | |
| 26 | + <div id="dashboard-widgets" class="metabox-holder"> | |
| 27 | + | |
| 28 | + <?php // Logo ?> | |
| 29 | + <div class="automatorwp-dashboard-logo"> | |
| 30 | + <img src="<?php echo AUTOMATORWP_URL . 'assets/img/automatorwp-brand-logo.svg' ?>" alt="AutomatorWP"> | |
| 31 | + <strong class="automatorwp-dashboard-version">v<?php echo AUTOMATORWP_VER; ?></strong> | |
| 32 | + </div> | |
| 33 | + | |
| 34 | + <?php // Dashboard ?> | |
| 35 | + <h1><?php echo esc_html_e( 'Dashboard', 'automatorwp' ); ?></h1> | |
| 36 | + | |
| 37 | + <div id="postbox-container-1" class="postbox-container"> | |
| 38 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 39 | + | |
| 40 | + <?php // Latest Automations ?> | |
| 41 | + <?php automatorwp_dashboard_box( array( | |
| 42 | + 'id' => 'latest-automations', | |
| 43 | + 'title' => __( 'Latest Automations', 'automatorwp' ) . '<a href="' . ct_get_list_link( 'automatorwp_automations' ) . '" class="button button-primary">' . esc_html__( 'View All', 'automatorwp' ) . '</a>', | |
| 44 | + 'content_cb' => 'automatorwp_dashboard_latest_automations_box', | |
| 45 | + ) ); ?> | |
| 46 | + | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + | |
| 50 | + <div id="postbox-container-2" class="postbox-container"> | |
| 51 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 52 | + | |
| 53 | + <?php // Most Completed Automations ?> | |
| 54 | + <?php automatorwp_dashboard_box( array( | |
| 55 | + 'id' => 'most-completed-automations', | |
| 56 | + 'title' => __( 'Most Completed Automations', 'automatorwp' ) . '<a href="' . ct_get_list_link( 'automatorwp_automations' ) . '" class="button button-primary">' . esc_html__( 'View All', 'automatorwp' ) . '</a>', | |
| 57 | + 'content_cb' => 'automatorwp_dashboard_most_completed_automations_box', | |
| 58 | + ) ); ?> | |
| 59 | + | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | + | |
| 63 | + <div id="postbox-container-3" class="postbox-container"> | |
| 64 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 65 | + | |
| 66 | + <?php // Latest Logs ?> | |
| 67 | + <?php automatorwp_dashboard_box( array( | |
| 68 | + 'id' => 'latest-logs', | |
| 69 | + 'title' => __( 'Latest Logs', 'automatorwp' ) . '<a href="' . ct_get_list_link( 'automatorwp_logs' ) . '" class="button button-primary">' . esc_html__( 'View All', 'automatorwp' ) . '</a>', | |
| 70 | + 'content_cb' => 'automatorwp_dashboard_latest_logs_box', | |
| 71 | + ) ); ?> | |
| 72 | + | |
| 73 | + </div> | |
| 74 | + </div> | |
| 75 | + | |
| 76 | + <div id="postbox-container-4" class="postbox-container"> | |
| 77 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 78 | + | |
| 79 | + <?php // New Automation ?> | |
| 80 | + <?php automatorwp_dashboard_box( array( | |
| 81 | + 'id' => 'new-automation', | |
| 82 | + 'title' => __( 'New Automation', 'automatorwp' ), | |
| 83 | + 'content_cb' => 'automatorwp_dashboard_new_automation_box', | |
| 84 | + ) ); ?> | |
| 85 | + | |
| 86 | + </div> | |
| 87 | + </div> | |
| 88 | + | |
| 89 | + <?php // Videos ?> | |
| 90 | + <h1><?php echo esc_html_e( 'Videos', 'automatorwp' ); ?></h1> | |
| 91 | + | |
| 92 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 93 | + | |
| 94 | + <?php // Videos ?> | |
| 95 | + <?php automatorwp_dashboard_box( array( | |
| 96 | + 'id' => 'videos', | |
| 97 | + 'title' => '', | |
| 98 | + 'content_cb' => 'automatorwp_dashboard_videos_box', | |
| 99 | + ) ); ?> | |
| 100 | + | |
| 101 | + </div> | |
| 102 | + | |
| 103 | + <?php // Add-ons ?> | |
| 104 | + <?php automatorwp_dashboard_add_ons_section(); ?> | |
| 105 | + | |
| 106 | + <?php // Integrations ?> | |
| 107 | + <?php automatorwp_dashboard_integrations_section(); ?> | |
| 108 | + | |
| 109 | + <?php // Apps Integrations ?> | |
| 110 | + <?php automatorwp_dashboard_apps_section(); ?> | |
| 111 | + | |
| 112 | + <?php // Documentation ?> | |
| 113 | + <div class="automatorwp-dashboard-docs-section"> | |
| 114 | + <h1><?php echo esc_html_e( 'Documentation', 'automatorwp' ); ?></h1> | |
| 115 | + | |
| 116 | + <div id="postbox-container-1" class="postbox-container"> | |
| 117 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 118 | + | |
| 119 | + <?php // Getting started ?> | |
| 120 | + <?php automatorwp_dashboard_box( array( | |
| 121 | + 'id' => 'docs', | |
| 122 | + 'title' => __( 'Getting started', 'automatorwp' ), | |
| 123 | + 'content_cb' => 'automatorwp_dashboard_docs_box', | |
| 124 | + ) ); ?> | |
| 125 | + | |
| 126 | + </div> | |
| 127 | + </div> | |
| 128 | + | |
| 129 | + <div id="postbox-container-2" class="postbox-container"> | |
| 130 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 131 | + | |
| 132 | + <?php // Features ?> | |
| 133 | + <?php automatorwp_dashboard_box( array( | |
| 134 | + 'id' => 'features', | |
| 135 | + 'title' => __( 'Features', 'automatorwp' ), | |
| 136 | + 'content_cb' => 'automatorwp_dashboard_features_box', | |
| 137 | + ) ); ?> | |
| 138 | + | |
| 139 | + </div> | |
| 140 | + </div> | |
| 141 | + | |
| 142 | + <div id="postbox-container-3" class="postbox-container"> | |
| 143 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 144 | + | |
| 145 | + <?php // Advanced Features ?> | |
| 146 | + <?php automatorwp_dashboard_box( array( | |
| 147 | + 'id' => 'advanced', | |
| 148 | + 'title' => __( 'Advanced features', 'automatorwp' ), | |
| 149 | + 'content_cb' => 'automatorwp_dashboard_advanced_features_box', | |
| 150 | + ) ); ?> | |
| 151 | + | |
| 152 | + </div> | |
| 153 | + </div> | |
| 154 | + | |
| 155 | + <div id="postbox-container-4" class="postbox-container"> | |
| 156 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 157 | + | |
| 158 | + <?php // Support ?> | |
| 159 | + <?php automatorwp_dashboard_box( array( | |
| 160 | + 'id' => 'support', | |
| 161 | + 'title' => __( 'Support', 'automatorwp' ), | |
| 162 | + 'content_cb' => 'automatorwp_dashboard_support_box', | |
| 163 | + ) ); ?> | |
| 164 | + | |
| 165 | + </div> | |
| 166 | + </div> | |
| 167 | + </div> | |
| 168 | + | |
| 169 | + <?php // About ?> | |
| 170 | + <h1><?php echo esc_html_e( 'About', 'automatorwp' ); ?></h1> | |
| 171 | + | |
| 172 | + <div id="postbox-container-1" class="postbox-container"> | |
| 173 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 174 | + | |
| 175 | + <?php // Plugins ?> | |
| 176 | + <?php automatorwp_dashboard_box( array( | |
| 177 | + 'id' => 'plugins', | |
| 178 | + 'title' => __( 'Our Plugins', 'automatorwp' ), | |
| 179 | + 'content_cb' => 'automatorwp_dashboard_plugins_box', | |
| 180 | + ) ); ?> | |
| 181 | + | |
| 182 | + </div> | |
| 183 | + </div> | |
| 184 | + | |
| 185 | + <div id="postbox-container-2" class="postbox-container"> | |
| 186 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 187 | + | |
| 188 | + <?php // Team ?> | |
| 189 | + <?php automatorwp_dashboard_box( array( | |
| 190 | + 'id' => 'team', | |
| 191 | + 'title' => __( 'Meet the team', 'automatorwp' ), | |
| 192 | + 'content_cb' => 'automatorwp_dashboard_team_box', | |
| 193 | + ) ); ?> | |
| 194 | + | |
| 195 | + </div> | |
| 196 | + </div> | |
| 197 | + | |
| 198 | + <div id="postbox-container-3" class="postbox-container"> | |
| 199 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 200 | + | |
| 201 | + <?php // Get involved ?> | |
| 202 | + <?php automatorwp_dashboard_box( array( | |
| 203 | + 'id' => 'involved', | |
| 204 | + 'title' => __( 'Get involved', 'automatorwp' ), | |
| 205 | + 'content_cb' => 'automatorwp_dashboard_involved_box', | |
| 206 | + ) ); ?> | |
| 207 | + | |
| 208 | + </div> | |
| 209 | + </div> | |
| 210 | + | |
| 211 | + <div id="postbox-container-4" class="postbox-container"> | |
| 212 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable"> | |
| 213 | + | |
| 214 | + <?php // Social ?> | |
| 215 | + <?php automatorwp_dashboard_box( array( | |
| 216 | + 'id' => 'social', | |
| 217 | + 'title' => __( 'Follow us', 'automatorwp' ), | |
| 218 | + 'content_cb' => 'automatorwp_dashboard_social_box', | |
| 219 | + ) ); ?> | |
| 220 | + | |
| 221 | + </div> | |
| 222 | + </div> | |
| 223 | + | |
| 224 | + </div> | |
| 225 | + </div> | |
| 226 | + | |
| 227 | + </div> | |
| 228 | + <?php | |
| 229 | +} | |
| 230 | + | |
| 231 | +/** | |
| 232 | + * Dashboard page | |
| 233 | + * | |
| 234 | + * @since 2.0.0 | |
| 235 | + */ | |
| 236 | +function automatorwp_dashboard_box( $args ) { | |
| 237 | + | |
| 238 | + $args = wp_parse_args( $args, array( | |
| 239 | + 'id' => '', | |
| 240 | + 'title' => '', | |
| 241 | + 'content' => '', | |
| 242 | + 'content_cb' => '', | |
| 243 | + ) ); | |
| 244 | + | |
| 245 | + ?> | |
| 246 | + <div id="automatorwp-dashboard-<?php echo $args['id']; ?>" class="automatorwp-dashboard-box postbox"> | |
| 247 | + | |
| 248 | + <div class="postbox-header"> | |
| 249 | + <h2 class="hndle"><?php echo $args['title']; ?></h2> | |
| 250 | + </div> | |
| 251 | + | |
| 252 | + <div class="inside"> | |
| 253 | + | |
| 254 | + <?php if( is_callable( $args['content_cb'] ) ) { | |
| 255 | + call_user_func( $args['content_cb'] ); | |
| 256 | + } else { | |
| 257 | + echo $args['content']; | |
| 258 | + } ?> | |
| 259 | + | |
| 260 | + </div> | |
| 261 | + | |
| 262 | + </div> | |
| 263 | + <?php | |
| 264 | + | |
| 265 | +} | |
| 266 | + | |
| 267 | +/** | |
| 268 | + * Dashboard plugin card | |
| 269 | + * | |
| 270 | + * @since 2.0.0 | |
| 271 | + */ | |
| 272 | +function automatorwp_dashboard_render_plugin_card( $plugin ) { | |
| 273 | + | |
| 274 | + $details_link = 'https://automatorwp.com/add-ons/' . $plugin->info->slug; | |
| 275 | + $thumbnail = 'https://automatorwp.com/wp-content/themes/automatorwp-theme/assets/img/integrations/' . $plugin->info->slug . '.svg'; | |
| 276 | + | |
| 277 | + $action_label = esc_html__( 'Get this add-on', 'automatorwp' ); | |
| 278 | + | |
| 279 | + ?> | |
| 280 | + | |
| 281 | + <div class="automatorwp-plugin-card plugin-card plugin-card-<?php echo sanitize_html_class( $plugin->info->slug ); ?>"> | |
| 282 | + | |
| 283 | + <div class="plugin-card-top cmb-tooltip"> | |
| 284 | + | |
| 285 | + <div class="thumbnail column-thumbnail"> | |
| 286 | + <a href="<?php echo esc_url( $details_link ); ?>" class="open-plugin-details-modal" target="_blank"> | |
| 287 | + <img src="<?php echo esc_attr( $thumbnail ) ?>" class="plugin-thumbnail" alt=""> | |
| 288 | + </a> | |
| 289 | + </div> | |
| 290 | + | |
| 291 | + <div class="name column-name"> | |
| 292 | + <h3> | |
| 293 | + <a href="<?php echo esc_url( $details_link ); ?>" class="open-plugin-details-modal" target="_blank"> | |
| 294 | + <?php echo $plugin->info->title; ?> | |
| 295 | + </a> | |
| 296 | + </h3> | |
| 297 | + </div> | |
| 298 | + | |
| 299 | + <div class="desc column-description cmb-tooltip-desc cmb-tooltip-top"> | |
| 300 | + <p><?php echo automatorwp_esc_plugin_excerpt( $plugin->info->excerpt ); ?></p> | |
| 301 | + </div> | |
| 302 | + | |
| 303 | + </div> | |
| 304 | + | |
| 305 | + </div> | |
| 306 | + | |
| 307 | + <?php | |
| 308 | + | |
| 309 | +} | |
| 310 | + | |
| 311 | +function automatorwp_dashboard_render_automation( $automation ) { | |
| 312 | + | |
| 313 | + $title = ! empty( $automation->title ) ? $automation->title : __( '(No title)', 'automatorwp' ); | |
| 314 | + $title = '<strong><a href="' . ct_get_edit_link( 'automatorwp_automations', $automation->id ) . '">' . esc_html( $title ) . '</a></strong>'; | |
| 315 | + | |
| 316 | + $types = automatorwp_get_automation_types(); | |
| 317 | + | |
| 318 | + $type = '<span class="automatorwp-automation-type automatorwp-automation-type-' . esc_attr( $automation->type ) . '">'; | |
| 319 | + $type .= isset( $types[$automation->type] ) ? $types[$automation->type]['label'] : $automation->type; | |
| 320 | + $type .= '</span>'; | |
| 321 | + | |
| 322 | + $type_icon = ''; | |
| 323 | + | |
| 324 | + if( isset( $types[$automation->type] ) ) { | |
| 325 | + $type_icon = '<div class="automatorwp-integration-icon cmb-tooltip"> | |
| 326 | + <img src="' . esc_attr( $types[$automation->type]['image'] ) . '" alt="' . esc_attr( $types[$automation->type]['label'] ) . '"> | |
| 327 | + <span class="cmb-tooltip-desc cmb-tooltip-top">' . esc_html( $types[$automation->type]['label'] ) . '</span> | |
| 328 | + </div>'; | |
| 329 | + } | |
| 330 | + | |
| 331 | + $completions = ct_get_object_meta( $automation->id, 'completions', true ); | |
| 332 | + | |
| 333 | + if( empty( $completions ) ) { | |
| 334 | + $completions = automatorwp_get_object_completion_times( $automation->id, 'automation' ); | |
| 335 | + ct_update_object_meta( $automation->id, 'completions', $completions ); | |
| 336 | + } | |
| 337 | + | |
| 338 | + $completions = absint( $completions ); | |
| 339 | + $times = absint( $automation->times ); | |
| 340 | + | |
| 341 | + if( $times !== 0 ) { | |
| 342 | + $completions = $completions . '/' . $times; | |
| 343 | + } | |
| 344 | + | |
| 345 | + $completions = '<span class="automatorwp-automation-completions cmb-tooltip ' . ( $times !== 0 && $completions >= $times ? 'automatorwp-automation-completions-completed' : '' ) . '">' | |
| 346 | + . $completions | |
| 347 | + . '<span class="cmb-tooltip-desc cmb-tooltip-top">' . esc_html__( 'Completions', 'automatorwp' ) . '</span>' | |
| 348 | + . '</span>'; | |
| 349 | + | |
| 350 | + $statuses = automatorwp_get_automation_statuses(); | |
| 351 | + $status = isset( $statuses[$automation->status] ) ? $statuses[$automation->status] : esc_html( $automation->status ); | |
| 352 | + $status = '<span class="automatorwp-automation-status automatorwp-automation-status-' . esc_attr( $automation->status ) . '">' . $status . '</span>'; | |
| 353 | + | |
| 354 | + $time = strtotime( $automation->date ); | |
| 355 | + $today = date( 'Y-m-d', current_time( 'timestamp' ) ); | |
| 356 | + $yesterday = date( 'Y-m-d', strtotime( '-1 day', current_time( 'timestamp' ) ) ); | |
| 357 | + | |
| 358 | + if ( date( 'Y-m-d', $time ) === $today ) { | |
| 359 | + $relative = __( 'Today', 'automatorwp' ); | |
| 360 | + } elseif ( date( 'Y-m-d', $time ) === $yesterday ) { | |
| 361 | + $relative = __( 'Yesterday', 'automatorwp' ); | |
| 362 | + } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) { | |
| 363 | + /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ | |
| 364 | + $relative = date_i18n( __( 'M jS Y' ), $time ); | |
| 365 | + } else { | |
| 366 | + /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */ | |
| 367 | + $relative = date_i18n( __( 'M jS' ), $time ); | |
| 368 | + } | |
| 369 | + | |
| 370 | + $date = sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, mysql2date( get_option( 'time_format' ), $automation->date ) ); | |
| 371 | + echo '<li>' | |
| 372 | + . '<div>' | |
| 373 | + . '<span>' .$type_icon . '</span>' | |
| 374 | + . '</div>' | |
| 375 | + . '<div>' | |
| 376 | + . '<span>' . $title . '</span>' | |
| 377 | + . '<span>' . $completions . '</span>' | |
| 378 | + . '</div>' | |
| 379 | + . '<div>' | |
| 380 | + . '<span>' . $status . '</span>' | |
| 381 | + . '<span>' . $date . '</span>' | |
| 382 | + . '</div>' | |
| 383 | + . '</li>'; | |
| 384 | + | |
| 385 | +} | |
| 386 | + | |
| 387 | +/** | |
| 388 | + * Dashboard latest automations box | |
| 389 | + * | |
| 390 | + * @since 2.0.0 | |
| 391 | + */ | |
| 392 | +function automatorwp_dashboard_latest_automations_box() { | |
| 393 | + // Setup table | |
| 394 | + ct_setup_table( 'automatorwp_automations' ); | |
| 395 | + | |
| 396 | + $query = new CT_Query( array( | |
| 397 | + 'orderby' => 'date', | |
| 398 | + 'order' => 'DESC', | |
| 399 | + 'items_per_page' => 5, | |
| 400 | + 'no_found_rows' => true, | |
| 401 | + 'cache_results' => false, | |
| 402 | + ) ); | |
| 403 | + | |
| 404 | + $automations = $query->get_results(); | |
| 405 | + | |
| 406 | + if ( count( $automations ) > 0 ) { | |
| 407 | + | |
| 408 | + echo '<div id="automatorwp-latest-automations" class="automatorwp-automations">'; | |
| 409 | + | |
| 410 | + echo '<ul>'; | |
| 411 | + | |
| 412 | + foreach ( $automations as $automation ) | |
| 413 | + automatorwp_dashboard_render_automation( $automation ); | |
| 414 | + | |
| 415 | + echo '</ul>'; | |
| 416 | + | |
| 417 | + echo '</div>'; | |
| 418 | + | |
| 419 | + } else { | |
| 420 | + echo '<p>' . __( 'Nothing to show :)', 'automatorwp' ) .'</p>'; | |
| 421 | + } | |
| 422 | +} | |
| 423 | + | |
| 424 | +/** | |
| 425 | + * Dashboard most completed automations box | |
| 426 | + * | |
| 427 | + * @since 2.0.0 | |
| 428 | + */ | |
| 429 | +function automatorwp_dashboard_most_completed_automations_box() { | |
| 430 | + global $wpdb, $ct_table; | |
| 431 | + | |
| 432 | + // Setup table | |
| 433 | + $automations_table = AutomatorWP()->db->automations; | |
| 434 | + $automations_meta_table = AutomatorWP()->db->automations_meta; | |
| 435 | + | |
| 436 | + $automations = $wpdb->get_results( | |
| 437 | + "SELECT a.* | |
| 438 | + FROM {$automations_table} AS a | |
| 439 | + LEFT JOIN {$automations_meta_table} AS am ON ( am.id = a.id AND am.meta_key = 'completions' ) | |
| 440 | + ORDER BY CAST( am.meta_value AS UNSIGNED ) DESC | |
| 441 | + LIMIT 5" | |
| 442 | + ); | |
| 443 | + | |
| 444 | + ct_setup_table( 'automatorwp_automations' ); | |
| 445 | + | |
| 446 | + if ( count( $automations ) > 0 ) { | |
| 447 | + | |
| 448 | + echo '<div id="automatorwp-latest-automations" class="automatorwp-automations">'; | |
| 449 | + | |
| 450 | + echo '<ul>'; | |
| 451 | + | |
| 452 | + foreach ( $automations as $automation ) | |
| 453 | + automatorwp_dashboard_render_automation( $automation ); | |
| 454 | + | |
| 455 | + echo '</ul>'; | |
| 456 | + | |
| 457 | + echo '</div>'; | |
| 458 | + | |
| 459 | + } else { | |
| 460 | + echo '<p>' . __( 'Nothing to show :)', 'automatorwp' ) .'</p>'; | |
| 461 | + } | |
| 462 | +} | |
| 463 | + | |
| 464 | +/** | |
| 465 | + * Dashboard latest logs box | |
| 466 | + * | |
| 467 | + * @since 2.0.0 | |
| 468 | + */ | |
| 469 | +function automatorwp_dashboard_latest_logs_box() { | |
| 470 | + // Setup table | |
| 471 | + ct_setup_table( 'automatorwp_logs' ); | |
| 472 | + | |
| 473 | + $query = new CT_Query( array( | |
| 474 | + 'orderby' => 'id', | |
| 475 | + 'order' => 'DESC', | |
| 476 | + 'items_per_page' => 5, | |
| 477 | + 'no_found_rows' => true, | |
| 478 | + 'cache_results' => false, | |
| 479 | + ) ); | |
| 480 | + | |
| 481 | + $logs = $query->get_results(); | |
| 482 | + | |
| 483 | + if ( count( $logs ) > 0 ) { | |
| 484 | + | |
| 485 | + echo '<div id="automatorwp-latest-logs" class="automatorwp-latest-logs">'; | |
| 486 | + | |
| 487 | + echo '<ul>'; | |
| 488 | + | |
| 489 | + $today = date( 'Y-m-d', current_time( 'timestamp' ) ); | |
| 490 | + $yesterday = date( 'Y-m-d', strtotime( '-1 day', current_time( 'timestamp' ) ) ); | |
| 491 | + | |
| 492 | + foreach ( $logs as $log ) { | |
| 493 | + | |
| 494 | + $user = get_userdata( $log->user_id ); | |
| 495 | + | |
| 496 | + if( ! $user ) { | |
| 497 | + $user_display_name = ''; | |
| 498 | + } else { | |
| 499 | + $user_display_name = $user->display_name; | |
| 500 | + | |
| 501 | + if( current_user_can( 'edit_users' ) ) { | |
| 502 | + $user_display_name = '<a href="' . get_edit_user_link( $log->user_id ) . '">' . $user_display_name . '</a>'; | |
| 503 | + } | |
| 504 | + } | |
| 505 | + | |
| 506 | + | |
| 507 | + ob_start(); | |
| 508 | + automatorwp_get_log_integration_icon( $log ); | |
| 509 | + $log_icon = ob_get_clean(); | |
| 510 | + | |
| 511 | + $log_title = ! empty( $log->title ) ? $log->title : __( '(No title)', 'automatorwp' ); | |
| 512 | + $log_title = '<strong><a href="' . ct_get_edit_link( 'automatorwp_logs', $log->id ) . '">' . $log_title . '</a></strong>'; | |
| 513 | + | |
| 514 | + $types = automatorwp_get_log_types(); | |
| 515 | + $type = isset( $types[$log->type] ) ? $types[$log->type] : $log->type; | |
| 516 | + | |
| 517 | + $time = strtotime( $log->date ); | |
| 518 | + | |
| 519 | + if ( date( 'Y-m-d', $time ) === $today ) { | |
| 520 | + $relative = __( 'Today', 'automatorwp' ); | |
| 521 | + } elseif ( date( 'Y-m-d', $time ) === $yesterday ) { | |
| 522 | + $relative = __( 'Yesterday', 'automatorwp' ); | |
| 523 | + } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) { | |
| 524 | + /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ | |
| 525 | + $relative = date_i18n( __( 'M jS Y' ), $time ); | |
| 526 | + } else { | |
| 527 | + /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */ | |
| 528 | + $relative = date_i18n( __( 'M jS' ), $time ); | |
| 529 | + } | |
| 530 | + | |
| 531 | + $date = sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, mysql2date( get_option( 'time_format' ), $log->date ) ); | |
| 532 | + | |
| 533 | + echo '<li>' | |
| 534 | + . '<div>' | |
| 535 | + . '<span>' . $log_icon . '</span>' | |
| 536 | + . '</div>' | |
| 537 | + . '<div>' | |
| 538 | + . '<span>' . $log_title . '</span>' | |
| 539 | + . '<span>' . $user_display_name . '</span>' | |
| 540 | + . '</div>' | |
| 541 | + . '<div>' | |
| 542 | + . '<span>' . $type . '</span>' | |
| 543 | + . '<span>' . $date . '</span>' | |
| 544 | + . '</div>' | |
| 545 | + . '</li>'; | |
| 546 | + } | |
| 547 | + | |
| 548 | + echo '</ul>'; | |
| 549 | + | |
| 550 | + echo '</div>'; | |
| 551 | + | |
| 552 | + } else { | |
| 553 | + echo '<p>' . __( 'Nothing to show :)', 'automatorwp' ) .'</p>'; | |
| 554 | + } | |
| 555 | +} | |
| 556 | + | |
| 557 | +/** | |
| 558 | + * Dashboard new automation box | |
| 559 | + * | |
| 560 | + * @since 2.0.0 | |
| 561 | + */ | |
| 562 | +function automatorwp_dashboard_new_automation_box() { | |
| 563 | + | |
| 564 | + $types = automatorwp_get_automation_types(); ?> | |
| 565 | + | |
| 566 | + <div class="automatorwp-automation-type-dialog"> | |
| 567 | + | |
| 568 | + <div class="automatorwp-automation-types"> | |
| 569 | + | |
| 570 | + <?php foreach( $types as $type => $args ) : | |
| 571 | + if( in_array( $type, automatorwp_get_automation_loop_types() ) ) continue; ?> | |
| 572 | + <div class="automatorwp-automation-type automatorwp-automation-type-<?php echo $type; ?>" data-type="<?php echo $type; ?>"> | |
| 573 | + <img src="<?php echo $args['image']; ?>" alt="<?php echo $args['label']; ?>"> | |
| 574 | + <div class="automatorwp-automation-type-description"> | |
| 575 | + <strong><?php echo $args['label']; ?></strong> | |
| 576 | + <span><?php echo $args['desc']; ?></span> | |
| 577 | + </div> | |
| 578 | + </div> | |
| 579 | + <?php endforeach; ?> | |
| 580 | + | |
| 581 | + </div> | |
| 582 | + | |
| 583 | + <h3> | |
| 584 | + <?php esc_html_e( 'Loop Automations', 'automatorwp' ); ?> | |
| 585 | + <span class="cmb-tooltip"> | |
| 586 | + <i class="dashicons dashicons-cmb-tooltip"></i> | |
| 587 | + <span class="cmb-tooltip-desc cmb-tooltip-top"><?php _e( 'Designed to run actions on a <b>group of elements</b>. Can be run <b>manually</b>, on a <b>specific date</b> or on a <b>recurring</b> basis.', 'automatorwp' ); ?></span> | |
| 588 | + </span> | |
| 589 | + </h3> | |
| 590 | + | |
| 591 | + <div class="automatorwp-automation-types"> | |
| 592 | + | |
| 593 | + <?php foreach( $types as $type => $args ) : | |
| 594 | + if( ! in_array( $type, automatorwp_get_automation_loop_types() ) ) continue; ?> | |
| 595 | + <div class="automatorwp-automation-type automatorwp-automation-type-<?php echo $type; ?>" data-type="<?php echo $type; ?>"> | |
| 596 | + <img src="<?php echo $args['image']; ?>" alt="<?php echo $args['label']; ?>"> | |
| 597 | + <div class="automatorwp-automation-type-description"> | |
| 598 | + <strong><?php echo $args['label']; ?></strong> | |
| 599 | + <span><?php echo $args['desc']; ?></span> | |
| 600 | + </div> | |
| 601 | + </div> | |
| 602 | + <?php endforeach; ?> | |
| 603 | + | |
| 604 | + </div> | |
| 605 | + | |
| 606 | + <div class="center"> | |
| 607 | + <a href="<?php esc_attr( admin_url( 'admin.php?page=add_automatorwp_automations' ) ) ?>" class="button button-primary"><?php esc_html_e( 'Add New Automation', 'automatorwp' ); ?></a> | |
| 608 | + </div> | |
| 609 | + | |
| 610 | + </div> | |
| 611 | + | |
| 612 | + <script> | |
| 613 | + (function ( $ ) { | |
| 614 | + | |
| 615 | + // Select automation type | |
| 616 | + $('body').on('click', '.automatorwp-automation-type-dialog .automatorwp-automation-type', function(e) { | |
| 617 | + $('.automatorwp-automation-type-dialog .automatorwp-automation-type-selected').removeClass('automatorwp-automation-type-selected'); | |
| 618 | + $(this).addClass('automatorwp-automation-type-selected'); | |
| 619 | + }); | |
| 620 | + | |
| 621 | + // Automation type dialog confirm button | |
| 622 | + $('body').on('click', '#automatorwp-dashboard-new-automation .button', function(e) { | |
| 623 | + e.preventDefault(); | |
| 624 | + | |
| 625 | + var $this = $(this); | |
| 626 | + | |
| 627 | + if( $this.hasClass('disabled') ) { | |
| 628 | + return; | |
| 629 | + } | |
| 630 | + | |
| 631 | + // Disable the button | |
| 632 | + $this.addClass('disabled'); | |
| 633 | + | |
| 634 | + $this.parent().prepend('<span class="spinner is-active" style="float: none; margin-top: 13px;"></span>'); | |
| 635 | + | |
| 636 | + var type = 'user'; | |
| 637 | + var selected = $('.automatorwp-automation-type-dialog .automatorwp-automation-type-selected'); | |
| 638 | + | |
| 639 | + if( selected.length ) { | |
| 640 | + type = selected.data('type'); | |
| 641 | + } | |
| 642 | + | |
| 643 | + var url = window.location.href.split('admin.php')[0]; | |
| 644 | + | |
| 645 | + // Redirect to the add new automation | |
| 646 | + window.location.href = url + 'admin.php?page=add_automatorwp_automations&type=' + type; | |
| 647 | + | |
| 648 | + }); | |
| 649 | + | |
| 650 | + })( jQuery ); | |
| 651 | + </script> | |
| 652 | + | |
| 653 | + <?php | |
| 654 | + | |
| 655 | +} | |
| 656 | + | |
| 657 | +/** | |
| 658 | + * Dashboard add-ons section | |
| 659 | + * | |
| 660 | + * @since 2.0.0 | |
| 661 | + */ | |
| 662 | +function automatorwp_dashboard_add_ons_section() { | |
| 663 | + | |
| 664 | + $plugins = automatorwp_plugins_api(); | |
| 665 | + | |
| 666 | + if ( is_wp_error( $plugins ) ) { | |
| 667 | + return; | |
| 668 | + } | |
| 669 | + | |
| 670 | + $add_ons_to_display = array( | |
| 671 | + 'calculator', | |
| 672 | + 'csv', | |
| 673 | + 'custom-user-fields', | |
| 674 | + 'formatter', | |
| 675 | + 'generator', | |
| 676 | + 'restrict-content', | |
| 677 | + 'user-lists', | |
| 678 | + 'qr-code', | |
| 679 | + 'schedule-actions', | |
| 680 | + 'webhooks', | |
| 681 | + ); | |
| 682 | + | |
| 683 | + $add_ons_to_display_2 = array( | |
| 684 | + 'block-users', | |
| 685 | + 'button', | |
| 686 | + 'link', | |
| 687 | + 'multimedia-content', | |
| 688 | + 'run-now', | |
| 689 | + 'code', | |
| 690 | + 'users', | |
| 691 | + 'posts', | |
| 692 | + 'comments', | |
| 693 | + 'emails', | |
| 694 | + ); | |
| 695 | + | |
| 696 | + $add_ons = array(); | |
| 697 | + $add_ons_2 = array(); | |
| 698 | + | |
| 699 | + foreach( $plugins as $plugin ) { | |
| 700 | + | |
| 701 | + if( in_array( $plugin->info->slug, $add_ons_to_display ) ) { | |
| 702 | + $add_ons[] = $plugin; | |
| 703 | + } | |
| 704 | + | |
| 705 | + if( in_array( $plugin->info->slug, $add_ons_to_display_2 ) ) { | |
| 706 | + $add_ons_2[] = $plugin; | |
| 707 | + } | |
| 708 | + | |
| 709 | + } | |
| 710 | + | |
| 711 | + ?> | |
| 712 | + | |
| 713 | + <?php // Add-ons ?> | |
| 714 | + <h1><?php echo esc_html_e( 'Add-ons', 'automatorwp' ); ?></h1> | |
| 715 | + <p class="automatorwp-section-desc"><?php esc_html_e( 'Pro add-ons help to maintain AutomatorWP and offer the most advanced features.', 'automatorwp' ); ?></p> | |
| 716 | + | |
| 717 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable automatorwp-dashboard-add-ons-section"> | |
| 718 | + <?php foreach( $add_ons as $add_on ) | |
| 719 | + automatorwp_dashboard_render_plugin_card( $add_on ); ?> | |
| 720 | + | |
| 721 | + <?php foreach( $add_ons_2 as $add_on ) | |
| 722 | + automatorwp_dashboard_render_plugin_card( $add_on ); ?> | |
| 723 | + | |
| 724 | + <div class="automatorwp-dashboard-more-add-ons"> | |
| 725 | + <a href="<?php echo admin_url( 'admin.php?page=automatorwp_add_ons' ); ?>" target="_blank"><?php esc_html_e( 'View all add-ons', 'automatorwp' ); ?></a> | |
| 726 | + </div> | |
| 727 | + </div> | |
| 728 | + | |
| 729 | + <?php | |
| 730 | + | |
| 731 | +} | |
| 732 | + | |
| 733 | +/** | |
| 734 | + * Dashboard integrations section | |
| 735 | + * | |
| 736 | + * @since 2.0.0 | |
| 737 | + */ | |
| 738 | +function automatorwp_dashboard_integrations_section() { | |
| 739 | + | |
| 740 | + $plugins = automatorwp_plugins_api(); | |
| 741 | + | |
| 742 | + if ( is_wp_error( $plugins ) ) { | |
| 743 | + return; | |
| 744 | + } | |
| 745 | + | |
| 746 | + $add_ons_to_display = array( | |
| 747 | + 'bbforms', | |
| 748 | + 'buddyboss', | |
| 749 | + 'gamipress', | |
| 750 | + 'learndash', | |
| 751 | + 'shortlinkspro', | |
| 752 | + 'woocommerce', | |
| 753 | + 'lifterlms', | |
| 754 | + 'fluentcrm', | |
| 755 | + 'presto-player', | |
| 756 | + 'groundhogg', | |
| 757 | + 'wpfusion', | |
| 758 | + ); | |
| 759 | + | |
| 760 | + $add_ons_to_display_2 = array( | |
| 761 | + 'advanced-custom-fields', | |
| 762 | + 'contact-form-7', | |
| 763 | + 'tutor', | |
| 764 | + 'affiliatewp', | |
| 765 | + 'slicewp', | |
| 766 | + 'elementor', | |
| 767 | + 'paid-memberships-pro', | |
| 768 | + 'popup-maker', | |
| 769 | + 'the-events-calendar', | |
| 770 | + 'wp-job-manager', | |
| 771 | + 'wishlist-member', | |
| 772 | + ); | |
| 773 | + | |
| 774 | + $add_ons = array(); | |
| 775 | + $add_ons_2 = array(); | |
| 776 | + | |
| 777 | + foreach( $plugins as $plugin ) { | |
| 778 | + | |
| 779 | + if( in_array( $plugin->info->slug, $add_ons_to_display ) ) { | |
| 780 | + $add_ons[] = $plugin; | |
| 781 | + } | |
| 782 | + | |
| 783 | + if( in_array( $plugin->info->slug, $add_ons_to_display_2 ) ) { | |
| 784 | + $add_ons_2[] = $plugin; | |
| 785 | + } | |
| 786 | + | |
| 787 | + } | |
| 788 | + | |
| 789 | + ?> | |
| 790 | + | |
| 791 | + <?php // Integrations ?> | |
| 792 | + <h1><?php echo esc_html_e( 'Integrations', 'automatorwp' ); ?></h1> | |
| 793 | + <p class="automatorwp-section-desc"><?php esc_html_e( 'AutomatorWP integrates seamlessly with your favourites WordPress plugins.', 'automatorwp' ); ?></p> | |
| 794 | + | |
| 795 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable automatorwp-dashboard-add-ons-section"> | |
| 796 | + <?php foreach( $add_ons as $add_on ) | |
| 797 | + automatorwp_dashboard_render_plugin_card( $add_on ); ?> | |
| 798 | + | |
| 799 | + <?php foreach( $add_ons_2 as $add_on ) | |
| 800 | + automatorwp_dashboard_render_plugin_card( $add_on ); ?> | |
| 801 | + | |
| 802 | + <div class="automatorwp-dashboard-more-add-ons"> | |
| 803 | + <a href="<?php echo admin_url( 'admin.php?page=automatorwp_add_ons&tab=integrations' ); ?>" target="_blank"><?php esc_html_e( 'View all integrations', 'automatorwp' ); ?></a> | |
| 804 | + </div> | |
| 805 | + </div> | |
| 806 | + | |
| 807 | + <?php | |
| 808 | + | |
| 809 | +} | |
| 810 | + | |
| 811 | +/** | |
| 812 | + * Dashboard apps section | |
| 813 | + * | |
| 814 | + * @since 2.0.0 | |
| 815 | + */ | |
| 816 | +function automatorwp_dashboard_apps_section() { | |
| 817 | + | |
| 818 | + $plugins = automatorwp_plugins_api(); | |
| 819 | + | |
| 820 | + if ( is_wp_error( $plugins ) ) { | |
| 821 | + return; | |
| 822 | + } | |
| 823 | + | |
| 824 | + $add_ons_to_display = array( | |
| 825 | + 'openai', | |
| 826 | + 'aweber', | |
| 827 | + 'google-sheets', | |
| 828 | + 'trello', | |
| 829 | + 'youtube', | |
| 830 | + 'zapier', | |
| 831 | + 'make', | |
| 832 | + 'hubspot', | |
| 833 | + 'whatsapp', | |
| 834 | + 'mautic', | |
| 835 | + ); | |
| 836 | + | |
| 837 | + $add_ons_to_display_2 = array( | |
| 838 | + 'instagram', | |
| 839 | + 'twitter', | |
| 840 | + 'google-calendar', | |
| 841 | + 'activecampaign', | |
| 842 | + 'bluesky', | |
| 843 | + 'campaign-monitor', | |
| 844 | + 'mailchimp', | |
| 845 | + 'mailerlite', | |
| 846 | + 'facebook', | |
| 847 | + 'zoom', | |
| 848 | + ); | |
| 849 | + | |
| 850 | + $add_ons = array(); | |
| 851 | + $add_ons_2 = array(); | |
| 852 | + | |
| 853 | + foreach( $plugins as $plugin ) { | |
| 854 | + | |
| 855 | + if( in_array( $plugin->info->slug, $add_ons_to_display ) ) { | |
| 856 | + $add_ons[] = $plugin; | |
| 857 | + } | |
| 858 | + | |
| 859 | + if( in_array( $plugin->info->slug, $add_ons_to_display_2 ) ) { | |
| 860 | + $add_ons_2[] = $plugin; | |
| 861 | + } | |
| 862 | + | |
| 863 | + } | |
| 864 | + | |
| 865 | + ?> | |
| 866 | + | |
| 867 | + <?php // Apps Integrations ?> | |
| 868 | + <h1><?php echo esc_html_e( 'Apps Integrations', 'automatorwp' ); ?></h1> | |
| 869 | + <p class="automatorwp-section-desc"><?php esc_html_e( 'Connect your WordPress with external platforms and apps to take your site even further!', 'automatorwp' ); ?></p> | |
| 870 | + | |
| 871 | + <div id="normal-sortables" class="meta-box-sortables ui-sortable automatorwp-dashboard-add-ons-section"> | |
| 872 | + <?php foreach( $add_ons as $add_on ) | |
| 873 | + automatorwp_dashboard_render_plugin_card( $add_on ); ?> | |
| 874 | + | |
| 875 | + <?php foreach( $add_ons_2 as $add_on ) | |
| 876 | + automatorwp_dashboard_render_plugin_card( $add_on ); ?> | |
| 877 | + | |
| 878 | + <div class="automatorwp-dashboard-more-add-ons"> | |
| 879 | + <a href="<?php echo admin_url( 'admin.php?page=automatorwp_add_ons&tab=app' ); ?>" target="_blank"><?php esc_html_e( 'View all apps integrations', 'automatorwp' ); ?></a> | |
| 880 | + </div> | |
| 881 | + </div> | |
| 882 | + | |
| 883 | + <?php | |
| 884 | + | |
| 885 | +} | |
| 886 | + | |
| 887 | +/** | |
| 888 | + * Dashboard videos box | |
| 889 | + * | |
| 890 | + * @since 2.0.0 | |
| 891 | + */ | |
| 892 | +function automatorwp_dashboard_videos_box() { | |
| 893 | + ?> | |
| 894 | + <div class="automatorwp-dashboard-columns"> | |
| 895 | + | |
| 896 | + <div class="automatorwp-dashboard-column automatorwp-dashboard-main-video"> | |
| 897 | + <iframe width="560" height="315" src="https://www.youtube.com/embed/8CcRMWx9EtA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
| 898 | + </div> | |
| 899 | + | |
| 900 | + <div class="automatorwp-dashboard-column automatorwp-dashboard-videos-list"> | |
| 901 | + <div class="automatorwp-dashboard-videos"> | |
| 902 | + <?php | |
| 903 | + $videos = array( | |
| 904 | + array( | |
| 905 | + 'id' => 'vWqRcEO8SgY', | |
| 906 | + 'title' => 'Creating your first automation on WordPress', | |
| 907 | + 'duration' => '1:53', | |
| 908 | + ), | |
| 909 | + array( | |
| 910 | + 'id' => 'bDXtY386RpE', | |
| 911 | + 'title' => 'Connect your WordPress plugins with Google Sheets', | |
| 912 | + 'duration' => '3:01', | |
| 913 | + ), | |
| 914 | + array( | |
| 915 | + 'id' => 'JHCWVbLqR0A', | |
| 916 | + 'title' => 'Give access to site B when a purchase is made on site A (WooCommerce & LifterLMS)', | |
| 917 | + 'duration' => '4:32', | |
| 918 | + ), | |
| 919 | + array( | |
| 920 | + 'id' => 'EkoEmKsSHMo', | |
| 921 | + 'title' => 'Run automations through Youtube videos', | |
| 922 | + 'duration' => '1:55', | |
| 923 | + ), | |
| 924 | + array( | |
| 925 | + 'id' => 'sZfYK6jtGg0', | |
| 926 | + 'title' => 'Run automations through Vimeo videos', | |
| 927 | + 'duration' => '2:06', | |
| 928 | + ), | |
| 929 | + ); | |
| 930 | + | |
| 931 | + foreach( $videos as $video ) { ?> | |
| 932 | + <div class="automatorwp-dashboard-video"> | |
| 933 | + <a href="https://www.youtube.com/watch?v=<?php echo $video['id']; ?>" target="_blank"> | |
| 934 | + <div class="automatorwp-dashboard-video-image"> | |
| 935 | + <img src="https://img.youtube.com/vi/<?php echo $video['id']; ?>/default.jpg" alt=""> | |
| 936 | + </div> | |
| 937 | + <div class="automatorwp-dashboard-video-details"> | |
| 938 | + <strong class="automatorwp-dashboard-video-title"><?php echo $video['title']; ?></strong> | |
| 939 | + <div class="automatorwp-dashboard-video-duration"><?php echo $video['duration']; ?></div> | |
| 940 | + </div> | |
| 941 | + </a> | |
| 942 | + </div> | |
| 943 | + <?php } | |
| 944 | + | |
| 945 | + ?> | |
| 946 | + </div> | |
| 947 | + <div class="automatorwp-dashboard-more-videos"> | |
| 948 | + <a href="https://www.youtube.com/channel/UCDBAqLYtoCYYUe2K_kx9Crw/videos" target="_blank"><?php esc_html_e( 'View all videos', 'automatorwp' ); ?></a> | |
| 949 | + </div> | |
| 950 | + </div> | |
| 951 | + | |
| 952 | + <div class="automatorwp-dashboard-column automatorwp-dashboard-videos-list"> | |
| 953 | + <div class="automatorwp-dashboard-videos"> | |
| 954 | + <?php | |
| 955 | + $videos = array( | |
| 956 | + array( | |
| 957 | + 'id' => '3YMMQ6QqrDo', | |
| 958 | + 'title' => 'Connect automations from different sites through Webhooks', | |
| 959 | + 'duration' => '2:55', | |
| 960 | + ), | |
| 961 | + array( | |
| 962 | + 'id' => 'Nk--kqIkC9Y', | |
| 963 | + 'title' => 'Schedule actions of an automation', | |
| 964 | + 'duration' => '2:11', | |
| 965 | + ), | |
| 966 | + array( | |
| 967 | + 'id' => '75PhOiqZRys', | |
| 968 | + 'title' => 'Run automations through button clicks', | |
| 969 | + 'duration' => '2:24', | |
| 970 | + ), | |
| 971 | + array( | |
| 972 | + 'id' => 'yTfygkAG4Lk', | |
| 973 | + 'title' => 'Run automations through link clicks', | |
| 974 | + 'duration' => '2:17', | |
| 975 | + ), | |
| 976 | + array( | |
| 977 | + 'id' => '2Tw3HIqvQuk', | |
| 978 | + 'title' => 'Connect your WordPress plugins with BuddyBoss', | |
| 979 | + 'duration' => '1:58', | |
| 980 | + ), | |
| 981 | + ); | |
| 982 | + | |
| 983 | + foreach( $videos as $video ) { ?> | |
| 984 | + <div class="automatorwp-dashboard-video"> | |
| 985 | + <a href="https://www.youtube.com/watch?v=<?php echo $video['id']; ?>" target="_blank"> | |
| 986 | + <div class="automatorwp-dashboard-video-image"> | |
| 987 | + <img src="https://img.youtube.com/vi/<?php echo $video['id']; ?>/default.jpg" alt=""> | |
| 988 | + </div> | |
| 989 | + <div class="automatorwp-dashboard-video-details"> | |
| 990 | + <strong class="automatorwp-dashboard-video-title"><?php echo $video['title']; ?></strong> | |
| 991 | + <div class="automatorwp-dashboard-video-duration"><?php echo $video['duration']; ?></div> | |
| 992 | + </div> | |
| 993 | + </a> | |
| 994 | + </div> | |
| 995 | + <?php } | |
| 996 | + | |
| 997 | + ?> | |
| 998 | + </div> | |
| 999 | + </div> | |
| 1000 | + | |
| 1001 | + </div> | |
| 1002 | + <?php | |
| 1003 | +} | |
| 1004 | + | |
| 1005 | +/** | |
| 1006 | + * Dashboard docs box | |
| 1007 | + * | |
| 1008 | + * @since 2.0.0 | |
| 1009 | + */ | |
| 1010 | +function automatorwp_dashboard_docs_box() { | |
| 1011 | + ?> | |
| 1012 | + <ul> | |
| 1013 | + <li><a href="https://automatorwp.com/docs/getting-started/what-is-automatorwp/" target="_blank"><?php esc_html_e( 'What is AutomatorWP?', 'automatorwp' ); ?></a></li> | |
| 1014 | + <li><a href="https://automatorwp.com/docs/getting-started/automations/" target="_blank"><?php esc_html_e( 'Automations', 'automatorwp' ); ?></a></li> | |
| 1015 | + <li><a href="https://automatorwp.com/docs/getting-started/triggers/" target="_blank"><?php esc_html_e( 'Triggers', 'automatorwp' ); ?></a></li> | |
| 1016 | + <li><a href="https://automatorwp.com/docs/getting-started/actions/" target="_blank"><?php esc_html_e( 'Actions', 'automatorwp' ); ?></a></li> | |
| 1017 | + <li><a href="https://automatorwp.com/docs/getting-started/filters/" target="_blank"><?php esc_html_e( 'Filters', 'automatorwp' ); ?></a></li> | |
| 1018 | + <li><a href="https://automatorwp.com/docs/getting-started/tags/" target="_blank"><?php esc_html_e( 'Tags', 'automatorwp' ); ?></a></li> | |
| 1019 | + <li><a href="https://automatorwp.com/docs/getting-started/logs/" target="_blank"><?php esc_html_e( 'Logs', 'automatorwp' ); ?></a></li> | |
| 1020 | + <li> | |
| 1021 | + <h3><?php esc_html_e( 'Automation Types', 'automatorwp' ); ?></h3> | |
| 1022 | + <ul> | |
| 1023 | + <li><a href="https://automatorwp.com/docs/getting-started/anonymous-automations/" target="_blank"><?php esc_html_e( 'Anonymous Automations', 'automatorwp' ); ?></a></li> | |
| 1024 | + <li><a href="https://automatorwp.com/docs/getting-started/all-users-automations/" target="_blank"><?php esc_html_e( 'All Users Automations', 'automatorwp' ); ?></a></li> | |
| 1025 | + <li><a href="https://automatorwp.com/docs/getting-started/all-posts-automations/" target="_blank"><?php esc_html_e( 'All Posts Automations', 'automatorwp' ); ?></a></li> | |
| 1026 | + <li><a href="https://automatorwp.com/docs/getting-started/import-file-automations/" target="_blank"><?php esc_html_e( 'Import File Automations', 'automatorwp' ); ?></a></li> | |
| 1027 | + <li><a href="https://automatorwp.com/docs/getting-started/restrict-content-automations/" target="_blank"><?php esc_html_e( 'Restrict Content Automations', 'automatorwp' ); ?></a></li> | |
| 1028 | + </ul> | |
| 1029 | + </li> | |
| 1030 | + </ul> | |
| 1031 | + <?php | |
| 1032 | +} | |
| 1033 | + | |
| 1034 | +/** | |
| 1035 | + * Dashboard advanced box | |
| 1036 | + * | |
| 1037 | + * @since 2.0.0 | |
| 1038 | + */ | |
| 1039 | +function automatorwp_dashboard_features_box() { | |
| 1040 | + ?> | |
| 1041 | + <ul> | |
| 1042 | + <li> | |
| 1043 | + <ul> | |
| 1044 | + <li><a href="https://automatorwp.com/docs/features/ai-assistant/" target="_blank"><?php esc_html_e( 'AI Assistant', 'automatorwp' ); ?></a></li> | |
| 1045 | + <li><a href="https://automatorwp.com/docs/features/sequential-triggers/" target="_blank"><?php esc_html_e( 'Sequential triggers', 'automatorwp' ); ?></a></li> | |
| 1046 | + <li><a href="https://automatorwp.com/docs/features/redirect-users/" target="_blank"><?php esc_html_e( 'Redirect users', 'automatorwp' ); ?></a></li> | |
| 1047 | + <li><a href="https://automatorwp.com/docs/features/import-export-automations-through-url/" target="_blank"><?php esc_html_e( 'Import & Export automations through URL', 'automatorwp' ); ?></a></li> | |
| 1048 | + </ul> | |
| 1049 | + </li> | |
| 1050 | + <li> | |
| 1051 | + <h3><?php esc_html_e( 'Special actions', 'automatorwp' ); ?></h3> | |
| 1052 | + <ul> | |
| 1053 | + <li><a href="https://automatorwp.com/docs/special-actions/call-a-function/" target="_blank"><?php esc_html_e( 'Call a function', 'automatorwp' ); ?></a></li> | |
| 1054 | + <li><a href="https://automatorwp.com/docs/special-actions/run-a-wordpress-hook/" target="_blank"><?php esc_html_e( 'Run a WordPress hook', 'automatorwp' ); ?></a></li> | |
| 1055 | + <li><a href="https://automatorwp.com/docs/special-actions/multiple-posts-actions/" target="_blank"><?php esc_html_e( 'Multiple posts actions', 'automatorwp' ); ?></a></li> | |
| 1056 | + </ul> | |
| 1057 | + </li> | |
| 1058 | + <li> | |
| 1059 | + <h3><?php esc_html_e( 'Special tags', 'automatorwp' ); ?></h3> | |
| 1060 | + <ul> | |
| 1061 | + <li><a href="https://automatorwp.com/docs/special-tags/user-meta-tag/" target="_blank"><?php esc_html_e( 'User meta tag', 'automatorwp' ); ?></a></li> | |
| 1062 | + <li><a href="https://automatorwp.com/docs/special-tags/post-meta-tag/" target="_blank"><?php esc_html_e( 'Post meta tag', 'automatorwp' ); ?></a></li> | |
| 1063 | + <li><a href="https://automatorwp.com/docs/special-tags/date-tag/" target="_blank"><?php esc_html_e( 'Date tag', 'automatorwp' ); ?></a></li> | |
| 1064 | + <li><a href="https://automatorwp.com/docs/special-tags/function-tags/" target="_blank"><?php esc_html_e( 'Function tags', 'automatorwp' ); ?></a></li> | |
| 1065 | + </ul> | |
| 1066 | + </li> | |
| 1067 | + </ul> | |
| 1068 | + <?php | |
| 1069 | +} | |
| 1070 | + | |
| 1071 | +/** | |
| 1072 | + * Dashboard advanced features box | |
| 1073 | + * | |
| 1074 | + * @since 2.0.0 | |
| 1075 | + */ | |
| 1076 | +function automatorwp_dashboard_advanced_features_box() { | |
| 1077 | + ?> | |
| 1078 | + <ul> | |
| 1079 | + <li><a href="https://automatorwp.com/docs/connecting-sites/create-an-account-in-site-b-when-a-user-interacts-on-site-a/" target="_blank"><?php esc_html_e( 'Create an account in Site B when a user interacts on Site A', 'automatorwp' ); ?></a></li> | |
| 1080 | + <li><a href="https://automatorwp.com/docs/connecting-sites/enroll-in-a-course-of-site-b-when-a-purchase-is-made-in-site-a/" target="_blank"><?php esc_html_e( 'Enroll in a course of Site B when a purchase is made in Site A', 'automatorwp' ); ?></a></li> | |
| 1081 | + <li><a href="https://automatorwp.com/docs/import-csv/import-data-from-csv/" target="_blank"><?php esc_html_e( 'Import data from CSV', 'automatorwp' ); ?></a></li> | |
| 1082 | + <li><a href="https://automatorwp.com/docs/user-lists/create-user-lists/" target="_blank"><?php esc_html_e( 'Create User Lists', 'automatorwp' ); ?></a></li> | |
| 1083 | + <li><a href="https://automatorwp.com/docs/restrict-content/" target="_blank"><?php esc_html_e( 'Restrict Content', 'automatorwp' ); ?></a></li> | |
| 1084 | + <li><a href="https://automatorwp.com/docs/custom-user-fields/add-custom-user-fields/" target="_blank"><?php esc_html_e( 'Add Custom User Fields', 'automatorwp' ); ?></a></li> | |
| 1085 | + <li><a href="https://automatorwp.com/docs/calculator/calculate-formula/" target="_blank"><?php esc_html_e( 'Calculate formula', 'automatorwp' ); ?></a></li> | |
| 1086 | + <li><a href="https://automatorwp.com/docs/formatter/formatter-actions/" target="_blank"><?php esc_html_e( 'Format Content', 'automatorwp' ); ?></a></li> | |
| 1087 | + <li><a href="https://automatorwp.com/docs/generator/generator-actions/" target="_blank"><?php esc_html_e( 'Generate Content', 'automatorwp' ); ?></a></li> | |
| 1088 | + <li><a href="https://automatorwp.com/docs/qr-code/generate-a-qr-code/" target="_blank"><?php esc_html_e( 'Generate a QR Code', 'automatorwp' ); ?></a></li> | |
| 1089 | + <li><a href="https://automatorwp.com/docs/schedule-actions/schedule-actions-of-an-automation/" target="_blank"><?php esc_html_e( 'Schedule actions of an automation', 'automatorwp' ); ?></a></li> | |
| 1090 | + <li><a href="https://automatorwp.com/docs/button/" target="_blank"><?php esc_html_e( 'Run automations through button clicks', 'automatorwp' ); ?></a> <?php esc_html_e( 'or', 'automatorwp' ); ?> <a href="https://automatorwp.com/docs/link/" target="_blank"><?php esc_html_e( 'link clicks', 'automatorwp' ); ?></a></li> | |
| 1091 | + </ul> | |
| 1092 | + <?php | |
| 1093 | +} | |
| 1094 | + | |
| 1095 | +/** | |
| 1096 | + * Dashboard support box | |
| 1097 | + * | |
| 1098 | + * @since 2.0.0 | |
| 1099 | + */ | |
| 1100 | +function automatorwp_dashboard_support_box() { | |
| 1101 | + ?> | |
| 1102 | + <ul> | |
| 1103 | + <li><a href="https://automatorwp.com/contact-us/" target="_blank"><?php esc_html_e( 'Contact us', 'automatorwp' ); ?></a></li> | |
| 1104 | + <li><a href="https://wordpress.org/support/plugin/automatorwp" target="_blank"><?php esc_html_e( 'Support Forums', 'automatorwp' ); ?></a></li> | |
| 1105 | + <li><a href="https://automatorwp.com/faq/" target="_blank"><?php esc_html_e( 'FAQ', 'automatorwp' ); ?></a></li> | |
| 1106 | + </ul> | |
| 1107 | + <?php | |
| 1108 | +} | |
| 1109 | + | |
| 1110 | +/** | |
| 1111 | + * Dashboard plugins box | |
| 1112 | + * | |
| 1113 | + * @since 2.0.0 | |
| 1114 | + */ | |
| 1115 | +function automatorwp_dashboard_plugins_box() { | |
| 1116 | + $url = AUTOMATORWP_URL . 'assets/img/logos/'; | |
| 1117 | + ?> | |
| 1118 | + <ul id="our-plugins-list" class="our-plugins-list"> | |
| 1119 | + <li> | |
| 1120 | + <a href="https://wordpress.org/plugins/gamipress/" target="_blank"> | |
| 1121 | + <img src="<?php echo esc_attr( $url . 'gamipress.svg' ); ?>" class="our-plugins-img our-plugins-gamipress" loading="lazy"> | |
| 1122 | + <span>GamiPress</span> | |
| 1123 | + </a> | |
| 1124 | + </li> | |
| 1125 | + <li> | |
| 1126 | + <a href="https://wordpress.org/plugins/automatorwp/" target="_blank"> | |
| 1127 | + <img src="<?php echo esc_attr( $url . 'automatorwp.svg' ); ?>" class="our-plugins-img our-plugins-automatorwp" loading="lazy"> | |
| 1128 | + <span>AutomatorWP</span> | |
| 1129 | + </a> | |
| 1130 | + </li> | |
| 1131 | + <li> | |
| 1132 | + <a href="https://wordpress.org/plugins/shortlinkspro/" target="_blank"> | |
| 1133 | + <img src="<?php echo esc_attr( $url . 'shortlinkspro.svg' ); ?>" class="our-plugins-img our-plugins-shortlinkspro" loading="lazy"> | |
| 1134 | + <span>ShortLinks Pro</span> | |
| 1135 | + </a> | |
| 1136 | + </li> | |
| 1137 | + <li> | |
| 1138 | + <a href="https://wordpress.org/plugins/bbforms/" target="_blank"> | |
| 1139 | + <img src="<?php echo esc_attr( $url . 'bbforms.svg' ); ?>" class="our-plugins-img our-plugins-bbforms" loading="lazy"> | |
| 1140 | + <span>BBForms</span> | |
| 1141 | + </a> | |
| 1142 | + </li> | |
| 1143 | + </ul> | |
| 1144 | + <?php | |
| 1145 | +} | |
| 1146 | + | |
| 1147 | +/** | |
| 1148 | + * Dashboard team box | |
| 1149 | + * | |
| 1150 | + * @since 2.0.0 | |
| 1151 | + */ | |
| 1152 | +function automatorwp_dashboard_team_box() { | |
| 1153 | + ?> | |
| 1154 | + <ul id="contributors-list" class="contributors-list"> | |
| 1155 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1156 | + <a href="https://profiles.wordpress.org/rubengc/" target="_blank"> | |
| 1157 | + <img src="https://secure.gravatar.com/avatar/103d0ec19ade3804009f105974fd4d05?s=64&d=mm&r=g" class="avatar avatar-32 photo" loading="lazy"> | |
| 1158 | + <span class="cmb-tooltip-desc cmb-tooltip-top center">Ruben Garcia</span> | |
| 1159 | + </a> | |
| 1160 | + </li> | |
| 1161 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1162 | + <a href="https://profiles.wordpress.org/eneribs/" target="_blank"> | |
| 1163 | + <img src="https://secure.gravatar.com/avatar/7103ea44d40111ab67a22efe7ebd6f71?s=64&d=mm&r=g" class="avatar avatar-32 photo" loading="lazy"> | |
| 1164 | + <span class="cmb-tooltip-desc cmb-tooltip-top center">Irene Berna</span> | |
| 1165 | + </a> | |
| 1166 | + </li> | |
| 1167 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1168 | + <a href="https://profiles.wordpress.org/dioni00/" target="_blank"> | |
| 1169 | + <img src="https://secure.gravatar.com/avatar/6de68ad3863fdf3c92a194ba16546571?s=64&d=mm&r=g" class="avatar avatar-32 photo" loading="lazy"> | |
| 1170 | + <span class="cmb-tooltip-desc cmb-tooltip-top center">Dionisio Sanchez</span> | |
| 1171 | + </a> | |
| 1172 | + </li> | |
| 1173 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1174 | + <a href="https://profiles.wordpress.org/tinocalvo/" target="_blank"> | |
| 1175 | + <img src="https://secure.gravatar.com/avatar/a438aa12efcfb007f3db145d6ad37def?s=64&d=retro&r=g" class="avatar avatar-32 photo" loading="lazy"> | |
| 1176 | + <span class="cmb-tooltip-desc cmb-tooltip-top center">Tino Calvo</span> | |
| 1177 | + </a> | |
| 1178 | + </li> | |
| 1179 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1180 | + <a href="https://profiles.wordpress.org/pacogon/" target="_blank"> | |
| 1181 | + <img src="https://secure.gravatar.com/avatar/348f374779e7433ad6bf3930cb2a492e?s=64&d=mm&r=g" class="avatar avatar-32 photo" loading="lazy"> | |
| 1182 | + <span class="cmb-tooltip-desc cmb-tooltip-top center">Paco González</span> | |
| 1183 | + </a> | |
| 1184 | + </li> | |
| 1185 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1186 | + <a href="https://profiles.wordpress.org/flabernardez/" target="_blank"> | |
| 1187 | + <img src="https://secure.gravatar.com/avatar/fd626d9a8463260894f0f6f07a5cc71a?s=64&d=mm&r=g" class="avatar avatar-32 photo" loading="lazy"> | |
| 1188 | + <span class="cmb-tooltip-desc cmb-tooltip-top center">Flavia Bernardez</span> | |
| 1189 | + </a> | |
| 1190 | + </li> | |
| 1191 | + </ul> | |
| 1192 | + <?php | |
| 1193 | +} | |
| 1194 | + | |
| 1195 | +/** | |
| 1196 | + * Dashboard involved box | |
| 1197 | + * | |
| 1198 | + * @since 2.0.0 | |
| 1199 | + */ | |
| 1200 | +function automatorwp_dashboard_social_box() { | |
| 1201 | + ?> | |
| 1202 | + <ul class="automatorwp-dashboard-social-list"> | |
| 1203 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1204 | + <a href="https://www.youtube.com/channel/UCDBAqLYtoCYYUe2K_kx9Crw" target="_blank"><i class="dashicons dashicons-youtube"></i></a> | |
| 1205 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Subscribe to our YouTube channel', 'automatorwp' ); ?></span> | |
| 1206 | + </li> | |
| 1207 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1208 | + <a href="https://www.facebook.com/AutomatorWP/" target="_blank"><i class="dashicons dashicons-facebook-alt"></i></a> | |
| 1209 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Follow us on Facebook', 'automatorwp' ); ?></span> | |
| 1210 | + </li> | |
| 1211 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1212 | + <a href="https://www.facebook.com/groups/automatorwp" target="_blank"><i class="dashicons dashicons-groups"></i></a> | |
| 1213 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Join our Facebook community', 'automatorwp' ); ?></span> | |
| 1214 | + </li> | |
| 1215 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1216 | + <a href="https://twitter.com/AutomatorWP" target="_blank"><i class="dashicons dashicons-twitter"></i></a> | |
| 1217 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Follow @AutomatorWP on Twitter', 'automatorwp' ); ?></span> | |
| 1218 | + </li> | |
| 1219 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1220 | + <a href="https://www.linkedin.com/company/65262548/" target="_blank"><i class="dashicons dashicons-linkedin"></i></a> | |
| 1221 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Follow us on LinkedIn', 'automatorwp' ); ?></span> | |
| 1222 | + </li> | |
| 1223 | + </ul> | |
| 1224 | + | |
| 1225 | + <h3><?php esc_html_e( 'Contact us', 'automatorwp' ); ?></h3> | |
| 1226 | + <ul class="automatorwp-dashboard-social-list"> | |
| 1227 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1228 | + <a href="https://wordpress.org/support/plugin/automatorwp/" target="_blank"><i class="dashicons dashicons-wordpress"></i></a> | |
| 1229 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Support Forums', 'automatorwp' ); ?></span> | |
| 1230 | + </li> | |
| 1231 | + <li class="cmb-tooltip cmb-tooltip-no-opacity"> | |
| 1232 | + <a href="https://automatorwp.com/contact-us/" target="_blank"><i class="dashicons dashicons-email-alt"></i></a> | |
| 1233 | + <span class="cmb-tooltip-desc cmb-tooltip-top center"><?php esc_html_e( 'Open a support ticket', 'automatorwp' ); ?></span> | |
| 1234 | + </li> | |
| 1235 | + </ul> | |
| 1236 | + <?php | |
| 1237 | +} | |
| 1238 | + | |
| 1239 | +/** | |
| 1240 | + * Dashboard involved box | |
| 1241 | + * | |
| 1242 | + * @since 2.0.0 | |
| 1243 | + */ | |
| 1244 | +function automatorwp_dashboard_involved_box() { | |
| 1245 | + ?> | |
| 1246 | + <p><?php esc_html_e( 'AutomatorWP is a free and open-source plugin accessible to everyone just like WordPress. There are many ways you can help support AutomatorWP', 'automatorwp' ); ?></p> | |
| 1247 | + <ul> | |
| 1248 | + <li><a href="https://translate.wordpress.org/projects/wp-plugins/automatorwp/" target="_blank"><i class="dashicons dashicons-translation"></i> <?php esc_html_e( 'Translate AutomatorWP into your language.', 'automatorwp' ); ?></a></li> | |
| 1249 | + <li><a href="https://wordpress.org/plugins/automatorwp/#reviews" target="_blank"><i class="dashicons dashicons-wordpress"></i> <?php esc_html_e( 'Review AutomatorWP on WordPress.org.', 'automatorwp' ); ?></a></li> | |
| 1250 | + </ul> | |
| 1251 | + <?php | |
| 1252 | +} | |